Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2be4d5aa4e | ||
|
|
e91251759b | ||
|
|
0093c4aec2 | ||
|
|
0563521887 | ||
|
|
9ade0fa0ca | ||
|
|
3ec934a54c | ||
|
|
39fd491d24 | ||
|
|
381fef8502 | ||
|
|
c4cc2712ee | ||
|
|
152d07f21e | ||
|
|
49ef8ae82f | ||
|
|
261a6d4d40 | ||
|
|
0b87f3e4ed | ||
|
|
7f8a764131 | ||
|
|
9a9aff0880 | ||
|
|
f188dde6e4 | ||
|
|
4566794f44 | ||
|
|
c727142689 | ||
|
|
4420c72965 | ||
|
|
e55528e69f | ||
|
|
e86aa5e535 | ||
|
|
59f95d8174 | ||
|
|
159777818d | ||
|
|
00ac23160e | ||
|
|
46f9b4434e | ||
|
|
d0cb43435b | ||
|
|
34bc152817 | ||
|
|
fc8c5976f8 | ||
|
|
259d21c968 | ||
|
|
21a2cffcc0 | ||
|
|
865e0b3301 | ||
|
|
7fad4b5eec | ||
|
|
3a5b5a68e4 | ||
|
|
2773255b38 | ||
|
|
85ef3dc38b | ||
|
|
87e3f59ee1 | ||
|
|
80663f7d39 | ||
|
|
ab4ddb9f8b | ||
|
|
6969e79029 | ||
|
|
448279d98c | ||
|
|
7e224301cd | ||
|
|
df97937948 | ||
|
|
ed8b406b7d | ||
|
|
e87d31aded | ||
|
|
964a4fe0f9 | ||
|
|
e07d28d6b1 | ||
|
|
ab26148a67 | ||
|
|
fd1c473cb6 | ||
|
|
56e6225dd1 | ||
|
|
bdc6562116 | ||
|
|
9312783793 |
@@ -0,0 +1,38 @@
|
|||||||
|
{"_e":"root:init","_t":1787490823136,"format":"v0-jsonl","version":"57.0.12"}
|
||||||
|
{"_e":"env:mode","_t":1787490823267,"nodeEnv":"production","babelEnv":"production","mode":"production"}
|
||||||
|
{"_e":"env:load","_t":1787490823269,"mode":"production","files":[],"env":{}}
|
||||||
|
{"_e":"devserver:start","_t":1787490823283,"mode":"production","web":true,"baseUrl":"","asyncRoutes":false,"routerRoot":"../../../app","serverComponents":false,"serverActions":false,"serverRendering":false,"apiRoutes":false,"exporting":true}
|
||||||
|
{"_e":"metro:config","_t":1787490823513,"serverRoot":"../../..","projectRoot":"../../..","exporting":true,"flags":{"autolinkingModuleResolution":false,"serverActions":false,"serverComponents":false,"reactCompiler":false,"optimizeGraph":false,"treeshaking":false,"logbox":false}}
|
||||||
|
{"_e":"metro:instantiate","_t":1787490823624,"atlas":false,"workers":10,"host":null,"port":null}
|
||||||
|
{"_e":"metro:bundling:started","_t":1787490824135,"id":"1","platform":"web","environment":null,"entry":"node_modules/expo-router/entry.js"}
|
||||||
|
{"_e":"root:init","_t":1787490834893,"format":"v0-jsonl","version":"57.0.12"}
|
||||||
|
{"_e":"env:mode","_t":1787490834983,"nodeEnv":"production","babelEnv":"production","mode":"production"}
|
||||||
|
{"_e":"env:load","_t":1787490834985,"mode":"production","files":[],"env":{}}
|
||||||
|
{"_e":"devserver:start","_t":1787490834998,"mode":"production","web":true,"baseUrl":"","asyncRoutes":false,"routerRoot":"../../../app","serverComponents":false,"serverActions":false,"serverRendering":false,"apiRoutes":false,"exporting":true}
|
||||||
|
{"_e":"metro:config","_t":1787490835165,"serverRoot":"../../..","projectRoot":"../../..","exporting":true,"flags":{"autolinkingModuleResolution":false,"serverActions":false,"serverComponents":false,"reactCompiler":false,"optimizeGraph":false,"treeshaking":false,"logbox":false}}
|
||||||
|
{"_e":"metro:instantiate","_t":1787490835236,"atlas":false,"workers":10,"host":null,"port":null}
|
||||||
|
{"_e":"metro:bundling:started","_t":1787490835782,"id":"1","platform":"web","environment":null,"entry":"node_modules/expo-router/entry.js"}
|
||||||
|
{"_e":"root:init","_t":1787490897618,"format":"v0-jsonl","version":"57.0.12"}
|
||||||
|
{"_e":"env:mode","_t":1787490897716,"nodeEnv":"production","babelEnv":"production","mode":"production"}
|
||||||
|
{"_e":"env:load","_t":1787490897718,"mode":"production","files":[],"env":{}}
|
||||||
|
{"_e":"devserver:start","_t":1787490897732,"mode":"production","web":true,"baseUrl":"","asyncRoutes":false,"routerRoot":"../../../app","serverComponents":false,"serverActions":false,"serverRendering":false,"apiRoutes":false,"exporting":true}
|
||||||
|
{"_e":"metro:config","_t":1787490897904,"serverRoot":"../../..","projectRoot":"../../..","exporting":true,"flags":{"autolinkingModuleResolution":false,"serverActions":false,"serverComponents":false,"reactCompiler":false,"optimizeGraph":false,"treeshaking":false,"logbox":false}}
|
||||||
|
{"_e":"metro:instantiate","_t":1787490897978,"atlas":false,"workers":10,"host":null,"port":null}
|
||||||
|
{"_e":"metro:bundling:started","_t":1787490898645,"id":"1","platform":"web","environment":null,"entry":"node_modules/expo-router/entry.js"}
|
||||||
|
{"_e":"metro:bundling:done","_t":1787490904477,"id":"1","total":743,"ms":5831.675237}
|
||||||
|
{"_e":"root:init","_t":1787490907952,"format":"v0-jsonl","version":"57.0.12"}
|
||||||
|
{"_e":"env:mode","_t":1787490908055,"nodeEnv":"production","babelEnv":"production","mode":"production"}
|
||||||
|
{"_e":"env:load","_t":1787490908056,"mode":"production","files":[],"env":{}}
|
||||||
|
{"_e":"devserver:start","_t":1787490908069,"mode":"production","web":true,"baseUrl":"","asyncRoutes":false,"routerRoot":"../../../app","serverComponents":false,"serverActions":false,"serverRendering":false,"apiRoutes":false,"exporting":true}
|
||||||
|
{"_e":"metro:config","_t":1787490908244,"serverRoot":"../../..","projectRoot":"../../..","exporting":true,"flags":{"autolinkingModuleResolution":false,"serverActions":false,"serverComponents":false,"reactCompiler":false,"optimizeGraph":false,"treeshaking":false,"logbox":false}}
|
||||||
|
{"_e":"metro:instantiate","_t":1787490908323,"atlas":false,"workers":10,"host":null,"port":null}
|
||||||
|
{"_e":"metro:bundling:started","_t":1787490908955,"id":"1","platform":"web","environment":null,"entry":"node_modules/expo-router/entry.js"}
|
||||||
|
{"_e":"metro:bundling:done","_t":1787490909421,"id":"1","total":731,"ms":465.745099}
|
||||||
|
{"_e":"root:init","_t":1787490971753,"format":"v0-jsonl","version":"57.0.12"}
|
||||||
|
{"_e":"env:mode","_t":1787490972145,"nodeEnv":"production","babelEnv":"production","mode":"production"}
|
||||||
|
{"_e":"env:load","_t":1787490972146,"mode":"production","files":[],"env":{}}
|
||||||
|
{"_e":"devserver:start","_t":1787490972158,"mode":"production","web":true,"baseUrl":"","asyncRoutes":false,"routerRoot":"../../../app","serverComponents":false,"serverActions":false,"serverRendering":false,"apiRoutes":false,"exporting":true}
|
||||||
|
{"_e":"metro:config","_t":1787490972351,"serverRoot":"../../..","projectRoot":"../../..","exporting":true,"flags":{"autolinkingModuleResolution":false,"serverActions":false,"serverComponents":false,"reactCompiler":false,"optimizeGraph":false,"treeshaking":false,"logbox":false}}
|
||||||
|
{"_e":"metro:instantiate","_t":1787490972454,"atlas":false,"workers":10,"host":null,"port":null}
|
||||||
|
{"_e":"metro:bundling:started","_t":1787490973074,"id":"1","platform":"web","environment":null,"entry":"node_modules/expo-router/entry.js"}
|
||||||
|
{"_e":"metro:bundling:done","_t":1787490973517,"id":"1","total":743,"ms":441.956684}
|
||||||
@@ -29,16 +29,25 @@ jobs:
|
|||||||
|
|
||||||
- name: Install Android SDK
|
- name: Install Android SDK
|
||||||
run: |
|
run: |
|
||||||
mkdir -p "$ANDROID_HOME/cmdline-tools"
|
if [ -x "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" ]; then
|
||||||
wget -q https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -O /tmp/cmdtools.zip
|
echo "Android SDK already present in cache"
|
||||||
unzip -q /tmp/cmdtools.zip -d "$ANDROID_HOME/cmdline-tools"
|
else
|
||||||
mv "$ANDROID_HOME/cmdline-tools/cmdline-tools" "$ANDROID_HOME/cmdline-tools/latest"
|
rm -rf "$ANDROID_HOME/cmdline-tools"
|
||||||
yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --licenses > /dev/null
|
mkdir -p "$ANDROID_HOME/cmdline-tools"
|
||||||
|
wget -q https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -O /tmp/cmdtools.zip
|
||||||
|
unzip -q /tmp/cmdtools.zip -d "$ANDROID_HOME/cmdline-tools"
|
||||||
|
mv "$ANDROID_HOME/cmdline-tools/cmdline-tools" "$ANDROID_HOME/cmdline-tools/latest"
|
||||||
|
fi
|
||||||
|
printf 'y\n' | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --licenses > /dev/null
|
||||||
"$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" \
|
"$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" \
|
||||||
"platform-tools" \
|
"platform-tools" \
|
||||||
"platforms;android-35" \
|
"platforms;android-35" \
|
||||||
|
"platforms;android-36" \
|
||||||
"build-tools;35.0.0" \
|
"build-tools;35.0.0" \
|
||||||
|
"build-tools;36.0.0" \
|
||||||
"ndk;27.1.12297006"
|
"ndk;27.1.12297006"
|
||||||
|
mkdir -p carry-your-live/android/app
|
||||||
|
echo "sdk.dir=$ANDROID_HOME" > carry-your-live/android/app/local.properties
|
||||||
|
|
||||||
- name: Install JS dependencies
|
- name: Install JS dependencies
|
||||||
working-directory: carry-your-live
|
working-directory: carry-your-live
|
||||||
@@ -46,6 +55,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Generate debug keystore (signs the release APK)
|
- name: Generate debug keystore (signs the release APK)
|
||||||
run: |
|
run: |
|
||||||
|
mkdir -p carry-your-live/android/app
|
||||||
|
rm -f carry-your-live/android/app/debug.keystore
|
||||||
keytool -genkeypair -v \
|
keytool -genkeypair -v \
|
||||||
-keystore carry-your-live/android/app/debug.keystore \
|
-keystore carry-your-live/android/app/debug.keystore \
|
||||||
-alias androiddebugkey -storepass android -keypass android \
|
-alias androiddebugkey -storepass android -keypass android \
|
||||||
@@ -53,11 +64,12 @@ jobs:
|
|||||||
-dname "CN=Android Debug,O=Android,C=US"
|
-dname "CN=Android Debug,O=Android,C=US"
|
||||||
|
|
||||||
- name: Build release APK
|
- name: Build release APK
|
||||||
working-directory: carry-your-live/android
|
run: |
|
||||||
run: ./gradlew assembleRelease
|
cd carry-your-live/android
|
||||||
|
./gradlew assembleRelease
|
||||||
|
|
||||||
- name: Upload APK
|
- name: Upload APK
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: carry-your-live-release
|
name: carry-your-live-release
|
||||||
path: carry-your-live/android/app/build/outputs/apk/release/*.apk
|
path: carry-your-live/android/app/build/outputs/release/app-release.apk
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
name: Build Desktop (deb)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 22
|
||||||
|
|
||||||
|
- name: Install JS dependencies
|
||||||
|
working-directory: carry-your-live
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Export web bundle
|
||||||
|
working-directory: carry-your-live
|
||||||
|
run: npx expo export --platform web
|
||||||
|
|
||||||
|
- name: Build deb package
|
||||||
|
working-directory: carry-your-live
|
||||||
|
run: npx electron-builder --linux deb --config electron-builder.config.js
|
||||||
|
|
||||||
|
- name: Upload deb
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: carry-your-live-desktop-deb
|
||||||
|
path: carry-your-live/desktop-build/*.deb
|
||||||
@@ -11,7 +11,6 @@ permissions:
|
|||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.event_name == 'push' && startsWith(github.event.head_commit.message, 'Merge pull request')
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
node_modules
|
node_modules/
|
||||||
|
dist/
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# Architekt Agent
|
||||||
|
|
||||||
|
## Role
|
||||||
|
System architecture design, technical strategy, and scalability planning.
|
||||||
|
|
||||||
|
## Responsibilities
|
||||||
|
- High-level system design
|
||||||
|
- Technology stack selection
|
||||||
|
- Performance optimization
|
||||||
|
- Architecture documentation
|
||||||
|
- Trade-off analysis
|
||||||
|
|
||||||
|
## Key Metrics
|
||||||
|
- System scalability
|
||||||
|
- Performance benchmarks
|
||||||
|
- Technical debt ratio
|
||||||
|
- Architecture compliance
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"agents": {
|
||||||
|
"manager": ".opencode/manager.md",
|
||||||
|
"architekt": ".opencode/architekt.md",
|
||||||
|
"software_engineer": ".opencode/software_engineer.md",
|
||||||
|
"hardware_engineer": ".opencode/hardware_engineer.md",
|
||||||
|
"tester": ".opencode/tester.md",
|
||||||
|
"docs": ".opencode/docs.md",
|
||||||
|
"deployment": ".opencode/deployment.md",
|
||||||
|
"vla": ".opencode/vla.md"
|
||||||
|
},
|
||||||
|
"subagent_depth": 999999
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# Deployment Agent
|
||||||
|
|
||||||
|
## Role
|
||||||
|
CI/CD, infrastructure, and release management.
|
||||||
|
|
||||||
|
## Responsibilities
|
||||||
|
- CI/CD pipeline management
|
||||||
|
- Infrastructure as code
|
||||||
|
- Release orchestration
|
||||||
|
- Environment management
|
||||||
|
- Monitoring and alerting
|
||||||
|
|
||||||
|
## Key Metrics
|
||||||
|
- Deployment frequency
|
||||||
|
- Lead time for changes
|
||||||
|
- Mean time to recovery
|
||||||
|
- Change success rate
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# Docs Agent
|
||||||
|
|
||||||
|
## Role
|
||||||
|
Technical documentation, API docs, and knowledge management.
|
||||||
|
|
||||||
|
## Responsibilities
|
||||||
|
- API documentation
|
||||||
|
- User guides
|
||||||
|
- Architecture docs
|
||||||
|
- Change logs
|
||||||
|
- Knowledge base maintenance
|
||||||
|
|
||||||
|
## Key Metrics
|
||||||
|
- Documentation completeness
|
||||||
|
- Update frequency
|
||||||
|
- User satisfaction
|
||||||
|
- Searchability
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# Hardware Engineer Agent
|
||||||
|
|
||||||
|
## Role
|
||||||
|
Hardware integration, device management, and embedded systems.
|
||||||
|
|
||||||
|
## Responsibilities
|
||||||
|
- Hardware selection and integration
|
||||||
|
- Device driver development
|
||||||
|
- Embedded firmware
|
||||||
|
- Prototyping and testing
|
||||||
|
- Hardware-software interface
|
||||||
|
|
||||||
|
## Key Metrics
|
||||||
|
- Hardware compatibility rate
|
||||||
|
- Power consumption
|
||||||
|
- Latency measurements
|
||||||
|
- Component reliability
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# Manager Agent
|
||||||
|
|
||||||
|
## Role
|
||||||
|
Project management, task coordination, prioritization, and team oversight.
|
||||||
|
|
||||||
|
## Responsibilities
|
||||||
|
- Task decomposition and assignment
|
||||||
|
- Progress tracking and status reporting
|
||||||
|
- Risk identification and mitigation
|
||||||
|
- Resource allocation
|
||||||
|
- Stakeholder communication
|
||||||
|
|
||||||
|
## Key Metrics
|
||||||
|
- Sprint velocity
|
||||||
|
- Task completion rate
|
||||||
|
- Blockers resolved
|
||||||
|
- Timeline adherence
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
# Carry Your Live - Project Summary
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
A minimalist, offline-first task management app built with Expo, React Native, and WatermelonDB. Features three primary screens: To-Do List, Add New Task, and Calendar with bottom navigation.
|
||||||
|
|
||||||
|
## Core Features
|
||||||
|
- **Offline-First Architecture**: Full CRUD operations work offline with WatermelonDB + SQLite
|
||||||
|
- **Auto-Sync**: Background synchronization with custom Postgres API when online
|
||||||
|
- **Cross-Platform**: iOS, Android, and Web from single codebase
|
||||||
|
|
||||||
|
## Tech Stack
|
||||||
|
| Layer | Technology |
|
||||||
|
|-------|------------|
|
||||||
|
| Framework | Expo (React Native) |
|
||||||
|
| Language | TypeScript |
|
||||||
|
| Navigation | Expo Router (file-based) |
|
||||||
|
| Database | WatermelonDB + SQLite |
|
||||||
|
| State | WatermelonDB (reactive queries, no Redux needed) |
|
||||||
|
| Forms | React Hook Form + Zod validation |
|
||||||
|
| UI Components | React Native Paper + Custom SVG icons |
|
||||||
|
| Animations | React Native Reanimated |
|
||||||
|
| Date/Time | @react-native-community/datetimepicker + date-fns |
|
||||||
|
| Build | Gradle (local APK) |
|
||||||
|
| CI/CD | Gitea Actions |
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
```
|
||||||
|
carry-your-live/
|
||||||
|
├ app/
|
||||||
|
│ ├── _layout.tsx # Root layout + DatabaseProvider
|
||||||
|
│ ├── (tabs)/
|
||||||
|
│ │ ├── _layout.tsx # Bottom tab navigator
|
||||||
|
│ │ ├── index.tsx # Tasks screen
|
||||||
|
│ │ ├── calendar.tsx # Calendar screen
|
||||||
|
│ │ └── settings.tsx # Settings screen
|
||||||
|
│ └── add-task.tsx # Add Task screen
|
||||||
|
├ src/
|
||||||
|
│ ├── components/ # Reusable UI components
|
||||||
|
│ ├── database/
|
||||||
|
│ │ ├── schema.ts # WatermelonDB schema
|
||||||
|
│ │ ├── index.ts # Database instance + collections
|
||||||
|
│ │ └── sync.ts # Custom API sync adapter
|
||||||
|
│ ├── models/
|
||||||
|
│ │ ├── Task.ts
|
||||||
|
│ │ ├── Category.ts
|
||||||
|
│ │ └── Subtask.ts
|
||||||
|
│ ├── hooks/
|
||||||
|
│ │ ├── useDatabase.tsx # Database context & providers
|
||||||
|
│ │ └── useTasks.tsx # Task queries with reactive state
|
||||||
|
│ ├── constants/
|
||||||
|
│ │ └── index.ts # Categories, priorities, colors
|
||||||
|
│ └── types/
|
||||||
|
│ └── index.ts # TypeScript interfaces
|
||||||
|
```
|
||||||
|
|
||||||
|
## Data Models
|
||||||
|
- **Task**: id, title, description, categoryId, priority, completed, dueDate, dueTime, createdAt, updatedAt, subtasks
|
||||||
|
- **Category**: id, name, color, order
|
||||||
|
- **Subtask**: id, taskId, title, completed, order, createdAt, updatedAt
|
||||||
|
|
||||||
|
## Default Categories
|
||||||
|
| Name | Color | Order |
|
||||||
|
|------|-------|-------|
|
||||||
|
| Work | #E53935 (Red) | 0 |
|
||||||
|
| Personal | #43A047 (Green) | 1 |
|
||||||
|
| School | #1E88E5 (Blue) | 2 |
|
||||||
|
| Shopping | #FB8C00 (Orange) | 3 |
|
||||||
|
| Health | #8E24AA (Purple) | 4 |
|
||||||
|
| Finance | #FDD835 (Yellow) | 5 |
|
||||||
|
|
||||||
|
## Priority Colors
|
||||||
|
| Priority | Color |
|
||||||
|
|----------|-------|
|
||||||
|
| None | #9E9E9E |
|
||||||
|
| Low | #43A047 |
|
||||||
|
| Medium | #FB8C00 |
|
||||||
|
| High | #E53935 |
|
||||||
|
| Critical | #B71C1C |
|
||||||
|
|
||||||
|
## Sync API
|
||||||
|
Custom API at `http://localhost:3000/api` (configurable in `src/database/sync.ts`):
|
||||||
|
- **Pull**: GET /sync?since={timestamp} - returns categories, tasks, subtasks, timestamp
|
||||||
|
- **Push**: POST /sync/push - body with changes { categories, tasks, subtasks } + lastPulledAt
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
```bash
|
||||||
|
npm install
|
||||||
|
npx expo start
|
||||||
|
# Platform-specific:
|
||||||
|
npx expo start --ios
|
||||||
|
npx expo start --android
|
||||||
|
npx expo start --web
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build Commands
|
||||||
|
- `cd android && ./gradlew assembleDebug` - Debug APK
|
||||||
|
- `cd android && ./gradlew assembleRelease` - Release APK
|
||||||
|
- `npm run desktop` - Electron desktop app
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# Software Engineer Agent
|
||||||
|
|
||||||
|
## Role
|
||||||
|
Code implementation, feature development, and software quality.
|
||||||
|
|
||||||
|
## Responsibilities
|
||||||
|
- Feature implementation
|
||||||
|
- Code reviews
|
||||||
|
- Bug fixing
|
||||||
|
- Refactoring
|
||||||
|
- Unit testing
|
||||||
|
|
||||||
|
## Key Metrics
|
||||||
|
- Code quality score
|
||||||
|
- Test coverage
|
||||||
|
- Pull request throughput
|
||||||
|
- Bug resolution time
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# Tester Agent
|
||||||
|
|
||||||
|
## Role
|
||||||
|
Quality assurance, test automation, and test strategy.
|
||||||
|
|
||||||
|
## Responsibilities
|
||||||
|
- Test case design
|
||||||
|
- Automated test execution
|
||||||
|
- Regression testing
|
||||||
|
- Performance testing
|
||||||
|
- Test coverage analysis
|
||||||
|
|
||||||
|
## Key Metrics
|
||||||
|
- Test pass rate
|
||||||
|
- Defect detection rate
|
||||||
|
- Test execution time
|
||||||
|
- Bug leakage
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# VLA Agent
|
||||||
|
|
||||||
|
## Role
|
||||||
|
Vision-Language-Action models and multimodal understanding.
|
||||||
|
|
||||||
|
## Responsibilities
|
||||||
|
- VLA model development
|
||||||
|
- Multimodal perception
|
||||||
|
- Action prediction
|
||||||
|
- Policy learning
|
||||||
|
- Sim-to-real transfer
|
||||||
|
|
||||||
|
## Key Metrics
|
||||||
|
- Task success rate
|
||||||
|
- Sample efficiency
|
||||||
|
- Generalization ability
|
||||||
|
- Simulation-to-real transfer rate
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
# Carry Your Live — Roadmap & Feature List
|
||||||
|
|
||||||
|
Status as of Aug 2026. Based on code audit of frontend (`carry-your-live/`), backend (`backend/`), and `API_SPEC.md`.
|
||||||
|
|
||||||
|
## Legend
|
||||||
|
- ✅ Implemented
|
||||||
|
- 🟡 Partial / stubbed
|
||||||
|
- ❌ Missing
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Current State (Feature List)
|
||||||
|
|
||||||
|
### Core Task Management
|
||||||
|
- ✅ Tasks CRUD with title, description, category, priority, due date/time, all-day
|
||||||
|
- ✅ Nested subtasks (sub-subtask trees), convert task↔subtask, re-parent, reorder
|
||||||
|
- ✅ Categories/tags with colors (task color derives from category)
|
||||||
|
- ✅ Priorities (None → Critical) with badges
|
||||||
|
- ✅ Repeating/recurring tasks: repeat profiles, series IDs, this/future/all delete scopes, undo-complete
|
||||||
|
- ✅ Overdue / due-today highlighting
|
||||||
|
|
||||||
|
### Screens & Navigation
|
||||||
|
- ✅ Tabs: Todo, Calendar, Stats, Settings (+ Add Task, Day View, Task Detail, Subtask Detail stack screens)
|
||||||
|
- ✅ Category filter chips, swipe actions, long-press multi-select, drag-to-reorder
|
||||||
|
- ✅ Quick-add bar, calendar date strip, analog clock widget
|
||||||
|
- ✅ Stats screen (client-side `useStats`)
|
||||||
|
|
||||||
|
### Sync & Accounts
|
||||||
|
- ✅ Offline-first WatermelonDB (schema v21) + full sync engine (tombstones, LWW)
|
||||||
|
- ✅ Backend: Express + Drizzle + Postgres — auth (register/login/me/forgot/reset), sync pull/push, tasks, subtasks, categories, repeat profiles, user settings, user search
|
||||||
|
- ✅ Login/register/sign-out UI (`SyncModal`)
|
||||||
|
|
||||||
|
### Social
|
||||||
|
- ✅ Friends: request/accept/decline/remove, user search, full backend routes
|
||||||
|
- ✅ Assignee field on tasks/subtasks (schema v7)
|
||||||
|
|
||||||
|
### Settings (wired up)
|
||||||
|
- ✅ Default tag, sort order, show-completed, calendar days-ahead, accent color picker, server URL override
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Gaps (what's broken or stubbed)
|
||||||
|
|
||||||
|
| Item | Status | Where |
|
||||||
|
|---|---|---|
|
||||||
|
| Light mode / theme toggle | ❌ Dark-only, hard-coded palette; backend has `darkMode` column unused | `src/theme.tsx:92` |
|
||||||
|
| Notifications toggle | 🟡 Stored but never read; toggling off doesn't disable reminders | `settings.tsx:148`, `src/services/notifications.ts` |
|
||||||
|
| Global reminder preference | 🟡 Stored but never applied when scheduling | `src/theme.tsx:180` |
|
||||||
|
| Forgot/reset password UI | 🟡 Backend done, no client UI | `backend/src/routes/auth.ts:149` |
|
||||||
|
| Pull-to-refresh | 🟡 Reloads local queries only, doesn't trigger server sync | `TaskList.tsx:129` |
|
||||||
|
| Client settings sync | 🟡 All settings AsyncStorage-only; `PATCH /users/me/settings` never called | — |
|
||||||
|
| Reminder enum mismatch | 🟡 Spec uses minutes (`'15'`,`'30'`…), client uses `'5m'`,`'1h'` style | `API_SPEC.md` vs client |
|
||||||
|
| Webhooks / rate-limit headers | 🟡 In spec, not built | `API_SPEC.md` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Roadmap (by release)
|
||||||
|
|
||||||
|
> Last released: **v1.0.0** (2026-08-05). The `Unreleased` changelog section already contains the friends feature, assignee field, and various fixes.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### v1.1.0 — Friends & Assignees (staged; ship current `Unreleased` + stub fixes)
|
||||||
|
|
||||||
|
Ships what's already merged plus fixes to half-wired features so nothing in the release is a dead toggle.
|
||||||
|
|
||||||
|
- 📦 Release existing `Unreleased` changes: friends feature, assignee field (schema v7), QuickAddBar on overview, sync fixes for repeat/reminders
|
||||||
|
- Fix notifications toggle so it's actually respected (`src/services/notifications.ts`); wire up `rescheduleAllReminders()`
|
||||||
|
- Apply global reminder preference when scheduling task reminders
|
||||||
|
- Make pull-to-refresh run a real server sync cycle (`TaskList.tsx:129`)
|
||||||
|
- Add forgot/reset password UI (backend routes already exist: `backend/src/routes/auth.ts:149`)
|
||||||
|
- Unify reminder offset enums between client, `API_SPEC.md`, and backend
|
||||||
|
|
||||||
|
**Theme:** "Everything you can toggle does something."
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### v1.2.0 — Theming & Findability
|
||||||
|
|
||||||
|
- Light mode + follow-system-theme option; theme-mode setting synced via `/users/me/settings` (backend `darkMode` column already exists)
|
||||||
|
- Sync all client settings to `PATCH /users/me/settings` instead of AsyncStorage-only
|
||||||
|
- Task search: filter-by-text in list + global search screen
|
||||||
|
- Friend-request badges/indicators in main UI (polling-based)
|
||||||
|
- Resolve API error-format drift between spec and auth routes
|
||||||
|
|
||||||
|
**Theme:** "Look good, find anything."
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### v1.3.0 — Stats & Insights
|
||||||
|
|
||||||
|
- Persisted stats snapshots for history/trends over time (current stats are per-local-data only)
|
||||||
|
- Productivity trends: completion rates by category/priority, streaks
|
||||||
|
- Export stats (CSV/image share)
|
||||||
|
|
||||||
|
**Theme:** "Show me how I'm doing."
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### v1.4.0 — Quick Capture & Calendar UX
|
||||||
|
|
||||||
|
Client-side only; no backend changes required.
|
||||||
|
|
||||||
|
- Natural language quick-add ("pay rent tomorrow 5pm !finance" → parsed fields) in QuickAddBar
|
||||||
|
- Snooze/postpone gesture on overdue tasks
|
||||||
|
- Drag-and-drop rescheduling between days in calendar
|
||||||
|
- Month grid view alongside the date strip
|
||||||
|
- "Today at a glance" dashboard combining overdue, today, and stats
|
||||||
|
- Time estimates + daily planned-vs-free-time indicator
|
||||||
|
|
||||||
|
**Theme:** "Capture in seconds."
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### v1.5.0 — Power Tools & Personalization
|
||||||
|
|
||||||
|
- Task templates / saved routines (builds on repeat profiles)
|
||||||
|
- Soft-archive with search (archive instead of delete)
|
||||||
|
- Full local JSON export/import backup
|
||||||
|
- Attachments/links/photos on tasks
|
||||||
|
- Location-based reminders (expo-location)
|
||||||
|
- Markdown support in descriptions
|
||||||
|
- Deep links (`carryyourlive://task/<id>`) for shortcuts and notifications
|
||||||
|
- Undo toast for all destructive actions (extend existing complete-undo)
|
||||||
|
- Biometric lock / privacy blur on app switch
|
||||||
|
- Haptics settings + reduced-motion mode
|
||||||
|
- Custom app icon / theme presets beyond accent color
|
||||||
|
- Onboarding flow + sample data seeding
|
||||||
|
- Android home-screen widget / week agenda widget
|
||||||
|
- import calendar from other apps
|
||||||
|
|
||||||
|
**Theme:** "Make it yours, make it fast."
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### v2.0.0 — Collaboration
|
||||||
|
|
||||||
|
Breaking-ish social features; requires backend schema changes.
|
||||||
|
|
||||||
|
- Real task assignment delivery: shared-list or assignment mechanism (rows are currently strictly user-scoped — assigneeId goes nowhere)
|
||||||
|
- Shared lists / collaborative categories with permissions
|
||||||
|
- Server push notifications (FCM/APNs): cross-device reminders, friend requests, assignments
|
||||||
|
- Comments/activity feed on assigned tasks
|
||||||
|
- Shared category templates ("family shopping list")
|
||||||
|
- Reactions/acknowledgments on assignments
|
||||||
|
|
||||||
|
**Theme:** "Carry it together."
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### v2.1.0 — Platform & Ops
|
||||||
|
|
||||||
|
- Webhooks (`POST /webhooks/sync`) + documented rate limiting per `API_SPEC.md`
|
||||||
|
- Account management: email field, account deletion
|
||||||
|
- Release hardening: OTA update flow validation, EAS builds for iOS/Android
|
||||||
|
|
||||||
|
**Theme:** "Production-grade."
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
"name": "carry-your-live-backend",
|
"name": "carry-your-live-backend",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@types/node-fetch": "^2.6.13",
|
||||||
"bcryptjs": "^3.0.3",
|
"bcryptjs": "^3.0.3",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
@@ -15,6 +16,7 @@
|
|||||||
"express": "^4.21.0",
|
"express": "^4.21.0",
|
||||||
"express-rate-limit": "^8.6.2",
|
"express-rate-limit": "^8.6.2",
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.2",
|
||||||
|
"node-fetch": "^3.3.2",
|
||||||
"pg": "^8.13.0",
|
"pg": "^8.13.0",
|
||||||
"zod": "^3.23.8"
|
"zod": "^3.23.8"
|
||||||
},
|
},
|
||||||
@@ -1015,12 +1017,21 @@
|
|||||||
"version": "22.20.1",
|
"version": "22.20.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.20.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.20.1.tgz",
|
||||||
"integrity": "sha512-EANqOCF9QFyra+4pfxUcX9STKJpCLjMbObVzljIJomAWSnuSIEAvyzEU53GaajbXJEgdh0iEcPL+DGvpUd4k1Q==",
|
"integrity": "sha512-EANqOCF9QFyra+4pfxUcX9STKJpCLjMbObVzljIJomAWSnuSIEAvyzEU53GaajbXJEgdh0iEcPL+DGvpUd4k1Q==",
|
||||||
"devOptional": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~6.21.0"
|
"undici-types": "~6.21.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/node-fetch": {
|
||||||
|
"version": "2.6.13",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.13.tgz",
|
||||||
|
"integrity": "sha512-QGpRVpzSaUs30JBSGPjOg4Uveu384erbHBoT1zeONvyCfwQxIkUshLAOqN/k9EjGviPRmWTTe6aH2qySWKTVSw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/node": "*",
|
||||||
|
"form-data": "^4.0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/pg": {
|
"node_modules/@types/pg": {
|
||||||
"version": "8.20.4",
|
"version": "8.20.4",
|
||||||
"resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.20.4.tgz",
|
"resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.20.4.tgz",
|
||||||
@@ -1099,6 +1110,12 @@
|
|||||||
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
|
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/asynckit": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||||
|
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/bcryptjs": {
|
"node_modules/bcryptjs": {
|
||||||
"version": "3.0.3",
|
"version": "3.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-3.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-3.0.3.tgz",
|
||||||
@@ -1198,6 +1215,18 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/combined-stream": {
|
||||||
|
"version": "1.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||||
|
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"delayed-stream": "~1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/content-disposition": {
|
"node_modules/content-disposition": {
|
||||||
"version": "0.5.4",
|
"version": "0.5.4",
|
||||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
|
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
|
||||||
@@ -1251,6 +1280,15 @@
|
|||||||
"url": "https://opencollective.com/express"
|
"url": "https://opencollective.com/express"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/data-uri-to-buffer": {
|
||||||
|
"version": "4.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz",
|
||||||
|
"integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/debug": {
|
"node_modules/debug": {
|
||||||
"version": "4.4.3",
|
"version": "4.4.3",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
||||||
@@ -1268,6 +1306,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/delayed-stream": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/depd": {
|
"node_modules/depd": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
||||||
@@ -1504,6 +1551,21 @@
|
|||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/es-set-tostringtag": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"get-intrinsic": "^1.2.6",
|
||||||
|
"has-tostringtag": "^1.0.2",
|
||||||
|
"hasown": "^2.0.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/esbuild": {
|
"node_modules/esbuild": {
|
||||||
"version": "0.19.12",
|
"version": "0.19.12",
|
||||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.12.tgz",
|
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.12.tgz",
|
||||||
@@ -1651,6 +1713,29 @@
|
|||||||
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
|
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/fetch-blob": {
|
||||||
|
"version": "3.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz",
|
||||||
|
"integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/jimmywarting"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "paypal",
|
||||||
|
"url": "https://paypal.me/jimmywarting"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"node-domexception": "^1.0.0",
|
||||||
|
"web-streams-polyfill": "^3.0.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^12.20 || >= 14.13"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/finalhandler": {
|
"node_modules/finalhandler": {
|
||||||
"version": "1.3.2",
|
"version": "1.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",
|
||||||
@@ -1684,6 +1769,34 @@
|
|||||||
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
|
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/form-data": {
|
||||||
|
"version": "4.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.6.tgz",
|
||||||
|
"integrity": "sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"asynckit": "^0.4.0",
|
||||||
|
"combined-stream": "^1.0.8",
|
||||||
|
"es-set-tostringtag": "^2.1.0",
|
||||||
|
"hasown": "^2.0.4",
|
||||||
|
"mime-types": "^2.1.35"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/formdata-polyfill": {
|
||||||
|
"version": "4.0.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz",
|
||||||
|
"integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"fetch-blob": "^3.1.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.20.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/forwarded": {
|
"node_modules/forwarded": {
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
||||||
@@ -1800,6 +1913,21 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/has-tostringtag": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"has-symbols": "^1.0.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/hasown": {
|
"node_modules/hasown": {
|
||||||
"version": "2.0.4",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
|
||||||
@@ -2037,6 +2165,44 @@
|
|||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/node-domexception": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
|
||||||
|
"deprecated": "Use your platform's native DOMException instead",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/jimmywarting"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://paypal.me/jimmywarting"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.5.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/node-fetch": {
|
||||||
|
"version": "3.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz",
|
||||||
|
"integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"data-uri-to-buffer": "^4.0.0",
|
||||||
|
"fetch-blob": "^3.1.4",
|
||||||
|
"formdata-polyfill": "^4.0.10"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/node-fetch"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/object-assign": {
|
"node_modules/object-assign": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||||
@@ -2977,7 +3143,6 @@
|
|||||||
"version": "6.21.0",
|
"version": "6.21.0",
|
||||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
|
||||||
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
|
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
|
||||||
"devOptional": true,
|
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/unpipe": {
|
"node_modules/unpipe": {
|
||||||
@@ -3007,6 +3172,15 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/web-streams-polyfill": {
|
||||||
|
"version": "3.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz",
|
||||||
|
"integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/xtend": {
|
"node_modules/xtend": {
|
||||||
"version": "4.0.2",
|
"version": "4.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
"db:studio": "drizzle-kit studio"
|
"db:studio": "drizzle-kit studio"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@types/node-fetch": "^2.6.13",
|
||||||
"bcryptjs": "^3.0.3",
|
"bcryptjs": "^3.0.3",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
@@ -20,6 +21,7 @@
|
|||||||
"express": "^4.21.0",
|
"express": "^4.21.0",
|
||||||
"express-rate-limit": "^8.6.2",
|
"express-rate-limit": "^8.6.2",
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.2",
|
||||||
|
"node-fetch": "^3.3.2",
|
||||||
"pg": "^8.13.0",
|
"pg": "^8.13.0",
|
||||||
"zod": "^3.23.8"
|
"zod": "^3.23.8"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ export const users = pgTable('users', {
|
|||||||
passwordHash: text('password_hash').notNull(),
|
passwordHash: text('password_hash').notNull(),
|
||||||
resetToken: text('reset_token'),
|
resetToken: text('reset_token'),
|
||||||
resetTokenExpiry: bigint('reset_token_expiry', { mode: 'number' }),
|
resetTokenExpiry: bigint('reset_token_expiry', { mode: 'number' }),
|
||||||
|
expoPushToken: text('expo_push_token'),
|
||||||
|
pushTokenUpdatedAt: bigint('push_token_updated_at', { mode: 'number' }),
|
||||||
createdAt: bigint('created_at', { mode: 'number' }).notNull().default(sql`EXTRACT(EPOCH FROM NOW()) * 1000`),
|
createdAt: bigint('created_at', { mode: 'number' }).notNull().default(sql`EXTRACT(EPOCH FROM NOW()) * 1000`),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -86,6 +88,7 @@ export const subtasks = pgTable('subtasks', {
|
|||||||
taskId: text('task_id').notNull().references(() => tasks.id, { onDelete: 'cascade' }),
|
taskId: text('task_id').notNull().references(() => tasks.id, { onDelete: 'cascade' }),
|
||||||
parentSubtaskId: text('parent_subtask_id').references((): AnyPgColumn => subtasks.id, { onDelete: 'cascade' }),
|
parentSubtaskId: text('parent_subtask_id').references((): AnyPgColumn => subtasks.id, { onDelete: 'cascade' }),
|
||||||
categoryId: text('category_id').references(() => categories.id, { onDelete: 'set null' }),
|
categoryId: text('category_id').references(() => categories.id, { onDelete: 'set null' }),
|
||||||
|
tags: text('tags').notNull().default(''),
|
||||||
title: text('title').notNull(),
|
title: text('title').notNull(),
|
||||||
description: text('description').notNull().default(''),
|
description: text('description').notNull().default(''),
|
||||||
priority: text('priority', { enum: ['none', 'low', 'medium', 'high', 'critical'] }).notNull().default('none'),
|
priority: text('priority', { enum: ['none', 'low', 'medium', 'high', 'critical'] }).notNull().default('none'),
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import userRoutes from './routes/users';
|
|||||||
import friendRoutes from './routes/friends';
|
import friendRoutes from './routes/friends';
|
||||||
import repeatProfileRoutes from './routes/repeatProfiles';
|
import repeatProfileRoutes from './routes/repeatProfiles';
|
||||||
import syncRoutes from './routes/sync';
|
import syncRoutes from './routes/sync';
|
||||||
|
import pushNotificationRoutes from './routes/pushNotifications';
|
||||||
import { errorHandler, notFoundHandler } from './middleware/errorHandler';
|
import { errorHandler, notFoundHandler } from './middleware/errorHandler';
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
@@ -34,6 +35,7 @@ app.use('/api/users', userRoutes);
|
|||||||
app.use('/api/repeat-profiles', repeatProfileRoutes);
|
app.use('/api/repeat-profiles', repeatProfileRoutes);
|
||||||
app.use('/api/sync', syncRoutes);
|
app.use('/api/sync', syncRoutes);
|
||||||
app.use('/api/friends', friendRoutes);
|
app.use('/api/friends', friendRoutes);
|
||||||
|
app.use('/api/push', pushNotificationRoutes);
|
||||||
|
|
||||||
// 404 handler
|
// 404 handler
|
||||||
app.use(notFoundHandler);
|
app.use(notFoundHandler);
|
||||||
|
|||||||
@@ -0,0 +1,97 @@
|
|||||||
|
import { Router, Request, Response } from 'express';
|
||||||
|
import { asyncHandler } from '../utils/asyncHandler';
|
||||||
|
import { db } from '../db';
|
||||||
|
import { users } from '../db/schema';
|
||||||
|
import { eq } from 'drizzle-orm';
|
||||||
|
import { AppError } from '../middleware/errorHandler';
|
||||||
|
import { z } from 'zod';
|
||||||
|
import { sendPushNotification, isExpoPushToken, createTaskReminderPayload } from '../services/pushNotifications';
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
const registerPushTokenSchema = z.object({
|
||||||
|
pushToken: z.string().min(1),
|
||||||
|
});
|
||||||
|
|
||||||
|
router.post('/push-token', asyncHandler(async (req: Request, res: Response) => {
|
||||||
|
if (!req.user) {
|
||||||
|
throw new AppError('UNAUTHORIZED', 'Authentication required', 401);
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = registerPushTokenSchema.parse(req.body);
|
||||||
|
|
||||||
|
if (!isExpoPushToken(data.pushToken)) {
|
||||||
|
throw new AppError('INVALID_PUSH_TOKEN', 'Invalid Expo push token format', 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
await db
|
||||||
|
.update(users)
|
||||||
|
.set({
|
||||||
|
expoPushToken: data.pushToken,
|
||||||
|
pushTokenUpdatedAt: Date.now(),
|
||||||
|
})
|
||||||
|
.where(eq(users.id, req.user.userId));
|
||||||
|
|
||||||
|
res.json({ success: true });
|
||||||
|
}));
|
||||||
|
|
||||||
|
router.delete('/push-token', asyncHandler(async (req: Request, res: Response) => {
|
||||||
|
if (!req.user) {
|
||||||
|
throw new AppError('UNAUTHORIZED', 'Authentication required', 401);
|
||||||
|
}
|
||||||
|
|
||||||
|
await db
|
||||||
|
.update(users)
|
||||||
|
.set({
|
||||||
|
expoPushToken: null,
|
||||||
|
pushTokenUpdatedAt: Date.now(),
|
||||||
|
})
|
||||||
|
.where(eq(users.id, req.user.userId));
|
||||||
|
|
||||||
|
res.json({ success: true });
|
||||||
|
}));
|
||||||
|
|
||||||
|
router.post('/test', asyncHandler(async (req: Request, res: Response) => {
|
||||||
|
if (!req.user) {
|
||||||
|
throw new AppError('UNAUTHORIZED', 'Authentication required', 401);
|
||||||
|
}
|
||||||
|
|
||||||
|
const user = await db.select().from(users).where(eq(users.id, req.user.userId)).limit(1);
|
||||||
|
if (user.length === 0 || !user[0].expoPushToken) {
|
||||||
|
throw new AppError('NO_PUSH_TOKEN', 'No push token registered', 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ticket = await sendPushNotification({
|
||||||
|
to: user[0].expoPushToken!,
|
||||||
|
title: 'Test Notification',
|
||||||
|
body: 'Push notifications are working!',
|
||||||
|
data: { type: 'test' },
|
||||||
|
sound: 'default',
|
||||||
|
});
|
||||||
|
|
||||||
|
res.json({ success: true, ticket });
|
||||||
|
}));
|
||||||
|
|
||||||
|
router.post('/send-reminder', asyncHandler(async (req: Request, res: Response) => {
|
||||||
|
if (!req.user) {
|
||||||
|
throw new AppError('UNAUTHORIZED', 'Authentication required', 401);
|
||||||
|
}
|
||||||
|
|
||||||
|
const { taskId, taskTitle, dueTime, repeat } = req.body;
|
||||||
|
if (!taskId || !taskTitle || !dueTime) {
|
||||||
|
throw new AppError('INVALID_PAYLOAD', 'Missing required fields', 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
const user = await db.select().from(users).where(eq(users.id, req.user.userId)).limit(1);
|
||||||
|
if (user.length === 0 || !user[0].expoPushToken) {
|
||||||
|
throw new AppError('NO_PUSH_TOKEN', 'No push token registered', 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ticket = await sendPushNotification(
|
||||||
|
createTaskReminderPayload(user[0].expoPushToken!, taskTitle, dueTime, taskId, repeat)
|
||||||
|
);
|
||||||
|
|
||||||
|
res.json({ success: true, ticket });
|
||||||
|
}));
|
||||||
|
|
||||||
|
export default router;
|
||||||
@@ -83,6 +83,7 @@ router.post('/task/:taskId', asyncHandler(async (req: Request, res: Response) =>
|
|||||||
taskId: req.params.taskId,
|
taskId: req.params.taskId,
|
||||||
parentSubtaskId,
|
parentSubtaskId,
|
||||||
categoryId: data.categoryId ?? null,
|
categoryId: data.categoryId ?? null,
|
||||||
|
tags: data.tags ?? '',
|
||||||
title: data.title,
|
title: data.title,
|
||||||
description: data.description ?? '',
|
description: data.description ?? '',
|
||||||
priority: data.priority ?? 'none',
|
priority: data.priority ?? 'none',
|
||||||
|
|||||||
@@ -17,60 +17,47 @@ router.get('/', asyncHandler(async (req: Request, res: Response) => {
|
|||||||
|
|
||||||
const sinceDate = since;
|
const sinceDate = since;
|
||||||
|
|
||||||
// Fetch categories changed since timestamp
|
// Fetch all changed entities in parallel
|
||||||
const changedCategories = await db
|
const [changedCategories, changedTasks, changedSubtasks, changedRepeatProfiles, changedFriendships, changedTombstones] = await Promise.all([
|
||||||
.select()
|
db
|
||||||
.from(categories)
|
.select()
|
||||||
.where(and(eq(categories.userId, userId), gte(categories.updatedAt, sinceDate)))
|
.from(categories)
|
||||||
.orderBy(asc(categories.updatedAt));
|
.where(and(eq(categories.userId, userId), gte(categories.updatedAt, sinceDate)))
|
||||||
|
.orderBy(asc(categories.updatedAt)),
|
||||||
|
|
||||||
// Fetch tasks changed since timestamp
|
db
|
||||||
const changedTasks = await db
|
.select()
|
||||||
.select()
|
.from(tasks)
|
||||||
.from(tasks)
|
.where(and(eq(tasks.userId, userId), gte(tasks.updatedAt, sinceDate)))
|
||||||
.where(and(eq(tasks.userId, userId), gte(tasks.updatedAt, sinceDate)))
|
.orderBy(asc(tasks.updatedAt)),
|
||||||
.orderBy(asc(tasks.updatedAt));
|
|
||||||
|
|
||||||
// Fetch subtasks changed since timestamp
|
db
|
||||||
let changedSubtasks: any[] = [];
|
|
||||||
if (changedTasks.length > 0) {
|
|
||||||
changedSubtasks = await db
|
|
||||||
.select()
|
.select()
|
||||||
.from(subtasks)
|
.from(subtasks)
|
||||||
.where(and(eq(subtasks.userId, userId), gte(subtasks.updatedAt, sinceDate)))
|
.where(and(eq(subtasks.userId, userId), gte(subtasks.updatedAt, sinceDate)))
|
||||||
.orderBy(asc(subtasks.updatedAt));
|
.orderBy(asc(subtasks.updatedAt)),
|
||||||
} else {
|
|
||||||
// Also fetch subtasks for tasks that might have been deleted
|
db
|
||||||
changedSubtasks = await db
|
|
||||||
.select()
|
.select()
|
||||||
.from(subtasks)
|
.from(repeatProfiles)
|
||||||
.where(and(eq(subtasks.userId, userId), gte(subtasks.updatedAt, sinceDate)))
|
.where(and(eq(repeatProfiles.userId, userId), gte(repeatProfiles.updatedAt, sinceDate)))
|
||||||
.orderBy(asc(subtasks.updatedAt));
|
.orderBy(asc(repeatProfiles.updatedAt)),
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch repeat profiles changed since timestamp
|
db
|
||||||
const changedRepeatProfiles = await db
|
.select()
|
||||||
.select()
|
.from(friendships)
|
||||||
.from(repeatProfiles)
|
.where(and(
|
||||||
.where(and(eq(repeatProfiles.userId, userId), gte(repeatProfiles.updatedAt, sinceDate)))
|
or(eq(friendships.userId, userId), eq(friendships.friendId, userId)),
|
||||||
.orderBy(asc(repeatProfiles.updatedAt));
|
gte(friendships.updatedAt, sinceDate)
|
||||||
|
))
|
||||||
|
.orderBy(asc(friendships.updatedAt)),
|
||||||
|
|
||||||
// Fetch friendships changed since timestamp
|
db
|
||||||
const changedFriendships = await db
|
.select()
|
||||||
.select()
|
.from(tombstones)
|
||||||
.from(friendships)
|
.where(and(eq(tombstones.userId, userId), gte(tombstones.updatedAt, sinceDate)))
|
||||||
.where(and(
|
.orderBy(asc(tombstones.updatedAt)),
|
||||||
or(eq(friendships.userId, userId), eq(friendships.friendId, userId)),
|
]);
|
||||||
gte(friendships.updatedAt, sinceDate)
|
|
||||||
))
|
|
||||||
.orderBy(asc(friendships.updatedAt));
|
|
||||||
|
|
||||||
// Fetch tombstones (deletions) changed since timestamp
|
|
||||||
const changedTombstones = await db
|
|
||||||
.select()
|
|
||||||
.from(tombstones)
|
|
||||||
.where(and(eq(tombstones.userId, userId), gte(tombstones.updatedAt, sinceDate)))
|
|
||||||
.orderBy(asc(tombstones.updatedAt));
|
|
||||||
|
|
||||||
const timestamp = Date.now();
|
const timestamp = Date.now();
|
||||||
|
|
||||||
@@ -292,6 +279,7 @@ router.post('/push', asyncHandler(async (req: Request, res: Response) => {
|
|||||||
taskId: sub.taskId,
|
taskId: sub.taskId,
|
||||||
parentSubtaskId: sub.parentSubtaskId ?? null,
|
parentSubtaskId: sub.parentSubtaskId ?? null,
|
||||||
categoryId: sub.categoryId ?? null,
|
categoryId: sub.categoryId ?? null,
|
||||||
|
tags: sub.tags ?? '',
|
||||||
title: sub.title,
|
title: sub.title,
|
||||||
description: sub.description ?? '',
|
description: sub.description ?? '',
|
||||||
priority: sub.priority ?? 'none',
|
priority: sub.priority ?? 'none',
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ router.post('/', asyncHandler(async (req: Request, res: Response) => {
|
|||||||
taskId,
|
taskId,
|
||||||
title: st.title,
|
title: st.title,
|
||||||
categoryId: (st as any).categoryId ?? null,
|
categoryId: (st as any).categoryId ?? null,
|
||||||
|
tags: (st as any).tags ?? '',
|
||||||
completed: false,
|
completed: false,
|
||||||
order: index,
|
order: index,
|
||||||
createdAt: now,
|
createdAt: now,
|
||||||
|
|||||||
@@ -0,0 +1,153 @@
|
|||||||
|
import fetch from 'node-fetch';
|
||||||
|
|
||||||
|
const EXPO_PUSH_URL = 'https://exp.host/--/api/v2/push/send';
|
||||||
|
|
||||||
|
export interface PushNotificationPayload {
|
||||||
|
to: string;
|
||||||
|
title: string;
|
||||||
|
body: string;
|
||||||
|
data?: Record<string, any>;
|
||||||
|
sound?: string;
|
||||||
|
badge?: number;
|
||||||
|
priority?: 'default' | 'normal' | 'high';
|
||||||
|
channelId?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PushTicket {
|
||||||
|
id: string;
|
||||||
|
status: 'ok' | 'error';
|
||||||
|
message?: string;
|
||||||
|
details?: {
|
||||||
|
error?: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PushReceipt {
|
||||||
|
status: 'ok' | 'error';
|
||||||
|
message?: string;
|
||||||
|
details?: {
|
||||||
|
error?: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ExpoPushResponse {
|
||||||
|
data?: PushTicket[] | Record<string, PushReceipt>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function sendPushNotification(payload: PushNotificationPayload): Promise<PushTicket> {
|
||||||
|
const response = await fetch(EXPO_PUSH_URL, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Accept: 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify(payload),
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = (await response.json()) as ExpoPushResponse;
|
||||||
|
if (result.data && Array.isArray(result.data)) {
|
||||||
|
return result.data[0] ?? { id: '', status: 'error', message: 'No ticket returned' };
|
||||||
|
}
|
||||||
|
return { id: '', status: 'error', message: 'No ticket returned' };
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function sendPushNotifications(payloads: PushNotificationPayload[]): Promise<PushTicket[]> {
|
||||||
|
const chunks: PushNotificationPayload[][] = [];
|
||||||
|
for (let i = 0; i < payloads.length; i += 100) {
|
||||||
|
chunks.push(payloads.slice(i, i + 100));
|
||||||
|
}
|
||||||
|
|
||||||
|
const tickets: PushTicket[] = [];
|
||||||
|
for (const chunk of chunks) {
|
||||||
|
const response = await fetch(EXPO_PUSH_URL, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Accept: 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify(chunk),
|
||||||
|
});
|
||||||
|
const result = (await response.json()) as ExpoPushResponse;
|
||||||
|
if (result.data && Array.isArray(result.data)) {
|
||||||
|
tickets.push(...result.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tickets;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getPushReceipts(ticketIds: string[]): Promise<PushReceipt[]> {
|
||||||
|
if (ticketIds.length === 0) return [];
|
||||||
|
|
||||||
|
const response = await fetch(`${EXPO_PUSH_URL}/receipts`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Accept: 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ ids: ticketIds }),
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = (await response.json()) as ExpoPushResponse;
|
||||||
|
const receipts: PushReceipt[] = [];
|
||||||
|
if (result.data && !Array.isArray(result.data)) {
|
||||||
|
for (const id of ticketIds) {
|
||||||
|
receipts.push(result.data[id] ?? { status: 'error', message: 'No receipt found' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return receipts;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isExpoPushToken(token: string): boolean {
|
||||||
|
return token.startsWith('ExponentPushToken[') || token.startsWith('ExpoPushToken[');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createTaskReminderPayload(
|
||||||
|
pushToken: string,
|
||||||
|
taskTitle: string,
|
||||||
|
dueTime: string,
|
||||||
|
taskId: string,
|
||||||
|
repeat?: string
|
||||||
|
): PushNotificationPayload {
|
||||||
|
return {
|
||||||
|
to: pushToken,
|
||||||
|
title: taskTitle,
|
||||||
|
body: `Due ${dueTime}${repeat && repeat !== 'none' ? ' · repeating' : ''}`,
|
||||||
|
data: { type: 'task_reminder', taskId },
|
||||||
|
sound: 'default',
|
||||||
|
priority: 'high',
|
||||||
|
channelId: 'task-reminders',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createFriendRequestPayload(
|
||||||
|
pushToken: string,
|
||||||
|
fromUsername: string,
|
||||||
|
friendshipId: string
|
||||||
|
): PushNotificationPayload {
|
||||||
|
return {
|
||||||
|
to: pushToken,
|
||||||
|
title: 'New Friend Request',
|
||||||
|
body: `${fromUsername} wants to be your friend`,
|
||||||
|
data: { type: 'friend_request', friendshipId },
|
||||||
|
sound: 'default',
|
||||||
|
priority: 'high',
|
||||||
|
channelId: 'friend-requests',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createTaskAssignmentPayload(
|
||||||
|
pushToken: string,
|
||||||
|
taskTitle: string,
|
||||||
|
fromUsername: string,
|
||||||
|
taskId: string
|
||||||
|
): PushNotificationPayload {
|
||||||
|
return {
|
||||||
|
to: pushToken,
|
||||||
|
title: 'Task Assigned',
|
||||||
|
body: `${fromUsername} assigned you "${taskTitle}"`,
|
||||||
|
data: { type: 'task_assignment', taskId },
|
||||||
|
sound: 'default',
|
||||||
|
priority: 'high',
|
||||||
|
channelId: 'task-assignments',
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -75,6 +75,7 @@ export const subtaskCreateSchema = z.object({
|
|||||||
title: z.string().min(1).max(100),
|
title: z.string().min(1).max(100),
|
||||||
description: z.string().max(1000).optional(),
|
description: z.string().max(1000).optional(),
|
||||||
categoryId: z.string().max(100).nullable().optional().transform((v) => (v === '' ? null : v)),
|
categoryId: z.string().max(100).nullable().optional().transform((v) => (v === '' ? null : v)),
|
||||||
|
tags: z.string().max(500).optional(),
|
||||||
priority: z.enum(['none', 'low', 'medium', 'high', 'critical']).optional(),
|
priority: z.enum(['none', 'low', 'medium', 'high', 'critical']).optional(),
|
||||||
dueDate: z.number().int().min(0).optional(),
|
dueDate: z.number().int().min(0).optional(),
|
||||||
dueTime: z.string().regex(/^([01]\d|2[0-3]):([0-5]\d)$/).optional().or(z.literal('')).transform(v => v ?? ''),
|
dueTime: z.string().regex(/^([01]\d|2[0-3]):([0-5]\d)$/).optional().or(z.literal('')).transform(v => v ?? ''),
|
||||||
@@ -95,6 +96,7 @@ export const subtaskUpdateSchema = z.object({
|
|||||||
title: z.string().min(1).max(100).optional(),
|
title: z.string().min(1).max(100).optional(),
|
||||||
description: z.string().max(1000).optional(),
|
description: z.string().max(1000).optional(),
|
||||||
categoryId: z.string().max(100).nullable().optional().transform((v) => (v === '' ? null : v)),
|
categoryId: z.string().max(100).nullable().optional().transform((v) => (v === '' ? null : v)),
|
||||||
|
tags: z.string().max(500).optional(),
|
||||||
priority: z.enum(['none', 'low', 'medium', 'high', 'critical']).optional(),
|
priority: z.enum(['none', 'low', 'medium', 'high', 'critical']).optional(),
|
||||||
completed: z.boolean().optional(),
|
completed: z.boolean().optional(),
|
||||||
dueDate: z.number().int().min(0).optional(),
|
dueDate: z.number().int().min(0).optional(),
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ node_modules/
|
|||||||
.expo/
|
.expo/
|
||||||
dist/
|
dist/
|
||||||
web-build/
|
web-build/
|
||||||
|
|
||||||
|
# Electron
|
||||||
|
desktop-build/
|
||||||
expo-env.d.ts
|
expo-env.d.ts
|
||||||
|
|
||||||
# Native
|
# Native
|
||||||
@@ -38,4 +41,3 @@ yarn-error.*
|
|||||||
|
|
||||||
# generated native folders
|
# generated native folders
|
||||||
/ios
|
/ios
|
||||||
/android
|
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# OSX
|
||||||
|
#
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Android/IntelliJ
|
||||||
|
#
|
||||||
|
build/
|
||||||
|
.idea
|
||||||
|
.gradle
|
||||||
|
local.properties
|
||||||
|
*.iml
|
||||||
|
*.hprof
|
||||||
|
.cxx/
|
||||||
|
|
||||||
|
# generated inline modules
|
||||||
|
app/src/main/java/inline/
|
||||||
|
|
||||||
|
# Bundle artifacts
|
||||||
|
*.jsbundle
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
apply plugin: "com.android.application"
|
||||||
|
apply plugin: "org.jetbrains.kotlin.android"
|
||||||
|
apply plugin: "com.facebook.react"
|
||||||
|
|
||||||
|
def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the configuration block to customize your React Native Android app.
|
||||||
|
* By default you don't need to apply any configuration, just uncomment the lines you need.
|
||||||
|
*/
|
||||||
|
react {
|
||||||
|
entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android", "absolute"].execute(null, rootDir).text.trim())
|
||||||
|
reactNativeDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
|
||||||
|
hermesCommand = new File(["node", "--print", "require.resolve('hermes-compiler/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/hermesc/%OS-BIN%/hermesc"
|
||||||
|
codegenDir = new File(["node", "--print", "require.resolve('@react-native/codegen/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
|
||||||
|
|
||||||
|
enableBundleCompression = (findProperty('android.enableBundleCompression') ?: false).toBoolean()
|
||||||
|
// Use Expo CLI to bundle the app, this ensures the Metro config
|
||||||
|
// works correctly with Expo projects.
|
||||||
|
cliFile = new File(["node", "--print", "require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })"].execute(null, rootDir).text.trim())
|
||||||
|
bundleCommand = "export:embed"
|
||||||
|
|
||||||
|
/* Folders */
|
||||||
|
// The root of your project, i.e. where "package.json" lives. Default is '../..'
|
||||||
|
// root = file("../../")
|
||||||
|
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
|
||||||
|
// reactNativeDir = file("../../node_modules/react-native")
|
||||||
|
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
|
||||||
|
// codegenDir = file("../../node_modules/@react-native/codegen")
|
||||||
|
|
||||||
|
/* Variants */
|
||||||
|
// The list of variants to that are debuggable. For those we're going to
|
||||||
|
// skip the bundling of the JS bundle and the assets. By default is just 'debug'.
|
||||||
|
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
|
||||||
|
// debuggableVariants = ["liteDebug", "prodDebug"]
|
||||||
|
|
||||||
|
/* Bundling */
|
||||||
|
// A list containing the node command and its flags. Default is just 'node'.
|
||||||
|
// nodeExecutableAndArgs = ["node"]
|
||||||
|
|
||||||
|
//
|
||||||
|
// The path to the CLI configuration file. Default is empty.
|
||||||
|
// bundleConfig = file(../rn-cli.config.js)
|
||||||
|
//
|
||||||
|
// The name of the generated asset file containing your JS bundle
|
||||||
|
// bundleAssetName = "MyApplication.android.bundle"
|
||||||
|
//
|
||||||
|
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
|
||||||
|
// entryFile = file("../js/MyApplication.android.js")
|
||||||
|
//
|
||||||
|
// A list of extra flags to pass to the 'bundle' commands.
|
||||||
|
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
|
||||||
|
// extraPackagerArgs = []
|
||||||
|
|
||||||
|
/* Hermes Commands */
|
||||||
|
// The hermes compiler command to run. By default it is 'hermesc'
|
||||||
|
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
|
||||||
|
//
|
||||||
|
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
|
||||||
|
// hermesFlags = ["-O", "-output-source-map"]
|
||||||
|
|
||||||
|
/* Autolinking */
|
||||||
|
autolinkLibrariesWithApp()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set this to true in release builds to optimize the app using [R8](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization).
|
||||||
|
*/
|
||||||
|
def enableMinifyInReleaseBuilds = (findProperty('android.enableMinifyInReleaseBuilds') ?: false).toBoolean()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The preferred build flavor of JavaScriptCore (JSC)
|
||||||
|
*
|
||||||
|
* For example, to use the international variant, you can use:
|
||||||
|
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
|
||||||
|
*
|
||||||
|
* The international variant includes ICU i18n library and necessary data
|
||||||
|
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
|
||||||
|
* give correct results when using with locales other than en-US. Note that
|
||||||
|
* this variant is about 6MiB larger per architecture than default.
|
||||||
|
*/
|
||||||
|
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
|
||||||
|
|
||||||
|
android {
|
||||||
|
ndkVersion = rootProject.ext.ndkVersion
|
||||||
|
|
||||||
|
buildToolsVersion = rootProject.ext.buildToolsVersion
|
||||||
|
compileSdk = rootProject.ext.compileSdkVersion
|
||||||
|
|
||||||
|
namespace = 'com.anonymous.carryyourlive'
|
||||||
|
defaultConfig {
|
||||||
|
applicationId = 'com.anonymous.carryyourlive'
|
||||||
|
minSdkVersion = rootProject.ext.minSdkVersion
|
||||||
|
targetSdkVersion = rootProject.ext.targetSdkVersion
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0.0"
|
||||||
|
|
||||||
|
buildConfigField "String", "REACT_NATIVE_RELEASE_LEVEL", "\"${findProperty('reactNativeReleaseLevel') ?: 'stable'}\""
|
||||||
|
}
|
||||||
|
signingConfigs {
|
||||||
|
debug {
|
||||||
|
storeFile file('debug.keystore')
|
||||||
|
storePassword 'android'
|
||||||
|
keyAlias 'androiddebugkey'
|
||||||
|
keyPassword 'android'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
debug {
|
||||||
|
signingConfig = signingConfigs.debug
|
||||||
|
}
|
||||||
|
release {
|
||||||
|
// Caution! In production, you need to generate your own keystore file.
|
||||||
|
// see https://reactnative.dev/docs/signed-apk-android.
|
||||||
|
signingConfig = signingConfigs.debug
|
||||||
|
def enableShrinkResources = findProperty('android.enableShrinkResourcesInReleaseBuilds') ?: 'false'
|
||||||
|
shrinkResources = enableShrinkResources.toBoolean()
|
||||||
|
minifyEnabled enableMinifyInReleaseBuilds
|
||||||
|
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
||||||
|
def enablePngCrunchInRelease = findProperty('android.enablePngCrunchInReleaseBuilds') ?: 'true'
|
||||||
|
crunchPngs = enablePngCrunchInRelease.toBoolean()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
packagingOptions {
|
||||||
|
jniLibs {
|
||||||
|
def enableLegacyPackaging = findProperty('expo.useLegacyPackaging') ?: 'false'
|
||||||
|
useLegacyPackaging = enableLegacyPackaging.toBoolean()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
androidResources {
|
||||||
|
ignoreAssetsPattern = '!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply static values from `gradle.properties` to the `android.packagingOptions`
|
||||||
|
// Accepts values in comma delimited lists, example:
|
||||||
|
// android.packagingOptions.pickFirsts=/LICENSE,**/picasa.ini
|
||||||
|
["pickFirsts", "excludes", "merges", "doNotStrip"].each { prop ->
|
||||||
|
// Split option: 'foo,bar' -> ['foo', 'bar']
|
||||||
|
def options = (findProperty("android.packagingOptions.$prop") ?: "").split(",");
|
||||||
|
// Trim all elements in place.
|
||||||
|
for (i in 0..<options.size()) options[i] = options[i].trim();
|
||||||
|
// `[] - ""` is essentially `[""].filter(Boolean)` removing all empty strings.
|
||||||
|
options -= ""
|
||||||
|
|
||||||
|
if (options.length > 0) {
|
||||||
|
println "android.packagingOptions.$prop += $options ($options.length)"
|
||||||
|
// Ex: android.packagingOptions.pickFirsts += '**/SCCS/**'
|
||||||
|
options.each {
|
||||||
|
android.packagingOptions[prop] += it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// The version of react-native is set by the React Native Gradle Plugin
|
||||||
|
implementation("com.facebook.react:react-android")
|
||||||
|
|
||||||
|
def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
|
||||||
|
def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
|
||||||
|
def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true";
|
||||||
|
|
||||||
|
if (isGifEnabled) {
|
||||||
|
// For animated gif support
|
||||||
|
implementation("com.facebook.fresco:animated-gif:${expoLibs.versions.fresco.get()}")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isWebpEnabled) {
|
||||||
|
// For webp support
|
||||||
|
implementation("com.facebook.fresco:webpsupport:${expoLibs.versions.fresco.get()}")
|
||||||
|
if (isWebpAnimatedEnabled) {
|
||||||
|
// Animated webp support
|
||||||
|
implementation("com.facebook.fresco:animated-webp:${expoLibs.versions.fresco.get()}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hermesEnabled.toBoolean()) {
|
||||||
|
implementation("com.facebook.react:hermes-android")
|
||||||
|
} else {
|
||||||
|
implementation jscFlavor
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# By default, the flags in this file are appended to flags specified
|
||||||
|
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
|
||||||
|
# You can edit the include path and order by changing the proguardFiles
|
||||||
|
# directive in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# react-native-reanimated
|
||||||
|
-keep class com.swmansion.reanimated.** { *; }
|
||||||
|
-keep class com.facebook.react.turbomodule.** { *; }
|
||||||
|
|
||||||
|
# Add any project specific keep options here:
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||||
|
|
||||||
|
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" tools:replace="android:usesCleartextTraffic" />
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||||
|
|
||||||
|
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" tools:replace="android:usesCleartextTraffic" />
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" tools:replace="android:maxSdkVersion"/>
|
||||||
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="32" tools:replace="android:maxSdkVersion"/>
|
||||||
|
<queries>
|
||||||
|
<intent>
|
||||||
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
|
<category android:name="android.intent.category.BROWSABLE"/>
|
||||||
|
<data android:scheme="https"/>
|
||||||
|
</intent>
|
||||||
|
</queries>
|
||||||
|
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:supportsRtl="true" android:enableOnBackInvokedCallback="false" android:usesCleartextTraffic="true">
|
||||||
|
<meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/notification_icon_color"/>
|
||||||
|
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon"/>
|
||||||
|
<meta-data android:name="expo.modules.notifications.default_notification_color" android:resource="@color/notification_icon_color"/>
|
||||||
|
<meta-data android:name="expo.modules.notifications.default_notification_icon" android:resource="@drawable/notification_icon"/>
|
||||||
|
<meta-data android:name="expo.modules.updates.ENABLED" android:value="false"/>
|
||||||
|
<meta-data android:name="expo.modules.updates.ENABLE_BSDIFF_PATCH_SUPPORT" android:value="true"/>
|
||||||
|
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
|
||||||
|
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
|
||||||
|
<activity android:name=".MainActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|uiMode|smallestScreenSize|assetsPaths" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:exported="true" android:screenOrientation="portrait">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
<category android:name="android.intent.category.BROWSABLE"/>
|
||||||
|
<data android:scheme="exp+carry-your-live"/>
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.anonymous.carryyourlive
|
||||||
|
|
||||||
|
import android.os.Build
|
||||||
|
import android.os.Bundle
|
||||||
|
|
||||||
|
import com.facebook.react.ReactActivity
|
||||||
|
import com.facebook.react.ReactActivityDelegate
|
||||||
|
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
|
||||||
|
import com.facebook.react.defaults.DefaultReactActivityDelegate
|
||||||
|
|
||||||
|
import expo.modules.ReactActivityDelegateWrapper
|
||||||
|
|
||||||
|
class MainActivity : ReactActivity() {
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
// Set the theme to AppTheme BEFORE onCreate to support
|
||||||
|
// coloring the background, status bar, and navigation bar.
|
||||||
|
// This is required for expo-splash-screen.
|
||||||
|
setTheme(R.style.AppTheme);
|
||||||
|
super.onCreate(null)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the main component registered from JavaScript. This is used to schedule
|
||||||
|
* rendering of the component.
|
||||||
|
*/
|
||||||
|
override fun getMainComponentName(): String = "main"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
|
||||||
|
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
|
||||||
|
*/
|
||||||
|
override fun createReactActivityDelegate(): ReactActivityDelegate {
|
||||||
|
return ReactActivityDelegateWrapper(
|
||||||
|
this,
|
||||||
|
BuildConfig.IS_NEW_ARCHITECTURE_ENABLED,
|
||||||
|
object : DefaultReactActivityDelegate(
|
||||||
|
this,
|
||||||
|
mainComponentName,
|
||||||
|
fabricEnabled
|
||||||
|
){})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Align the back button behavior with Android S
|
||||||
|
* where moving root activities to background instead of finishing activities.
|
||||||
|
* @see <a href="https://developer.android.com/reference/android/app/Activity#onBackPressed()">onBackPressed</a>
|
||||||
|
*/
|
||||||
|
override fun invokeDefaultOnBackPressed() {
|
||||||
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
|
||||||
|
if (!moveTaskToBack(false)) {
|
||||||
|
// For non-root activities, use the default implementation to finish them.
|
||||||
|
super.invokeDefaultOnBackPressed()
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use the default back button implementation on Android S
|
||||||
|
// because it's doing more than [Activity.moveTaskToBack] in fact.
|
||||||
|
super.invokeDefaultOnBackPressed()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.anonymous.carryyourlive
|
||||||
|
|
||||||
|
import android.app.Application
|
||||||
|
import android.content.res.Configuration
|
||||||
|
|
||||||
|
import com.facebook.react.PackageList
|
||||||
|
import com.facebook.react.ReactApplication
|
||||||
|
import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
|
||||||
|
import com.facebook.react.ReactPackage
|
||||||
|
import com.facebook.react.ReactHost
|
||||||
|
import com.facebook.react.common.ReleaseLevel
|
||||||
|
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint
|
||||||
|
|
||||||
|
import expo.modules.ApplicationLifecycleDispatcher
|
||||||
|
import expo.modules.ExpoReactHostFactory
|
||||||
|
|
||||||
|
class MainApplication : Application(), ReactApplication {
|
||||||
|
|
||||||
|
override val reactHost: ReactHost by lazy {
|
||||||
|
ExpoReactHostFactory.getDefaultReactHost(
|
||||||
|
context = applicationContext,
|
||||||
|
packageList =
|
||||||
|
PackageList(this).packages.apply {
|
||||||
|
// Packages that cannot be autolinked yet can be added manually here, for example:
|
||||||
|
// add(MyReactNativePackage())
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreate() {
|
||||||
|
super.onCreate()
|
||||||
|
DefaultNewArchitectureEntryPoint.releaseLevel = try {
|
||||||
|
ReleaseLevel.valueOf(BuildConfig.REACT_NATIVE_RELEASE_LEVEL.uppercase())
|
||||||
|
} catch (e: IllegalArgumentException) {
|
||||||
|
ReleaseLevel.STABLE
|
||||||
|
}
|
||||||
|
loadReactNative(this)
|
||||||
|
ApplicationLifecycleDispatcher.onApplicationCreate(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||||
|
super.onConfigurationChanged(newConfig)
|
||||||
|
ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 1010 B |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 584 B |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 65 KiB |
@@ -0,0 +1,6 @@
|
|||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:drawable="@color/splashscreen_background"/>
|
||||||
|
<item>
|
||||||
|
<bitmap android:gravity="center" android:src="@drawable/splashscreen_logo"/>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2014 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<inset xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
|
||||||
|
android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
|
||||||
|
android:insetTop="@dimen/abc_edit_text_inset_top_material"
|
||||||
|
android:insetBottom="@dimen/abc_edit_text_inset_bottom_material"
|
||||||
|
>
|
||||||
|
|
||||||
|
<selector>
|
||||||
|
<!--
|
||||||
|
This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
|
||||||
|
The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
|
||||||
|
NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
|
||||||
|
|
||||||
|
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
|
||||||
|
|
||||||
|
For more info, see https://bit.ly/3CdLStv (react-native/pull/29452) and https://bit.ly/3nxOMoR.
|
||||||
|
-->
|
||||||
|
<item android:state_enabled="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
|
||||||
|
<item android:drawable="@drawable/abc_textfield_activated_mtrl_alpha"/>
|
||||||
|
</selector>
|
||||||
|
|
||||||
|
</inset>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@mipmap/ic_launcher_background"/>
|
||||||
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
|
<monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
|
||||||
|
</adaptive-icon>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@mipmap/ic_launcher_background"/>
|
||||||
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
|
<monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
|
||||||
|
</adaptive-icon>
|
||||||
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 31 KiB |
@@ -0,0 +1,3 @@
|
|||||||
|
<resources>
|
||||||
|
<color name="appBackground">#121212</color>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<resources>
|
||||||
|
<color name="splashscreen_background">#FFFFFF</color>
|
||||||
|
<color name="iconBackground">#E6F4FE</color>
|
||||||
|
<color name="colorPrimary">#023c69</color>
|
||||||
|
<color name="notification_icon_color">#1E88E5</color>
|
||||||
|
<color name="appBackground">#121212</color>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<resources>
|
||||||
|
<string name="app_name">carry-your-live</string>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
|
||||||
|
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
|
||||||
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||||
|
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||||
|
<item name="android:windowBackground">@color/appBackground</item>
|
||||||
|
</style>
|
||||||
|
<style name="Theme.App.SplashScreen" parent="AppTheme">
|
||||||
|
<item name="android:windowBackground">@drawable/splashscreen_logo</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath('com.android.tools.build:gradle')
|
||||||
|
classpath('com.facebook.react:react-native-gradle-plugin')
|
||||||
|
classpath('org.jetbrains.kotlin:kotlin-gradle-plugin')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
maven { url = 'https://www.jitpack.io' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: "expo-root-project"
|
||||||
|
apply plugin: "com.facebook.react.rootproject"
|
||||||
|
|
||||||
|
subprojects {
|
||||||
|
plugins.withId("com.android.library") {
|
||||||
|
extensions.configure(com.android.build.api.dsl.LibraryExtension) {
|
||||||
|
ndkVersion = rootProject.ext.ndkVersion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
plugins.withId("com.android.application") {
|
||||||
|
extensions.configure(com.android.build.api.dsl.ApplicationExtension) {
|
||||||
|
ndkVersion = rootProject.ext.ndkVersion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
# Project-wide Gradle settings.
|
||||||
|
|
||||||
|
# IDE (e.g. Android Studio) users:
|
||||||
|
# Gradle settings configured through the IDE *will override*
|
||||||
|
# any settings specified in this file.
|
||||||
|
|
||||||
|
# For more details on how to configure your build environment visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
|
|
||||||
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
|
# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
|
||||||
|
org.gradle.jvmargs=-Xmx1536m -XX:MaxMetaspaceSize=384m --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED
|
||||||
|
org.gradle.workers.max=2
|
||||||
|
|
||||||
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
|
org.gradle.parallel=true
|
||||||
|
|
||||||
|
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||||
|
# Android operating system, and which packages are packaged with your app's APK
|
||||||
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||||
|
android.useAndroidX=true
|
||||||
|
|
||||||
|
# Enable AAPT2 PNG crunching
|
||||||
|
android.enablePngCrunchInReleaseBuilds=true
|
||||||
|
|
||||||
|
# Use this property to specify which architecture you want to build.
|
||||||
|
# You can also override it from the CLI using
|
||||||
|
# ./gradlew <task> -PreactNativeArchitectures=x86_64
|
||||||
|
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
|
||||||
|
|
||||||
|
# Use this property to enable support to the new architecture.
|
||||||
|
# This will allow you to use TurboModules and the Fabric render in
|
||||||
|
# your application. You should enable this flag either if you want
|
||||||
|
# to write custom TurboModules/Fabric components OR use libraries that
|
||||||
|
# are providing them. React Native 0.82+ always runs with the New
|
||||||
|
# Architecture, so this flag is no longer honored and was removed.
|
||||||
|
|
||||||
|
# Use this property to enable or disable the Hermes JS engine.
|
||||||
|
# If set to false, you will be using JSC instead.
|
||||||
|
hermesEnabled=true
|
||||||
|
|
||||||
|
# Enable edge-to-edge display support.
|
||||||
|
# This allows your app to draw behind system bars for an immersive UI.
|
||||||
|
# Note: Only works with ReactActivity and should not be used with custom Activity.
|
||||||
|
edgeToEdgeEnabled=true
|
||||||
|
|
||||||
|
# Enable GIF support in React Native images (~200 B increase)
|
||||||
|
expo.gif.enabled=true
|
||||||
|
# Enable webp support in React Native images (~85 KB increase)
|
||||||
|
expo.webp.enabled=true
|
||||||
|
# Enable animated webp support (~3.4 MB increase)
|
||||||
|
# Disabled by default because iOS doesn't support animated webp
|
||||||
|
expo.webp.animated=false
|
||||||
|
|
||||||
|
# Enable network inspector
|
||||||
|
EX_DEV_CLIENT_NETWORK_INSPECTOR=true
|
||||||
|
|
||||||
|
# Use legacy packaging to compress native libraries in the resulting APK.
|
||||||
|
expo.useLegacyPackaging=false
|
||||||
|
|
||||||
|
expo.inlineModules.watchedDirectories=[]
|
||||||
|
# Enabled parallel sync for Gradle 9.4+
|
||||||
|
org.gradle.tooling.parallel=true
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#This file is generated by updateDaemonJvm
|
||||||
|
toolchainVersion=17
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
@@ -0,0 +1,248 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD=java
|
||||||
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%"=="" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
|
echo. 1>&2
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
|
echo. 1>&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo. 1>&2
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
|
echo. 1>&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
pluginManagement {
|
||||||
|
def reactNativeGradlePlugin = new File(
|
||||||
|
providers.exec {
|
||||||
|
workingDir(rootDir)
|
||||||
|
commandLine("node", "--print", "require.resolve('@react-native/gradle-plugin/package.json', { paths: [require.resolve('react-native/package.json')] })")
|
||||||
|
}.standardOutput.asText.get().trim()
|
||||||
|
).getParentFile().absolutePath
|
||||||
|
includeBuild(reactNativeGradlePlugin)
|
||||||
|
|
||||||
|
def expoPluginsPath = new File(
|
||||||
|
providers.exec {
|
||||||
|
workingDir(rootDir)
|
||||||
|
commandLine("node", "--print", "require.resolve('expo-modules-autolinking/package.json', { paths: [require.resolve('expo/package.json')] })")
|
||||||
|
}.standardOutput.asText.get().trim(),
|
||||||
|
"../android/expo-gradle-plugin"
|
||||||
|
).absolutePath
|
||||||
|
includeBuild(expoPluginsPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("com.facebook.react.settings")
|
||||||
|
id("expo-autolinking-settings")
|
||||||
|
}
|
||||||
|
|
||||||
|
extensions.configure(com.facebook.react.ReactSettingsExtension) { ex ->
|
||||||
|
if (System.getenv('EXPO_USE_COMMUNITY_AUTOLINKING') == '1') {
|
||||||
|
ex.autolinkLibrariesFromCommand()
|
||||||
|
} else {
|
||||||
|
ex.autolinkLibrariesFromCommand(expoAutolinking.rnConfigCommand)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expoAutolinking.useExpoModules()
|
||||||
|
|
||||||
|
rootProject.name = 'carry-your-live'
|
||||||
|
|
||||||
|
expoAutolinking.useExpoVersionCatalog()
|
||||||
|
|
||||||
|
include ':app'
|
||||||
|
includeBuild(expoAutolinking.reactNativeGradlePlugin)
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Tabs } from 'expo-router';
|
import { Tabs } from 'expo-router';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||||
|
import { View, StyleSheet, TouchableOpacity } from 'react-native';
|
||||||
import { TabBarIcon } from '@/components/TabBarIcon';
|
import { TabBarIcon } from '@/components/TabBarIcon';
|
||||||
import { useSettings } from '@/theme';
|
import { useSettings } from '@/theme';
|
||||||
import { setLastVisitedTab } from '@/utils/tabHistory';
|
import { setLastVisitedTab } from '@/utils/tabHistory';
|
||||||
@@ -13,19 +14,19 @@ export default function TabLayout() {
|
|||||||
<Tabs
|
<Tabs
|
||||||
screenOptions={{
|
screenOptions={{
|
||||||
tabBarActiveTintColor: theme.accent,
|
tabBarActiveTintColor: theme.accent,
|
||||||
tabBarInactiveTintColor: theme.text,
|
tabBarInactiveTintColor: theme.textSecondary,
|
||||||
tabBarStyle: {
|
tabBarStyle: {
|
||||||
backgroundColor: theme.tabBarBg,
|
backgroundColor: theme.tabBarBg,
|
||||||
borderTopWidth: 1,
|
borderTopWidth: 0,
|
||||||
borderTopColor: theme.border,
|
height: 84 + insets.bottom,
|
||||||
height: 68 + insets.bottom,
|
|
||||||
paddingBottom: insets.bottom,
|
paddingBottom: insets.bottom,
|
||||||
paddingTop: 6,
|
paddingTop: 12,
|
||||||
elevation: 8,
|
paddingHorizontal: 16,
|
||||||
|
elevation: 0,
|
||||||
shadowColor: '#000',
|
shadowColor: '#000',
|
||||||
shadowOffset: { width: 0, height: -2 },
|
shadowOffset: { width: 0, height: -4 },
|
||||||
shadowOpacity: 0.08,
|
shadowOpacity: 0.12,
|
||||||
shadowRadius: 8,
|
shadowRadius: 20,
|
||||||
},
|
},
|
||||||
tabBarItemStyle: {
|
tabBarItemStyle: {
|
||||||
paddingVertical: 0,
|
paddingVertical: 0,
|
||||||
@@ -33,10 +34,54 @@ export default function TabLayout() {
|
|||||||
tabBarLabelStyle: {
|
tabBarLabelStyle: {
|
||||||
fontSize: 11,
|
fontSize: 11,
|
||||||
fontWeight: '700',
|
fontWeight: '700',
|
||||||
|
marginTop: 4,
|
||||||
},
|
},
|
||||||
headerShown: false,
|
headerShown: false,
|
||||||
sceneStyle: { backgroundColor: theme.background },
|
sceneStyle: { backgroundColor: theme.background },
|
||||||
}}
|
}}
|
||||||
|
tabBar={(props) => {
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
styles.tabBarContainer,
|
||||||
|
{
|
||||||
|
backgroundColor: theme.tabBarBg,
|
||||||
|
paddingBottom: Math.max(props.insets.bottom, 8),
|
||||||
|
shadowColor: '#000',
|
||||||
|
shadowOffset: { width: 0, height: -4 },
|
||||||
|
shadowOpacity: 0.12,
|
||||||
|
shadowRadius: 20,
|
||||||
|
elevation: 8,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
{props.navigation.getState().routes.map((route) => {
|
||||||
|
const focused = props.navigation.getState().index === props.navigation.getState().routes.indexOf(route);
|
||||||
|
return (
|
||||||
|
<TouchableOpacity
|
||||||
|
key={route.name}
|
||||||
|
style={[
|
||||||
|
styles.tabItem,
|
||||||
|
focused && styles.tabItemActive,
|
||||||
|
{ backgroundColor: focused ? theme.accentSoft : 'transparent' },
|
||||||
|
]}
|
||||||
|
onPress={() => props.navigation.navigate(route.name as never)}
|
||||||
|
accessibilityRole="button"
|
||||||
|
accessibilityLabel={route.name === 'index' ? 'ToDo' : route.name.charAt(0).toUpperCase() + route.name.slice(1)}
|
||||||
|
accessibilityState={{ selected: focused }}
|
||||||
|
>
|
||||||
|
<TabBarIcon
|
||||||
|
name={route.name === 'index' ? 'checklist' : route.name === 'calendar' ? 'calendar' : route.name === 'stats' ? 'stats' : 'gear'}
|
||||||
|
focused={focused}
|
||||||
|
color={focused ? theme.accent : theme.textSecondary}
|
||||||
|
size={24}
|
||||||
|
/>
|
||||||
|
</TouchableOpacity>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}}
|
||||||
screenListeners={({ route }) => ({
|
screenListeners={({ route }) => ({
|
||||||
focus: () => {
|
focus: () => {
|
||||||
if (route.name !== 'settings') {
|
if (route.name !== 'settings') {
|
||||||
@@ -45,42 +90,35 @@ export default function TabLayout() {
|
|||||||
},
|
},
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<Tabs.Screen
|
<Tabs.Screen name="index" />
|
||||||
name="index"
|
<Tabs.Screen name="calendar" />
|
||||||
options={{
|
<Tabs.Screen name="stats" />
|
||||||
title: 'ToDo',
|
<Tabs.Screen name="settings" />
|
||||||
tabBarIcon: ({ color, focused }) => (
|
|
||||||
<TabBarIcon name="checklist" focused={focused} color={color} size={26} />
|
|
||||||
),
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<Tabs.Screen
|
|
||||||
name="calendar"
|
|
||||||
options={{
|
|
||||||
title: 'Calendar',
|
|
||||||
tabBarIcon: ({ color, focused }) => (
|
|
||||||
<TabBarIcon name="calendar" focused={focused} color={color} size={26} />
|
|
||||||
),
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<Tabs.Screen
|
|
||||||
name="stats"
|
|
||||||
options={{
|
|
||||||
title: 'Stats',
|
|
||||||
tabBarIcon: ({ color, focused }) => (
|
|
||||||
<TabBarIcon name="stats" focused={focused} color={color} size={26} />
|
|
||||||
),
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<Tabs.Screen
|
|
||||||
name="settings"
|
|
||||||
options={{
|
|
||||||
title: 'Settings',
|
|
||||||
tabBarIcon: ({ color, focused }) => (
|
|
||||||
<TabBarIcon name="gear" focused={focused} color={color} size={26} />
|
|
||||||
),
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Tabs>
|
</Tabs>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
tabBarContainer: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'space-around',
|
||||||
|
paddingTop: 10,
|
||||||
|
paddingHorizontal: 16,
|
||||||
|
},
|
||||||
|
tabItem: {
|
||||||
|
flex: 1,
|
||||||
|
alignItems: 'center',
|
||||||
|
paddingVertical: 8,
|
||||||
|
paddingHorizontal: 8,
|
||||||
|
borderRadius: 16,
|
||||||
|
minWidth: 70,
|
||||||
|
},
|
||||||
|
tabItemActive: {
|
||||||
|
shadowColor: '#000',
|
||||||
|
shadowOffset: { width: 0, height: 2 },
|
||||||
|
shadowOpacity: 0.1,
|
||||||
|
shadowRadius: 8,
|
||||||
|
elevation: 4,
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useMemo, useRef, useState, useCallback } from 'react';
|
import React, { useMemo, useRef, useState, useCallback, useEffect } from 'react';
|
||||||
import { View, Text, StyleSheet, SafeAreaView, ScrollView, TouchableOpacity, Animated, Dimensions, BackHandler, KeyboardAvoidingView } from 'react-native';
|
import { View, Text, StyleSheet, SafeAreaView, ScrollView, TouchableOpacity, Animated, Dimensions, KeyboardAvoidingView } from 'react-native';
|
||||||
import { useRouter, useFocusEffect } from 'expo-router';
|
import { useRouter, useFocusEffect } from 'expo-router';
|
||||||
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
||||||
import { Header } from '@/components/Header';
|
import { Header } from '@/components/Header';
|
||||||
@@ -8,17 +8,21 @@ import { useSubtasks } from '@/hooks/useSubtasks';
|
|||||||
import { useTaskModals } from '@/hooks/useTaskModals';
|
import { useTaskModals } from '@/hooks/useTaskModals';
|
||||||
import { useSettings } from '@/theme';
|
import { useSettings } from '@/theme';
|
||||||
import { useCategories } from '@/hooks/useDatabase';
|
import { useCategories } from '@/hooks/useDatabase';
|
||||||
import { toggleTaskComplete } from '@/utils/taskActions';
|
import { useICalImport } from '@/hooks/useICalImport';
|
||||||
|
import { confirmAndToggleTaskComplete, toggleSubtaskComplete } from '@/utils/taskActions';
|
||||||
import { QuickAddBar } from '@/components/QuickAddBar';
|
import { QuickAddBar } from '@/components/QuickAddBar';
|
||||||
import { OptionPickerModal } from '@/components/OptionPickerModal';
|
import { OptionPickerModal } from '@/components/OptionPickerModal';
|
||||||
|
import { TaskItem } from '@/components/TaskItem';
|
||||||
|
import { SubtaskItem } from '@/components/SubtaskItem';
|
||||||
import Task from '@/models/Task';
|
import Task from '@/models/Task';
|
||||||
import { format, addMonths, addDays, startOfMonth, isSameDay, isSameMonth, isToday } from 'date-fns';
|
import { format, addMonths, addDays, startOfMonth, isSameDay, isSameMonth, isToday } from 'date-fns';
|
||||||
import Svg, { Path, Circle } from 'react-native-svg';
|
import Svg, { Path } from 'react-native-svg';
|
||||||
import { desaturate } from '@/theme';
|
|
||||||
import type { ThemeColors } from '@/theme';
|
import type { ThemeColors } from '@/theme';
|
||||||
|
import type { TaskData, SubtaskData } from '@/types';
|
||||||
|
|
||||||
const WIDTH = Dimensions.get('window').width;
|
const WIDTH = Dimensions.get('window').width;
|
||||||
const GERMAN_WEEKDAYS = ['mo', 'di', 'mi', 'do', 'fr', 'sa', 'so'];
|
const GERMAN_WEEKDAYS = ['mo', 'di', 'mi', 'do', 'fr', 'sa', 'so'];
|
||||||
|
const PRIORITY_RANK: Record<string, number> = { none: 0, low: 1, medium: 2, high: 3, critical: 4 };
|
||||||
const MONTH_NAMES = [
|
const MONTH_NAMES = [
|
||||||
'January', 'February', 'March', 'April', 'May', 'June',
|
'January', 'February', 'March', 'April', 'May', 'June',
|
||||||
'July', 'August', 'September', 'October', 'November', 'December',
|
'July', 'August', 'September', 'October', 'November', 'December',
|
||||||
@@ -26,8 +30,16 @@ const MONTH_NAMES = [
|
|||||||
|
|
||||||
export default function CalendarScreen() {
|
export default function CalendarScreen() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { theme } = useSettings();
|
const { theme, sortBy } = useSettings();
|
||||||
|
const styles = React.useMemo(() => createStyles(theme), [theme]);
|
||||||
const categories = useCategories();
|
const categories = useCategories();
|
||||||
|
const categoryColors = useMemo(() => {
|
||||||
|
const map = new Map<string, string>();
|
||||||
|
for (const c of categories) {
|
||||||
|
map.set(c.id, c.color);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}, [categories]);
|
||||||
const { modals, openTaskEdit } = useTaskModals();
|
const { modals, openTaskEdit } = useTaskModals();
|
||||||
|
|
||||||
const [visibleMonth, setVisibleMonth] = useState(() => new Date());
|
const [visibleMonth, setVisibleMonth] = useState(() => new Date());
|
||||||
@@ -37,28 +49,50 @@ export default function CalendarScreen() {
|
|||||||
const { map: subtasksByTask, refresh: refreshSubtasks } = useSubtasks();
|
const { map: subtasksByTask, refresh: refreshSubtasks } = useSubtasks();
|
||||||
|
|
||||||
const visibleMonthRef = useRef(visibleMonth);
|
const visibleMonthRef = useRef(visibleMonth);
|
||||||
visibleMonthRef.current = visibleMonth;
|
|
||||||
const selectedDateRef = useRef(selectedDate);
|
const selectedDateRef = useRef(selectedDate);
|
||||||
selectedDateRef.current = selectedDate;
|
const translateX = useRef<Animated.Value>(new Animated.Value(0));
|
||||||
|
const animatingRef = useRef(false);
|
||||||
|
const gridWidthRef = useRef<number>(WIDTH);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
visibleMonthRef.current = visibleMonth;
|
||||||
|
}, [visibleMonth]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
selectedDateRef.current = selectedDate;
|
||||||
|
}, [selectedDate]);
|
||||||
|
|
||||||
const { tasks: selectedDayTasks, refresh: refreshDayTasks } = useTasksByDate(selectedDate);
|
const { tasks: selectedDayTasks, refresh: refreshDayTasks } = useTasksByDate(selectedDate);
|
||||||
const monthTasks = useTasksInMonth(visibleMonth);
|
const monthTasks = useTasksInMonth(visibleMonth);
|
||||||
const refreshMonthTasks = monthTasks.refresh;
|
const refreshMonthTasks = monthTasks.refresh;
|
||||||
|
|
||||||
|
const sortedDayTasks = useMemo(() => {
|
||||||
|
const sorted = [...selectedDayTasks];
|
||||||
|
switch (sortBy) {
|
||||||
|
case 'date':
|
||||||
|
sorted.sort((a, b) => (a.dueDate || Number.MAX_SAFE_INTEGER) - (b.dueDate || Number.MAX_SAFE_INTEGER));
|
||||||
|
break;
|
||||||
|
case 'priority':
|
||||||
|
sorted.sort((a, b) => PRIORITY_RANK[b.priority] - PRIORITY_RANK[a.priority]);
|
||||||
|
break;
|
||||||
|
case 'alpha':
|
||||||
|
sorted.sort((a, b) => a.title.localeCompare(b.title));
|
||||||
|
break;
|
||||||
|
case 'created':
|
||||||
|
sorted.sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return sorted;
|
||||||
|
}, [selectedDayTasks, sortBy]);
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
const sub = BackHandler.addEventListener('hardwareBackPress', () => true);
|
|
||||||
refreshDayTasks();
|
refreshDayTasks();
|
||||||
refreshMonthTasks();
|
refreshMonthTasks();
|
||||||
refreshSubtasks();
|
refreshSubtasks();
|
||||||
return () => sub.remove();
|
|
||||||
}, [refreshDayTasks, refreshMonthTasks, refreshSubtasks])
|
}, [refreshDayTasks, refreshMonthTasks, refreshSubtasks])
|
||||||
);
|
);
|
||||||
|
|
||||||
const translateX = useRef(new Animated.Value(0)).current;
|
|
||||||
const animatingRef = useRef(false);
|
|
||||||
const gridWidthRef = useRef<number>(WIDTH);
|
|
||||||
|
|
||||||
const weeks = useMemo(() => {
|
const weeks = useMemo(() => {
|
||||||
const first = startOfMonth(visibleMonth);
|
const first = startOfMonth(visibleMonth);
|
||||||
const offset = (first.getDay() + 6) % 7; // week starts Monday
|
const offset = (first.getDay() + 6) % 7; // week starts Monday
|
||||||
@@ -78,16 +112,16 @@ export default function CalendarScreen() {
|
|||||||
}
|
}
|
||||||
if (!animate) {
|
if (!animate) {
|
||||||
setVisibleMonth(next);
|
setVisibleMonth(next);
|
||||||
translateX.setValue(0);
|
translateX.current.setValue(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
animatingRef.current = true;
|
animatingRef.current = true;
|
||||||
const w = gridWidthRef.current || WIDTH;
|
const w = gridWidthRef.current || WIDTH;
|
||||||
const target = dir === 1 ? -w : w;
|
const target = dir === 1 ? -w : w;
|
||||||
Animated.timing(translateX, { toValue: target, duration: 220, useNativeDriver: false }).start(() => {
|
Animated.timing(translateX.current, { toValue: target, duration: 220, useNativeDriver: false }).start(() => {
|
||||||
setVisibleMonth(next);
|
setVisibleMonth(next);
|
||||||
translateX.setValue(-target);
|
translateX.current.setValue(-target);
|
||||||
Animated.timing(translateX, { toValue: 0, duration: 180, useNativeDriver: false }).start(() => {
|
Animated.timing(translateX.current, { toValue: 0, duration: 180, useNativeDriver: false }).start(() => {
|
||||||
animatingRef.current = false;
|
animatingRef.current = false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -113,21 +147,23 @@ export default function CalendarScreen() {
|
|||||||
.activeOffsetX([-16, 16])
|
.activeOffsetX([-16, 16])
|
||||||
.minDistance(6)
|
.minDistance(6)
|
||||||
.runOnJS(true)
|
.runOnJS(true)
|
||||||
|
// eslint-disable-next-line react-hooks/refs
|
||||||
.onUpdate((e) => {
|
.onUpdate((e) => {
|
||||||
if (!animatingRef.current) translateX.setValue(e.translationX);
|
if (!animatingRef.current) translateX.current.setValue(e.translationX);
|
||||||
})
|
})
|
||||||
|
// eslint-disable-next-line react-hooks/refs
|
||||||
.onEnd((e) => {
|
.onEnd((e) => {
|
||||||
if (animatingRef.current) return;
|
if (animatingRef.current) return;
|
||||||
const w = gridWidthRef.current || WIDTH;
|
const w = gridWidthRef.current || WIDTH;
|
||||||
const dx = e.translationX;
|
const dx = e.translationX;
|
||||||
if (dx <= -w / 4) {
|
if (dx <= -w / 4) {
|
||||||
translateX.stopAnimation();
|
translateX.current.stopAnimation();
|
||||||
transitionTo(1, false);
|
transitionTo(1, false);
|
||||||
} else if (dx >= w / 4) {
|
} else if (dx >= w / 4) {
|
||||||
translateX.stopAnimation();
|
translateX.current.stopAnimation();
|
||||||
transitionTo(-1, false);
|
transitionTo(-1, false);
|
||||||
} else {
|
} else {
|
||||||
Animated.spring(translateX, { toValue: 0, useNativeDriver: false }).start();
|
Animated.spring(translateX.current, { toValue: 0, useNativeDriver: false }).start();
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
[translateX, transitionTo]
|
[translateX, transitionTo]
|
||||||
@@ -152,7 +188,29 @@ export default function CalendarScreen() {
|
|||||||
}, [currentYear]);
|
}, [currentYear]);
|
||||||
|
|
||||||
const handleToggleComplete = useCallback(async (taskId: string) => {
|
const handleToggleComplete = useCallback(async (taskId: string) => {
|
||||||
await toggleTaskComplete(taskId);
|
await confirmAndToggleTaskComplete(taskId, () => {
|
||||||
|
refreshDayTasks();
|
||||||
|
refreshMonthTasks();
|
||||||
|
refreshSubtasks();
|
||||||
|
});
|
||||||
|
}, [refreshDayTasks, refreshMonthTasks, refreshSubtasks]);
|
||||||
|
|
||||||
|
const [expandedTasks, setExpandedTasks] = useState<Set<string>>(new Set());
|
||||||
|
|
||||||
|
const toggleExpand = useCallback((taskId: string) => {
|
||||||
|
setExpandedTasks((prev) => {
|
||||||
|
const next = new Set(prev);
|
||||||
|
if (next.has(taskId)) {
|
||||||
|
next.delete(taskId);
|
||||||
|
} else {
|
||||||
|
next.add(taskId);
|
||||||
|
}
|
||||||
|
return next;
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleSubtaskToggle = useCallback(async (subtaskId: string) => {
|
||||||
|
await toggleSubtaskComplete(subtaskId);
|
||||||
refreshDayTasks();
|
refreshDayTasks();
|
||||||
refreshMonthTasks();
|
refreshMonthTasks();
|
||||||
refreshSubtasks();
|
refreshSubtasks();
|
||||||
@@ -160,7 +218,22 @@ export default function CalendarScreen() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView style={[styles.container, { backgroundColor: theme.background }]}>
|
<SafeAreaView style={[styles.container, { backgroundColor: theme.background }]}>
|
||||||
<Header title="Calendar" showLogo={false} />
|
<Header
|
||||||
|
title="Calendar"
|
||||||
|
showLogo={false}
|
||||||
|
rightAction={
|
||||||
|
<TouchableOpacity
|
||||||
|
onPress={() => router.back()}
|
||||||
|
style={styles.backButton}
|
||||||
|
accessible={true}
|
||||||
|
accessibilityLabel="Back"
|
||||||
|
>
|
||||||
|
<Svg width={20} height={20} viewBox="0 0 24 24">
|
||||||
|
<Path d="M15 18l-6-6 6-6" stroke="currentColor" strokeWidth={2.5} strokeLinecap="round" strokeLinejoin="round" fill="none" />
|
||||||
|
</Svg>
|
||||||
|
</TouchableOpacity>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
<KeyboardAvoidingView style={styles.kbAvoid} behavior="padding">
|
<KeyboardAvoidingView style={styles.kbAvoid} behavior="padding">
|
||||||
<ScrollView style={styles.scrollBody} showsVerticalScrollIndicator={false} contentContainerStyle={styles.scrollContent}>
|
<ScrollView style={styles.scrollBody} showsVerticalScrollIndicator={false} contentContainerStyle={styles.scrollContent}>
|
||||||
@@ -169,7 +242,8 @@ export default function CalendarScreen() {
|
|||||||
onLayout={(e) => {
|
onLayout={(e) => {
|
||||||
gridWidthRef.current = e.nativeEvent.layout.width;
|
gridWidthRef.current = e.nativeEvent.layout.width;
|
||||||
}}
|
}}
|
||||||
style={[styles.calendarArea, { transform: [{ translateX }] }]}
|
// eslint-disable-next-line react-hooks/refs
|
||||||
|
style={[styles.calendarArea, { transform: [{ translateX: translateX.current }] }]}
|
||||||
>
|
>
|
||||||
<View style={styles.monthRow}>
|
<View style={styles.monthRow}>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
@@ -221,7 +295,7 @@ export default function CalendarScreen() {
|
|||||||
key={day.toISOString()}
|
key={day.toISOString()}
|
||||||
day={day}
|
day={day}
|
||||||
label={cellTitle(byDayOf(monthTasks.byDay, day))}
|
label={cellTitle(byDayOf(monthTasks.byDay, day))}
|
||||||
dotColor={cellColor(byDayOf(monthTasks.byDay, day), categories)}
|
dotColor={cellColor(byDayOf(monthTasks.byDay, day), categories, theme)}
|
||||||
selected={isSameDay(day, selectedDate)}
|
selected={isSameDay(day, selectedDate)}
|
||||||
today={isToday(day)}
|
today={isToday(day)}
|
||||||
inMonth={isSameMonth(day, visibleMonth)}
|
inMonth={isSameMonth(day, visibleMonth)}
|
||||||
@@ -236,78 +310,41 @@ export default function CalendarScreen() {
|
|||||||
|
|
||||||
<View style={styles.panelHeader}>
|
<View style={styles.panelHeader}>
|
||||||
<Text style={[styles.panelDate, { color: theme.text }]}>{format(selectedDate, 'EEEE, MMMM d')}</Text>
|
<Text style={[styles.panelDate, { color: theme.text }]}>{format(selectedDate, 'EEEE, MMMM d')}</Text>
|
||||||
{selectedDayTasks.length > 0 && (
|
{sortedDayTasks.length > 0 && (
|
||||||
<Text style={[styles.panelCount, { color: theme.textFaint }]}>
|
<Text style={[styles.panelCount, { color: theme.textFaint }]}>
|
||||||
{selectedDayTasks.length} event{selectedDayTasks.length === 1 ? '' : 's'}
|
{sortedDayTasks.length} event{sortedDayTasks.length === 1 ? '' : 's'}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{selectedDayTasks.length === 0 ? (
|
{sortedDayTasks.length === 0 ? (
|
||||||
<View style={styles.emptyState}>
|
<View style={styles.emptyState}>
|
||||||
<Text style={[styles.emptyText, { color: theme.textSecondary }]}>No events on this day</Text>
|
<Text style={[styles.emptyText, { color: theme.textSecondary }]}>No events on this day</Text>
|
||||||
<Text style={[styles.emptySubtext, { color: theme.textMuted }]}>Tap a date or use the bar below</Text>
|
<Text style={[styles.emptySubtext, { color: theme.textMuted }]}>Tap a date or use the bar below</Text>
|
||||||
</View>
|
</View>
|
||||||
) : (
|
) : (
|
||||||
selectedDayTasks.map((task) => (
|
sortedDayTasks.map((task) => {
|
||||||
<View key={task.id} style={[styles.eventCard, { backgroundColor: theme.card, borderColor: theme.border }]}>
|
const isExpanded = expandedTasks.has(task.id);
|
||||||
<View style={styles.eventRow}>
|
const itemSubtasks = subtasksByTask.get(task.id) ?? [];
|
||||||
<TouchableOpacity
|
return (
|
||||||
style={styles.checkCircle}
|
<View key={task.id} style={styles.eventCard}>
|
||||||
onPress={() => handleToggleComplete(task.id)}
|
<CalendarTaskRow
|
||||||
activeOpacity={0.7}
|
task={task}
|
||||||
>
|
expanded={isExpanded}
|
||||||
<Svg width={30} height={30} viewBox="0 0 24 24">
|
subtasks={itemSubtasks}
|
||||||
{task.completed ? (
|
categoryColor={categoryColors.get(task.categoryId)}
|
||||||
<>
|
onToggle={() => handleToggleComplete(task.id)}
|
||||||
<Circle cx={12} cy={12} r={10} fill={theme.accent} />
|
onPress={(id) =>
|
||||||
<Path d="M7 12l3 3 7-7" stroke="#FFFFFF" strokeWidth={2.5} strokeLinecap="round" strokeLinejoin="round" fill="none" />
|
expandedTasks.has(id)
|
||||||
</>
|
? router.push({ pathname: '/task-detail', params: { id } })
|
||||||
) : (
|
: toggleExpand(id)
|
||||||
<Circle cx={12} cy={12} r={10} stroke={theme.textSecondary} strokeWidth={2.5} fill="none" />
|
}
|
||||||
)}
|
onMenuOpen={(id) => openTaskEdit(id)}
|
||||||
</Svg>
|
onSubtaskToggle={handleSubtaskToggle}
|
||||||
</TouchableOpacity>
|
/>
|
||||||
|
|
||||||
<TouchableOpacity
|
|
||||||
style={styles.eventTitleTouch}
|
|
||||||
onPress={() => router.push({ pathname: '/task-detail', params: { id: task.id } })}
|
|
||||||
activeOpacity={0.7}
|
|
||||||
>
|
|
||||||
<Text
|
|
||||||
style={[styles.eventTitle, { color: theme.text }, task.completed && styles.eventCompleted]}
|
|
||||||
numberOfLines={1}
|
|
||||||
>
|
|
||||||
{task.title}
|
|
||||||
</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
|
|
||||||
<TouchableOpacity style={styles.menuButton} onPress={() => openTaskEdit(task.id)} activeOpacity={0.7} accessibilityRole="button" accessibilityLabel={`Edit ${task.title}`}>
|
|
||||||
<Svg width={20} height={20} viewBox="0 0 24 24">
|
|
||||||
<Path d="M9 6l6 6-6 6" stroke={theme.textSecondary} strokeWidth={2.5} strokeLinecap="round" strokeLinejoin="round" fill="none" />
|
|
||||||
</Svg>
|
|
||||||
</TouchableOpacity>
|
|
||||||
</View>
|
</View>
|
||||||
|
);
|
||||||
{(subtasksByTask.get(task.id) ?? []).length > 0 && (
|
})
|
||||||
<View style={styles.bullets}>
|
|
||||||
{(subtasksByTask.get(task.id) ?? []).map((sub) => (
|
|
||||||
<View key={sub.id} style={styles.bulletRow}>
|
|
||||||
<Svg width={5} height={5} viewBox="0 0 6 6" style={styles.bulletDot as any}>
|
|
||||||
<Circle cx={3} cy={3} r={3} fill={theme.textMuted} />
|
|
||||||
</Svg>
|
|
||||||
<Text
|
|
||||||
style={[styles.bulletText, { color: theme.textFaint }, sub.completed && styles.bulletCompleted]}
|
|
||||||
numberOfLines={1}
|
|
||||||
>
|
|
||||||
{sub.title}
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
))}
|
|
||||||
</View>
|
|
||||||
)}
|
|
||||||
</View>
|
|
||||||
))
|
|
||||||
)}
|
)}
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
@@ -343,16 +380,69 @@ function byDayOf(byDay: Record<number, Task[]>, day: Date): Task[] {
|
|||||||
return byDay[day.getDate()] ?? [];
|
return byDay[day.getDate()] ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface CalendarTaskRowProps {
|
||||||
|
task: Task;
|
||||||
|
expanded: boolean;
|
||||||
|
subtasks: SubtaskData[];
|
||||||
|
categoryColor?: string;
|
||||||
|
onToggle: (taskId: string) => void | Promise<void>;
|
||||||
|
onPress: (taskId: string) => void;
|
||||||
|
onMenuOpen: (taskId: string) => void;
|
||||||
|
onSubtaskToggle: (subtaskId: string) => void | Promise<void>;
|
||||||
|
}
|
||||||
|
|
||||||
|
const CalendarTaskRow = React.memo(function CalendarTaskRow({
|
||||||
|
task,
|
||||||
|
expanded,
|
||||||
|
subtasks,
|
||||||
|
categoryColor,
|
||||||
|
onToggle,
|
||||||
|
onPress,
|
||||||
|
onMenuOpen,
|
||||||
|
onSubtaskToggle,
|
||||||
|
}: CalendarTaskRowProps) {
|
||||||
|
const { theme } = useSettings();
|
||||||
|
const styles = React.useMemo(() => createStyles(theme), [theme]);
|
||||||
|
const sortedSubtasks = useMemo(
|
||||||
|
() => subtasks.slice().sort((a, b) => a.order - b.order),
|
||||||
|
[subtasks]
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
<View>
|
||||||
|
<TaskItem
|
||||||
|
task={task as unknown as TaskData}
|
||||||
|
onToggle={() => onToggle(task.id)}
|
||||||
|
onPress={() => onPress(task.id)}
|
||||||
|
onMenuOpen={() => onMenuOpen(task.id)}
|
||||||
|
expanded={expanded}
|
||||||
|
categoryColor={categoryColor}
|
||||||
|
/>
|
||||||
|
{expanded && sortedSubtasks.length > 0 && (
|
||||||
|
<View style={styles.subtaskList}>
|
||||||
|
{sortedSubtasks.map((sub) => (
|
||||||
|
<SubtaskItem
|
||||||
|
key={sub.id}
|
||||||
|
subtask={sub}
|
||||||
|
depth={1}
|
||||||
|
categoryColor={categoryColor}
|
||||||
|
onToggle={() => onSubtaskToggle(sub.id)}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
function cellTitle(tasks: Task[]): string | null {
|
function cellTitle(tasks: Task[]): string | null {
|
||||||
if (tasks.length === 0) return null;
|
if (tasks.length === 0) return null;
|
||||||
if (tasks.length === 1) return tasks[0].title;
|
if (tasks.length === 1) return tasks[0].title;
|
||||||
return `${tasks[0].title} +${tasks.length - 1}`;
|
return `${tasks[0].title} +${tasks.length - 1}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function cellColor(tasks: Task[], categories: { id: string; color: string }[]): string {
|
function cellColor(tasks: Task[], categories: { id: string; color: string }[], theme: ThemeColors): string {
|
||||||
if (tasks.length === 0) return '#8E8E8E';
|
if (tasks.length === 0) return theme.textMuted;
|
||||||
const cat = categories.find((c) => c.id === tasks[0].categoryId);
|
return theme.accent;
|
||||||
return cat ? desaturate(cat.color, 0.3) : '#8E8E8E';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DayCellProps {
|
interface DayCellProps {
|
||||||
@@ -367,6 +457,7 @@ interface DayCellProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const DayCell = React.memo(function DayCell({ day, label, dotColor, selected, today, inMonth, theme, onPress }: DayCellProps) {
|
const DayCell = React.memo(function DayCell({ day, label, dotColor, selected, today, inMonth, theme, onPress }: DayCellProps) {
|
||||||
|
const styles = React.useMemo(() => createStyles(theme), [theme]);
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
style={[styles.dayCell, selected && { backgroundColor: theme.accentSoft, borderColor: theme.accentBorder }]}
|
style={[styles.dayCell, selected && { backgroundColor: theme.accentSoft, borderColor: theme.accentBorder }]}
|
||||||
@@ -397,7 +488,7 @@ const DayCell = React.memo(function DayCell({ day, label, dotColor, selected, to
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const createStyles = (theme: ThemeColors) => StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
},
|
},
|
||||||
@@ -485,7 +576,7 @@ const styles = StyleSheet.create({
|
|||||||
fontWeight: '600',
|
fontWeight: '600',
|
||||||
},
|
},
|
||||||
dayNumberSelected: {
|
dayNumberSelected: {
|
||||||
color: '#FFFFFF',
|
color: theme.text,
|
||||||
},
|
},
|
||||||
chip: {
|
chip: {
|
||||||
marginTop: 3,
|
marginTop: 3,
|
||||||
@@ -533,58 +624,16 @@ const styles = StyleSheet.create({
|
|||||||
emptySubtext: {
|
emptySubtext: {
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
},
|
},
|
||||||
|
backButton: {
|
||||||
|
padding: 8,
|
||||||
|
},
|
||||||
eventCard: {
|
eventCard: {
|
||||||
marginHorizontal: 16,
|
marginHorizontal: 16,
|
||||||
marginTop: 6,
|
marginTop: 6,
|
||||||
borderRadius: 16,
|
|
||||||
borderWidth: 1,
|
|
||||||
paddingHorizontal: 14,
|
|
||||||
paddingVertical: 12,
|
|
||||||
},
|
},
|
||||||
eventRow: {
|
subtaskList: {
|
||||||
flexDirection: 'row',
|
paddingLeft: 8,
|
||||||
alignItems: 'center',
|
paddingRight: 4,
|
||||||
},
|
paddingTop: 4,
|
||||||
checkCircle: {
|
|
||||||
width: 30,
|
|
||||||
marginRight: 12,
|
|
||||||
},
|
|
||||||
eventTitleTouch: {
|
|
||||||
flex: 1,
|
|
||||||
},
|
|
||||||
eventTitle: {
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: '500',
|
|
||||||
},
|
|
||||||
eventCompleted: {
|
|
||||||
textDecorationLine: 'line-through',
|
|
||||||
color: '#9E9E9E',
|
|
||||||
},
|
|
||||||
menuButton: {
|
|
||||||
padding: 4,
|
|
||||||
marginLeft: 6,
|
|
||||||
},
|
|
||||||
bullets: {
|
|
||||||
marginTop: 8,
|
|
||||||
paddingTop: 8,
|
|
||||||
borderTopWidth: 1,
|
|
||||||
borderTopColor: 'rgba(255,255,255,0.06)',
|
|
||||||
gap: 6,
|
|
||||||
},
|
|
||||||
bulletRow: {
|
|
||||||
flexDirection: 'row',
|
|
||||||
alignItems: 'center',
|
|
||||||
gap: 8,
|
|
||||||
},
|
|
||||||
bulletDot: {
|
|
||||||
marginLeft: 8,
|
|
||||||
},
|
|
||||||
bulletText: {
|
|
||||||
flex: 1,
|
|
||||||
fontSize: 13,
|
|
||||||
},
|
|
||||||
bulletCompleted: {
|
|
||||||
textDecorationLine: 'line-through',
|
|
||||||
color: '#6E6E6E',
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useCallback, useMemo, useState } from 'react';
|
import React, { useCallback, useMemo, useState } from 'react';
|
||||||
import { View, Text, StyleSheet, SafeAreaView, BackHandler, KeyboardAvoidingView, TouchableOpacity } from 'react-native';
|
import { View, Text, StyleSheet, SafeAreaView, KeyboardAvoidingView, TouchableOpacity, BackHandler } from 'react-native';
|
||||||
import { useFocusEffect } from 'expo-router';
|
import { useFocusEffect } from 'expo-router';
|
||||||
import { Header } from '@/components/Header';
|
import { Header } from '@/components/Header';
|
||||||
import { CategoryFilter } from '@/components/CategoryFilter';
|
import { CategoryFilter } from '@/components/CategoryFilter';
|
||||||
@@ -18,7 +18,7 @@ export default function TasksScreen() {
|
|||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
const sub = BackHandler.addEventListener('hardwareBackPress', () => true);
|
const sub = BackHandler.addEventListener('hardwareBackPress', () => false);
|
||||||
return () => sub.remove();
|
return () => sub.remove();
|
||||||
}, [])
|
}, [])
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import { useCategories } from '@/hooks/useDatabase';
|
|||||||
import { getAuthUser, getAuthToken } from '@/services/auth';
|
import { getAuthUser, getAuthToken } from '@/services/auth';
|
||||||
import { checkForUpdates, getCurrentAppVersion } from '@/services/updates';
|
import { checkForUpdates, getCurrentAppVersion } from '@/services/updates';
|
||||||
import { getLastSyncTime } from '@/database/sync';
|
import { getLastSyncTime } from '@/database/sync';
|
||||||
|
import { rescheduleAllReminders } from '@/services/notifications';
|
||||||
|
import { collections } from '@/database';
|
||||||
import Category from '@/models/Category';
|
import Category from '@/models/Category';
|
||||||
import Svg, { Path } from 'react-native-svg';
|
import Svg, { Path } from 'react-native-svg';
|
||||||
import ColorWheel from '@/components/ColorWheel';
|
import ColorWheel from '@/components/ColorWheel';
|
||||||
@@ -22,9 +24,10 @@ import { getLastVisitedTab, tabHref } from '@/utils/tabHistory';
|
|||||||
|
|
||||||
export default function SettingsScreen() {
|
export default function SettingsScreen() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { theme, notifications, setNotifications, defaultCategoryId, setDefaultCategoryId, sortBy, setSortBy, reminderPreference, setReminderPreference, apiUrl, accentColor, setAccentColor, todoAheadDays, setTodoAheadDays, showCompleted, setShowCompleted } = useSettings();
|
const { theme, notifications, setNotifications, defaultCategoryId, setDefaultCategoryId, sortBy, setSortBy, reminderPreference, setReminderPreference, tagReminderPreferences, setTagReminderPreferences, apiUrl, accentColor, setAccentColor, accentOpacity, setAccentOpacity, todoAheadDays, setTodoAheadDays, showCompleted, setShowCompleted, deleteBySwipe, setDeleteBySwipe } = useSettings();
|
||||||
const categories = useCategories();
|
const categories = useCategories();
|
||||||
const [picker, setPicker] = useState<null | 'category' | 'sort' | 'reminder' | 'todoAhead'>(null);
|
const [picker, setPicker] = useState<null | 'category' | 'sort' | 'reminder' | 'todoAhead'>(null);
|
||||||
|
const [reminderTagPicker, setReminderTagPicker] = useState<Category | null>(null);
|
||||||
const [editingCategory, setEditingCategory] = useState<Category | null | 'new'>(null);
|
const [editingCategory, setEditingCategory] = useState<Category | null | 'new'>(null);
|
||||||
const [syncVisible, setSyncVisible] = useState(false);
|
const [syncVisible, setSyncVisible] = useState(false);
|
||||||
const [friendsVisible, setFriendsVisible] = useState(false);
|
const [friendsVisible, setFriendsVisible] = useState(false);
|
||||||
@@ -32,6 +35,7 @@ export default function SettingsScreen() {
|
|||||||
const [serverUrlVisible, setServerUrlVisible] = useState(false);
|
const [serverUrlVisible, setServerUrlVisible] = useState(false);
|
||||||
const [customAccentVisible, setCustomAccentVisible] = useState(false);
|
const [customAccentVisible, setCustomAccentVisible] = useState(false);
|
||||||
const [draftAccent, setDraftAccent] = useState(accentColor);
|
const [draftAccent, setDraftAccent] = useState(accentColor);
|
||||||
|
const [draftAccentOpacity, setDraftAccentOpacity] = useState(accentOpacity);
|
||||||
const [syncSubtitle, setSyncSubtitle] = useState('Checking...');
|
const [syncSubtitle, setSyncSubtitle] = useState('Checking...');
|
||||||
const [updateSubtitle, setUpdateSubtitle] = useState('Tap to check');
|
const [updateSubtitle, setUpdateSubtitle] = useState('Tap to check');
|
||||||
|
|
||||||
@@ -95,6 +99,14 @@ export default function SettingsScreen() {
|
|||||||
const defaultCategoryLabel = defaultCategory?.name ?? 'None';
|
const defaultCategoryLabel = defaultCategory?.name ?? 'None';
|
||||||
const reminderLabel = REMINDER_OPTIONS.find((o) => o.value === reminderPreference)?.label ?? 'No reminder';
|
const reminderLabel = REMINDER_OPTIONS.find((o) => o.value === reminderPreference)?.label ?? 'No reminder';
|
||||||
|
|
||||||
|
const tagReminderLabel = (categoryId: string) => {
|
||||||
|
const selected = tagReminderPreferences[categoryId] ?? [];
|
||||||
|
if (selected.length === 0) return `Default (${reminderLabel})`;
|
||||||
|
return selected
|
||||||
|
.map((v) => REMINDER_OPTIONS.find((o) => o.value === v)?.label ?? v)
|
||||||
|
.join(', ');
|
||||||
|
};
|
||||||
|
|
||||||
const openCustomAccent = () => {
|
const openCustomAccent = () => {
|
||||||
setDraftAccent(accentColor);
|
setDraftAccent(accentColor);
|
||||||
setCustomAccentVisible(true);
|
setCustomAccentVisible(true);
|
||||||
@@ -108,6 +120,20 @@ export default function SettingsScreen() {
|
|||||||
setReminderPreference((Array.isArray(value) ? value[0] : value) as typeof reminderPreference);
|
setReminderPreference((Array.isArray(value) ? value[0] : value) as typeof reminderPreference);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleTagReminderPreference = async (categoryId: string, value: string | string[]) => {
|
||||||
|
const selected = (Array.isArray(value) ? value : [value]).filter(
|
||||||
|
(v): v is typeof reminderPreference => v !== 'none'
|
||||||
|
);
|
||||||
|
setTagReminderPreferences({ ...tagReminderPreferences, [categoryId]: selected });
|
||||||
|
if (!notifications) return;
|
||||||
|
try {
|
||||||
|
const tasks = await collections.tasks.query().fetch();
|
||||||
|
await rescheduleAllReminders(tasks, notifications, reminderPreference);
|
||||||
|
} catch {
|
||||||
|
// ignore reschedule failures
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handleTodoAheadDays = (value: string | string[]) => {
|
const handleTodoAheadDays = (value: string | string[]) => {
|
||||||
setTodoAheadDays(parseInt(Array.isArray(value) ? value[0] : value, 10));
|
setTodoAheadDays(parseInt(Array.isArray(value) ? value[0] : value, 10));
|
||||||
};
|
};
|
||||||
@@ -119,12 +145,12 @@ export default function SettingsScreen() {
|
|||||||
<SafeAreaView style={[styles.container, { backgroundColor: theme.background }]}>
|
<SafeAreaView style={[styles.container, { backgroundColor: theme.background }]}>
|
||||||
<Header title="Settings" showLogo={false} />
|
<Header title="Settings" showLogo={false} />
|
||||||
<ScrollView contentContainerStyle={styles.content} showsVerticalScrollIndicator={false}>
|
<ScrollView contentContainerStyle={styles.content} showsVerticalScrollIndicator={false}>
|
||||||
<Text style={[styles.sectionTitle, { color: theme.textMuted }]}>Categories</Text>
|
<Text style={[styles.sectionTitle, { color: theme.textMuted }]}>Tags</Text>
|
||||||
{categories.map((category) => (
|
{categories.map((category) => (
|
||||||
<ListItem
|
<ListItem
|
||||||
key={category.id}
|
key={category.id}
|
||||||
title={category.name}
|
title={category.name}
|
||||||
subtitle={category.id === defaultCategoryId ? 'Default category' : undefined}
|
subtitle={category.id === defaultCategoryId ? 'Default tag' : undefined}
|
||||||
leftElement={
|
leftElement={
|
||||||
<View style={[styles.categoryDot, { backgroundColor: category.color }]} />
|
<View style={[styles.categoryDot, { backgroundColor: category.color }]} />
|
||||||
}
|
}
|
||||||
@@ -142,7 +168,7 @@ export default function SettingsScreen() {
|
|||||||
<Path d="M12 5v14M5 12h14" stroke={theme.accentText} strokeWidth={2} strokeLinecap="round" />
|
<Path d="M12 5v14M5 12h14" stroke={theme.accentText} strokeWidth={2} strokeLinecap="round" />
|
||||||
</Svg>
|
</Svg>
|
||||||
</View>
|
</View>
|
||||||
<Text style={[styles.addCategoryText, { color: theme.accent }]}>Add Category</Text>
|
<Text style={[styles.addCategoryText, { color: theme.accent }]}>Add Tag</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<Text style={[styles.sectionTitle, { color: theme.textMuted }]}>Notifications</Text>
|
<Text style={[styles.sectionTitle, { color: theme.textMuted }]}>Notifications</Text>
|
||||||
<ListItem
|
<ListItem
|
||||||
@@ -163,9 +189,21 @@ export default function SettingsScreen() {
|
|||||||
onPress={() => notifications && setPicker('reminder')}
|
onPress={() => notifications && setPicker('reminder')}
|
||||||
showChevron
|
showChevron
|
||||||
/>
|
/>
|
||||||
|
{categories.map((category) => (
|
||||||
|
<ListItem
|
||||||
|
key={`tag-reminder-${category.id}`}
|
||||||
|
title={category.name}
|
||||||
|
subtitle={notifications ? tagReminderLabel(category.id) : 'Enable notifications first'}
|
||||||
|
leftElement={
|
||||||
|
<View style={[styles.categoryDot, { backgroundColor: category.color }]} />
|
||||||
|
}
|
||||||
|
onPress={() => notifications && setReminderTagPicker(category)}
|
||||||
|
showChevron
|
||||||
|
/>
|
||||||
|
))}
|
||||||
<Text style={[styles.sectionTitle, { color: theme.textMuted }]}>Tasks</Text>
|
<Text style={[styles.sectionTitle, { color: theme.textMuted }]}>Tasks</Text>
|
||||||
<ListItem
|
<ListItem
|
||||||
title="Default Category"
|
title="Default Tag"
|
||||||
subtitle={defaultCategoryLabel}
|
subtitle={defaultCategoryLabel}
|
||||||
onPress={() => setPicker('category')}
|
onPress={() => setPicker('category')}
|
||||||
showChevron
|
showChevron
|
||||||
@@ -188,6 +226,19 @@ export default function SettingsScreen() {
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
<ListItem
|
||||||
|
title="Delete by Swiping"
|
||||||
|
subtitle="Swipe right to delete task"
|
||||||
|
rightElement={
|
||||||
|
<Switch
|
||||||
|
value={deleteBySwipe}
|
||||||
|
onValueChange={setDeleteBySwipe}
|
||||||
|
thumbColor="#FFFFFF"
|
||||||
|
trackColor={{ false: theme.borderStrong, true: theme.accent }}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
showChevron
|
||||||
|
/>
|
||||||
<ListItem
|
<ListItem
|
||||||
title="Show Calendar Tasks"
|
title="Show Calendar Tasks"
|
||||||
subtitle={todoAheadDays === 0 ? 'Only today' : `Up to ${todoAheadDays} days ahead`}
|
subtitle={todoAheadDays === 0 ? 'Only today' : `Up to ${todoAheadDays} days ahead`}
|
||||||
@@ -269,8 +320,8 @@ export default function SettingsScreen() {
|
|||||||
|
|
||||||
<OptionPickerModal
|
<OptionPickerModal
|
||||||
visible={picker === 'category'}
|
visible={picker === 'category'}
|
||||||
title="Default Category"
|
title="Default Tag"
|
||||||
options={[{ value: '', label: 'None', color: '#9E9E9E' }, ...categories.map((c) => ({ value: c.id, label: c.name, color: c.color }))]}
|
options={[{ value: '', label: 'None', color: theme.textMuted }, ...categories.map((c) => ({ value: c.id, label: c.name, color: c.color }))]}
|
||||||
selectedValue={defaultCategoryId}
|
selectedValue={defaultCategoryId}
|
||||||
onSelect={handleDefaultCategory}
|
onSelect={handleDefaultCategory}
|
||||||
onClose={() => setPicker(null)}
|
onClose={() => setPicker(null)}
|
||||||
@@ -294,6 +345,19 @@ export default function SettingsScreen() {
|
|||||||
onClose={() => setPicker(null)}
|
onClose={() => setPicker(null)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{categories.map((category) => (
|
||||||
|
<OptionPickerModal
|
||||||
|
key={`tag-reminder-picker-${category.id}`}
|
||||||
|
visible={reminderTagPicker?.id === category.id}
|
||||||
|
title={`Reminders · ${category.name}`}
|
||||||
|
options={REMINDER_OPTIONS.filter((o) => o.value !== 'none')}
|
||||||
|
selectedValue={tagReminderPreferences[category.id] ?? []}
|
||||||
|
multiSelect
|
||||||
|
onSelect={(value) => handleTagReminderPreference(category.id, value)}
|
||||||
|
onClose={() => setReminderTagPicker(null)}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
|
||||||
<OptionPickerModal
|
<OptionPickerModal
|
||||||
visible={picker === 'todoAhead'}
|
visible={picker === 'todoAhead'}
|
||||||
title="Calendar Tasks in Todo"
|
title="Calendar Tasks in Todo"
|
||||||
@@ -330,18 +394,18 @@ export default function SettingsScreen() {
|
|||||||
</Svg>
|
</Svg>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
<ColorWheel color={draftAccent} onChange={setDraftAccent} />
|
<ColorWheel color={draftAccent} opacity={draftAccentOpacity} onChange={(color, opacity) => { setDraftAccent(color); setDraftAccentOpacity(opacity); }} />
|
||||||
<View style={styles.accentModalActions}>
|
<View style={styles.accentModalActions}>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
style={[styles.accentModalButton, { borderColor: theme.borderStrong }]}
|
style={[styles.accentModalButton, { borderColor: theme.borderStrong }]}
|
||||||
onPress={() => { setDraftAccent(DEFAULT_ACCENT); setAccentColor(DEFAULT_ACCENT); }}
|
onPress={() => { setDraftAccent(DEFAULT_ACCENT); setDraftAccentOpacity(DEFAULT_ACCENT_OPACITY); setAccentColor(DEFAULT_ACCENT); setAccentOpacity(DEFAULT_ACCENT_OPACITY); }}
|
||||||
activeOpacity={0.7}
|
activeOpacity={0.7}
|
||||||
>
|
>
|
||||||
<Text style={[styles.accentModalButtonText, { color: theme.textSecondary }]}>Reset</Text>
|
<Text style={[styles.accentModalButtonText, { color: theme.textSecondary }]}>Reset</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
style={[styles.accentModalButton, styles.accentModalButtonPrimary, { backgroundColor: theme.accent }]}
|
style={[styles.accentModalButton, styles.accentModalButtonPrimary, { backgroundColor: theme.accent }]}
|
||||||
onPress={() => { setAccentColor(draftAccent); setCustomAccentVisible(false); }}
|
onPress={() => { setAccentColor(draftAccent); setAccentOpacity(draftAccentOpacity); setCustomAccentVisible(false); }}
|
||||||
activeOpacity={0.8}
|
activeOpacity={0.8}
|
||||||
>
|
>
|
||||||
<Text style={[styles.accentModalButtonText, { color: theme.accentText }]}>Apply</Text>
|
<Text style={[styles.accentModalButtonText, { color: theme.accentText }]}>Apply</Text>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import { View, Text, StyleSheet, SafeAreaView, ScrollView, BackHandler } from 'react-native';
|
import { View, Text, StyleSheet, SafeAreaView, ScrollView } from 'react-native';
|
||||||
import { useFocusEffect } from 'expo-router';
|
import { useFocusEffect } from 'expo-router';
|
||||||
import { Header } from '@/components/Header';
|
import { Header } from '@/components/Header';
|
||||||
import { useStats } from '@/hooks/useStats';
|
import { useStats } from '@/hooks/useStats';
|
||||||
import { useSettings } from '@/theme';
|
import { useSettings, type ThemeColors } from '@/theme';
|
||||||
|
|
||||||
export default function StatsScreen() {
|
export default function StatsScreen() {
|
||||||
const { theme } = useSettings();
|
const { theme } = useSettings();
|
||||||
@@ -11,8 +11,7 @@ export default function StatsScreen() {
|
|||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
const sub = BackHandler.addEventListener('hardwareBackPress', () => true);
|
return () => {};
|
||||||
return () => sub.remove();
|
|
||||||
}, [])
|
}, [])
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -77,7 +76,7 @@ export default function StatsScreen() {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={[styles.card, { backgroundColor: theme.card }]}>
|
<View style={[styles.card, { backgroundColor: theme.card }]}>
|
||||||
<Text style={[styles.cardTitle, { color: theme.textMuted }]}>By category</Text>
|
<Text style={[styles.cardTitle, { color: theme.textMuted }]}>By tags</Text>
|
||||||
{stats.byCategory.length === 0 ? (
|
{stats.byCategory.length === 0 ? (
|
||||||
<Text style={[styles.emptyText, { color: theme.textFaint }]}>No completed tasks yet</Text>
|
<Text style={[styles.emptyText, { color: theme.textFaint }]}>No completed tasks yet</Text>
|
||||||
) : (
|
) : (
|
||||||
@@ -98,7 +97,7 @@ export default function StatsScreen() {
|
|||||||
) : (
|
) : (
|
||||||
stats.byPriority.map((p) => (
|
stats.byPriority.map((p) => (
|
||||||
<View key={p.priority} style={styles.row}>
|
<View key={p.priority} style={styles.row}>
|
||||||
<View style={[styles.dot, { backgroundColor: priorityColor(p.priority) }]} />
|
<View style={[styles.dot, { backgroundColor: priorityColor(theme, p.priority) }]} />
|
||||||
<Text style={[styles.rowLabel, { color: theme.text }]}>{p.label}</Text>
|
<Text style={[styles.rowLabel, { color: theme.text }]}>{p.label}</Text>
|
||||||
<Text style={[styles.rowValue, { color: theme.textMuted }]}>{p.count}</Text>
|
<Text style={[styles.rowValue, { color: theme.textMuted }]}>{p.count}</Text>
|
||||||
</View>
|
</View>
|
||||||
@@ -112,16 +111,17 @@ export default function StatsScreen() {
|
|||||||
|
|
||||||
const BASE_HEIGHT = 90;
|
const BASE_HEIGHT = 90;
|
||||||
|
|
||||||
function priorityColor(priority: string): string {
|
function priorityColor(theme: ThemeColors, priority: string): string {
|
||||||
switch (priority) {
|
switch (priority) {
|
||||||
|
case 'critical':
|
||||||
|
return theme.dangerStrong;
|
||||||
case 'high':
|
case 'high':
|
||||||
return '#EF5350';
|
return theme.warning;
|
||||||
case 'medium':
|
|
||||||
return '#FFA726';
|
|
||||||
case 'low':
|
case 'low':
|
||||||
return '#66BB6A';
|
case 'medium':
|
||||||
|
return theme.success;
|
||||||
default:
|
default:
|
||||||
return '#9E9E9E';
|
return theme.textMuted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,46 @@ import { UpdateNotifier } from '@/components/UpdateNotifier';
|
|||||||
import { Linking } from 'react-native';
|
import { Linking } from 'react-native';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { requestQuickAddFocus } from '@/utils/quickAddFocus';
|
import { requestQuickAddFocus } from '@/utils/quickAddFocus';
|
||||||
|
import { registerForPushNotificationsAsync, setupNotificationChannels, addNotificationResponseReceivedListener, removeNotificationSubscription } from '@/services/pushNotifications';
|
||||||
|
import * as Notifications from 'expo-notifications';
|
||||||
|
import { Platform } from 'react-native';
|
||||||
|
|
||||||
|
Notifications.setNotificationHandler({
|
||||||
|
handleNotification: async () => ({
|
||||||
|
shouldShowAlert: true,
|
||||||
|
shouldPlaySound: true,
|
||||||
|
shouldSetBadge: true,
|
||||||
|
shouldShowBanner: true,
|
||||||
|
shouldShowList: true,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
function RootNavigator() {
|
function RootNavigator() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
setupNotificationChannels();
|
||||||
|
registerForPushNotificationsAsync().catch(() => {});
|
||||||
|
|
||||||
|
const responseListener = addNotificationResponseReceivedListener((response) => {
|
||||||
|
const data = response.notification.request.content.data as Record<string, any> | undefined;
|
||||||
|
if (!data) return;
|
||||||
|
|
||||||
|
switch (data.type) {
|
||||||
|
case 'task_reminder':
|
||||||
|
case 'task_assignment':
|
||||||
|
if (data.taskId) {
|
||||||
|
router.push({ pathname: '/task-detail', params: { id: data.taskId } });
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'friend_request':
|
||||||
|
if (data.friendshipId) {
|
||||||
|
router.push({ pathname: '/(tabs)/settings' });
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const handleUrl = (url: string | null) => {
|
const handleUrl = (url: string | null) => {
|
||||||
if (!url || !url.includes('://quick-add')) return;
|
if (!url || !url.includes('://quick-add')) return;
|
||||||
router.replace('/(tabs)');
|
router.replace('/(tabs)');
|
||||||
@@ -21,8 +56,10 @@ function RootNavigator() {
|
|||||||
|
|
||||||
Linking.getInitialURL().then(handleUrl).catch(() => {});
|
Linking.getInitialURL().then(handleUrl).catch(() => {});
|
||||||
const subscription = Linking.addEventListener('url', ({ url }) => handleUrl(url));
|
const subscription = Linking.addEventListener('url', ({ url }) => handleUrl(url));
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
subscription.remove();
|
subscription.remove();
|
||||||
|
removeNotificationSubscription(responseListener);
|
||||||
};
|
};
|
||||||
}, [router]);
|
}, [router]);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useMemo } from 'react';
|
import React, { useMemo, useRef } from 'react';
|
||||||
import { View, Text, StyleSheet, SafeAreaView, ScrollView, KeyboardAvoidingView, Platform } from 'react-native';
|
import { View, Text, StyleSheet, SafeAreaView, ScrollView, KeyboardAvoidingView, Platform, Keyboard } from 'react-native';
|
||||||
import { Header } from '@/components/Header';
|
import { Header } from '@/components/Header';
|
||||||
import { CategorySelector } from '@/components/CategorySelector';
|
import { CategorySelector } from '@/components/CategorySelector';
|
||||||
import { TaskNameInput } from '@/components/TaskNameInput';
|
import { TaskNameInput } from '@/components/TaskNameInput';
|
||||||
@@ -20,6 +20,7 @@ import { database, collections } from '@/database';
|
|||||||
import { TaskFormData, tagsToString } from '@/types';
|
import { TaskFormData, tagsToString } from '@/types';
|
||||||
import { useSettings } from '@/theme';
|
import { useSettings } from '@/theme';
|
||||||
import { scheduleTaskReminder } from '@/services/notifications';
|
import { scheduleTaskReminder } from '@/services/notifications';
|
||||||
|
import { ReminderPreference } from '@/types';
|
||||||
import { useFriends } from '@/hooks/useFriends';
|
import { useFriends } from '@/hooks/useFriends';
|
||||||
|
|
||||||
const taskSchema = z.object({
|
const taskSchema = z.object({
|
||||||
@@ -48,12 +49,14 @@ export default function AddTaskScreen() {
|
|||||||
const { theme } = useSettings();
|
const { theme } = useSettings();
|
||||||
const { date: dateParam } = useLocalSearchParams<{ date?: string }>();
|
const { date: dateParam } = useLocalSearchParams<{ date?: string }>();
|
||||||
const { friends } = useFriends();
|
const { friends } = useFriends();
|
||||||
|
const { notifications: notificationsEnabled, reminderPreference } = useSettings();
|
||||||
const initialCategory = defaultCategoryId || '';
|
const initialCategory = defaultCategoryId || '';
|
||||||
const initialDate = useMemo(() => {
|
const initialDate = useMemo(() => {
|
||||||
if (!dateParam) return null;
|
if (!dateParam) return null;
|
||||||
const parsed = new Date(Array.isArray(dateParam) ? dateParam[0] : dateParam);
|
const parsed = new Date(Array.isArray(dateParam) ? dateParam[0] : dateParam);
|
||||||
return Number.isNaN(parsed.getTime()) ? null : parsed;
|
return Number.isNaN(parsed.getTime()) ? null : parsed;
|
||||||
}, [dateParam]);
|
}, [dateParam]);
|
||||||
|
const scrollViewRef = useRef<ScrollView>(null);
|
||||||
|
|
||||||
const methods = useForm<TaskFormData>({
|
const methods = useForm<TaskFormData>({
|
||||||
resolver: zodResolver(taskSchema),
|
resolver: zodResolver(taskSchema),
|
||||||
@@ -104,6 +107,9 @@ export default function AddTaskScreen() {
|
|||||||
const onSubmit = async (data: TaskFormData) => {
|
const onSubmit = async (data: TaskFormData) => {
|
||||||
if (!isReady) return;
|
if (!isReady) return;
|
||||||
|
|
||||||
|
Keyboard.dismiss();
|
||||||
|
scrollViewRef.current?.scrollTo({ y: 0, animated: true });
|
||||||
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const dueDateTimestamp = data.dueDate ? data.dueDate.getTime() : 0;
|
const dueDateTimestamp = data.dueDate ? data.dueDate.getTime() : 0;
|
||||||
const seriesId = data.repeat !== 'none'
|
const seriesId = data.repeat !== 'none'
|
||||||
@@ -160,7 +166,7 @@ export default function AddTaskScreen() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
await scheduleTaskReminder(createdTask);
|
await scheduleTaskReminder(createdTask, notificationsEnabled, reminderPreference);
|
||||||
|
|
||||||
router.back();
|
router.back();
|
||||||
};
|
};
|
||||||
@@ -179,12 +185,16 @@ export default function AddTaskScreen() {
|
|||||||
<FormProvider {...methods}>
|
<FormProvider {...methods}>
|
||||||
<KeyboardAvoidingView
|
<KeyboardAvoidingView
|
||||||
style={styles.keyboardAvoiding}
|
style={styles.keyboardAvoiding}
|
||||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
||||||
|
keyboardVerticalOffset={Platform.OS === 'ios' ? 0 : 0}
|
||||||
>
|
>
|
||||||
<ScrollView
|
<ScrollView
|
||||||
|
ref={scrollViewRef}
|
||||||
contentContainerStyle={styles.scrollContent}
|
contentContainerStyle={styles.scrollContent}
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
keyboardShouldPersistTaps="handled"
|
keyboardShouldPersistTaps="handled"
|
||||||
|
keyboardDismissMode="interactive"
|
||||||
|
automaticallyAdjustContentInsets={false}
|
||||||
>
|
>
|
||||||
<CategorySelector
|
<CategorySelector
|
||||||
value={tags}
|
value={tags}
|
||||||
@@ -263,7 +273,7 @@ const styles = StyleSheet.create({
|
|||||||
scrollContent: {
|
scrollContent: {
|
||||||
paddingHorizontal: 16,
|
paddingHorizontal: 16,
|
||||||
paddingTop: 12,
|
paddingTop: 12,
|
||||||
paddingBottom: 120,
|
paddingBottom: 100,
|
||||||
gap: 20,
|
gap: 20,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,18 +1,19 @@
|
|||||||
import React, { useCallback, useMemo } from 'react';
|
import React, { useCallback, useMemo } from 'react';
|
||||||
import { View, Text, StyleSheet, SafeAreaView, ScrollView, TouchableOpacity, KeyboardAvoidingView, BackHandler } from 'react-native';
|
import { View, Text, StyleSheet, SafeAreaView, ScrollView, TouchableOpacity, KeyboardAvoidingView, BackHandler } from 'react-native';
|
||||||
import { useRouter, useLocalSearchParams, useFocusEffect } from 'expo-router';
|
import { useRouter, useLocalSearchParams, useFocusEffect } from 'expo-router';
|
||||||
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||||
import { Header } from '@/components/Header';
|
import { Header } from '@/components/Header';
|
||||||
import { useTasksByDate } from '@/hooks/useTasks';
|
import { useTasksByDate } from '@/hooks/useTasks';
|
||||||
import { useSubtasks } from '@/hooks/useSubtasks';
|
import { useSubtasks } from '@/hooks/useSubtasks';
|
||||||
import { useTaskModals } from '@/hooks/useTaskModals';
|
import { useTaskModals } from '@/hooks/useTaskModals';
|
||||||
import { useSettings } from '@/theme';
|
import { useSettings } from '@/theme';
|
||||||
import { useCategories } from '@/hooks/useDatabase';
|
import { useCategories } from '@/hooks/useDatabase';
|
||||||
import { toggleTaskComplete, toggleSubtaskComplete } from '@/utils/taskActions';
|
import { confirmAndToggleTaskComplete, toggleSubtaskComplete } from '@/utils/taskActions';
|
||||||
import { QuickAddBar } from '@/components/QuickAddBar';
|
import { QuickAddBar } from '@/components/QuickAddBar';
|
||||||
import { SubtaskData } from '@/types';
|
import { SubtaskData } from '@/types';
|
||||||
import { format, startOfDay } from 'date-fns';
|
import { format, startOfDay } from 'date-fns';
|
||||||
import Svg, { Path, Circle } from 'react-native-svg';
|
import Svg, { Path, Circle } from 'react-native-svg';
|
||||||
import { desaturate } from '@/theme';
|
import { desaturate, type ThemeColors } from '@/theme';
|
||||||
|
|
||||||
function isDayMatch(timestamp: number, day: Date): boolean {
|
function isDayMatch(timestamp: number, day: Date): boolean {
|
||||||
const d = new Date(timestamp);
|
const d = new Date(timestamp);
|
||||||
@@ -22,6 +23,8 @@ function isDayMatch(timestamp: number, day: Date): boolean {
|
|||||||
export default function DayViewScreen() {
|
export default function DayViewScreen() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { theme } = useSettings();
|
const { theme } = useSettings();
|
||||||
|
const insets = useSafeAreaInsets();
|
||||||
|
const styles = useMemo(() => createStyles(theme), [theme]);
|
||||||
const categories = useCategories();
|
const categories = useCategories();
|
||||||
const { modals, openTaskEdit } = useTaskModals();
|
const { modals, openTaskEdit } = useTaskModals();
|
||||||
const { date: dateParam } = useLocalSearchParams<{ date?: string }>();
|
const { date: dateParam } = useLocalSearchParams<{ date?: string }>();
|
||||||
@@ -37,11 +40,14 @@ export default function DayViewScreen() {
|
|||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
const sub = BackHandler.addEventListener('hardwareBackPress', () => false);
|
const sub = BackHandler.addEventListener('hardwareBackPress', () => {
|
||||||
|
router.back();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
refreshSubtasks();
|
refreshSubtasks();
|
||||||
refresh();
|
refresh();
|
||||||
return () => sub.remove();
|
return () => sub.remove();
|
||||||
}, [refreshSubtasks, refresh])
|
}, [router, refreshSubtasks, refresh])
|
||||||
);
|
);
|
||||||
|
|
||||||
const subtasksOnDay = useMemo(() => {
|
const subtasksOnDay = useMemo(() => {
|
||||||
@@ -54,9 +60,10 @@ export default function DayViewScreen() {
|
|||||||
}, [subtasksByTask, day]);
|
}, [subtasksByTask, day]);
|
||||||
|
|
||||||
const handleToggleComplete = useCallback(async (taskId: string) => {
|
const handleToggleComplete = useCallback(async (taskId: string) => {
|
||||||
await toggleTaskComplete(taskId);
|
await confirmAndToggleTaskComplete(taskId, () => {
|
||||||
refresh();
|
refresh();
|
||||||
refreshSubtasks();
|
refreshSubtasks();
|
||||||
|
});
|
||||||
}, [refresh, refreshSubtasks]);
|
}, [refresh, refreshSubtasks]);
|
||||||
|
|
||||||
const handleToggleSubtask = useCallback(async (subtaskId: string) => {
|
const handleToggleSubtask = useCallback(async (subtaskId: string) => {
|
||||||
@@ -65,8 +72,8 @@ export default function DayViewScreen() {
|
|||||||
}, [refreshSubtasks]);
|
}, [refreshSubtasks]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView style={[styles.container, { backgroundColor: theme.background }]}>
|
<SafeAreaView style={[styles.container, { backgroundColor: theme.background, paddingBottom: insets.bottom }]}>
|
||||||
<Header title={format(day, 'EEEE, MMM d')} showLogo={false} />
|
<Header title={format(day, 'EEEE, MMM d')} showLogo={false} rightAction="Back" />
|
||||||
<KeyboardAvoidingView style={styles.kbAvoid} behavior="padding">
|
<KeyboardAvoidingView style={styles.kbAvoid} behavior="padding">
|
||||||
<ScrollView style={styles.scrollBody} contentContainerStyle={styles.scrollContent} showsVerticalScrollIndicator={false}>
|
<ScrollView style={styles.scrollBody} contentContainerStyle={styles.scrollContent} showsVerticalScrollIndicator={false}>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
@@ -205,7 +212,7 @@ export default function DayViewScreen() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const createStyles = (theme: ThemeColors) => StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
},
|
},
|
||||||
@@ -252,7 +259,7 @@ const styles = StyleSheet.create({
|
|||||||
},
|
},
|
||||||
eventCompleted: {
|
eventCompleted: {
|
||||||
textDecorationLine: 'line-through',
|
textDecorationLine: 'line-through',
|
||||||
color: '#9E9E9E',
|
color: theme.textMuted,
|
||||||
},
|
},
|
||||||
eventSub: {
|
eventSub: {
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { zodResolver } from '@hookform/resolvers/zod';
|
|||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { useDatabase } from '@/hooks/useDatabase';
|
import { useDatabase } from '@/hooks/useDatabase';
|
||||||
import { collections } from '@/database';
|
import { collections } from '@/database';
|
||||||
import { SubtaskFormData, Reminder, parseReminders, toRemindersString } from '@/types';
|
import { SubtaskFormData, Reminder, parseReminders, toRemindersString, parseTaskTags, tagsToString } from '@/types';
|
||||||
import { useSettings } from '@/theme';
|
import { useSettings } from '@/theme';
|
||||||
import { updateSubtask, deleteSubtask } from '@/utils/taskActions';
|
import { updateSubtask, deleteSubtask } from '@/utils/taskActions';
|
||||||
import { CategorySelector } from '@/components/CategorySelector';
|
import { CategorySelector } from '@/components/CategorySelector';
|
||||||
@@ -25,7 +25,7 @@ import Svg, { Path } from 'react-native-svg';
|
|||||||
const subtaskSchema = z.object({
|
const subtaskSchema = z.object({
|
||||||
title: z.string().trim().min(1, 'Subtask name is required').max(100),
|
title: z.string().trim().min(1, 'Subtask name is required').max(100),
|
||||||
description: z.string().max(1000).optional(),
|
description: z.string().max(1000).optional(),
|
||||||
categoryId: z.string().optional(),
|
tags: z.array(z.string()).optional(),
|
||||||
priority: z.enum(['none', 'low', 'medium', 'high', 'critical']),
|
priority: z.enum(['none', 'low', 'medium', 'high', 'critical']),
|
||||||
dueDate: z.date().nullable().optional(),
|
dueDate: z.date().nullable().optional(),
|
||||||
dueTime: z.string().optional(),
|
dueTime: z.string().optional(),
|
||||||
@@ -53,7 +53,7 @@ export default function SubtaskDetailScreen() {
|
|||||||
defaultValues: {
|
defaultValues: {
|
||||||
title: '',
|
title: '',
|
||||||
description: '',
|
description: '',
|
||||||
categoryId: '',
|
tags: [],
|
||||||
priority: 'none',
|
priority: 'none',
|
||||||
dueDate: null,
|
dueDate: null,
|
||||||
dueTime: '',
|
dueTime: '',
|
||||||
@@ -71,7 +71,7 @@ export default function SubtaskDetailScreen() {
|
|||||||
const { handleSubmit, watch, setValue, control, reset, formState: { errors } } = methods;
|
const { handleSubmit, watch, setValue, control, reset, formState: { errors } } = methods;
|
||||||
|
|
||||||
const priority = watch('priority');
|
const priority = watch('priority');
|
||||||
const categoryId = watch('categoryId');
|
const tags = watch('tags') ?? [];
|
||||||
const repeat = watch('repeat');
|
const repeat = watch('repeat');
|
||||||
const repeatInterval = watch('repeatInterval') ?? 1;
|
const repeatInterval = watch('repeatInterval') ?? 1;
|
||||||
const repeatDays = watch('repeatDays') ?? [];
|
const repeatDays = watch('repeatDays') ?? [];
|
||||||
@@ -90,7 +90,7 @@ export default function SubtaskDetailScreen() {
|
|||||||
reset({
|
reset({
|
||||||
title: subtask.title,
|
title: subtask.title,
|
||||||
description: subtask.description,
|
description: subtask.description,
|
||||||
categoryId: subtask.categoryId || '',
|
tags: parseTaskTags(subtask.tags, subtask.categoryId),
|
||||||
priority: subtask.priority,
|
priority: subtask.priority,
|
||||||
dueDate: subtask.dueDate ? new Date(subtask.dueDate) : null,
|
dueDate: subtask.dueDate ? new Date(subtask.dueDate) : null,
|
||||||
dueTime: subtask.dueTime,
|
dueTime: subtask.dueTime,
|
||||||
@@ -125,7 +125,8 @@ export default function SubtaskDetailScreen() {
|
|||||||
await updateSubtask(id, {
|
await updateSubtask(id, {
|
||||||
title: data.title,
|
title: data.title,
|
||||||
description: data.description || '',
|
description: data.description || '',
|
||||||
categoryId: data.categoryId || '',
|
categoryId: (data.tags && data.tags[0]) || '',
|
||||||
|
tags: tagsToString(data.tags || []),
|
||||||
priority: data.priority,
|
priority: data.priority,
|
||||||
dueDate: data.dueDate ? data.dueDate.getTime() : 0,
|
dueDate: data.dueDate ? data.dueDate.getTime() : 0,
|
||||||
dueTime: data.dueTime || '',
|
dueTime: data.dueTime || '',
|
||||||
@@ -186,6 +187,7 @@ export default function SubtaskDetailScreen() {
|
|||||||
contentContainerStyle={styles.scrollContent}
|
contentContainerStyle={styles.scrollContent}
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
keyboardShouldPersistTaps="handled"
|
keyboardShouldPersistTaps="handled"
|
||||||
|
keyboardDismissMode="interactive"
|
||||||
>
|
>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
@@ -200,8 +202,8 @@ export default function SubtaskDetailScreen() {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<CategorySelector
|
<CategorySelector
|
||||||
value={categoryId ? [categoryId] : []}
|
value={tags}
|
||||||
onChange={(value) => setValue('categoryId', value[0] ?? '')}
|
onChange={(value) => setValue('tags', value)}
|
||||||
/>
|
/>
|
||||||
<PrioritySelector
|
<PrioritySelector
|
||||||
value={priority}
|
value={priority}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React, { useRef } from 'react';
|
||||||
import { View, Text, StyleSheet, SafeAreaView, ScrollView, KeyboardAvoidingView, Platform, TouchableOpacity } from 'react-native';
|
import { View, Text, StyleSheet, SafeAreaView, ScrollView, KeyboardAvoidingView, Platform, TouchableOpacity, Keyboard } from 'react-native';
|
||||||
import { useLocalSearchParams, useRouter } from 'expo-router';
|
import { useLocalSearchParams, useRouter } from 'expo-router';
|
||||||
import { Header } from '@/components/Header';
|
import { Header } from '@/components/Header';
|
||||||
import { CategorySelector } from '@/components/CategorySelector';
|
import { CategorySelector } from '@/components/CategorySelector';
|
||||||
@@ -23,6 +23,7 @@ import { TaskFormData, parseTaskTags, tagsToString } from '@/types';
|
|||||||
import { useSettings } from '@/theme';
|
import { useSettings } from '@/theme';
|
||||||
import { deleteTaskOccurrences } from '@/utils/taskActions';
|
import { deleteTaskOccurrences } from '@/utils/taskActions';
|
||||||
import { scheduleTaskReminder } from '@/services/notifications';
|
import { scheduleTaskReminder } from '@/services/notifications';
|
||||||
|
import { ReminderPreference } from '@/types';
|
||||||
import { recordTombstonesInBatch } from '@/database/tombstones';
|
import { recordTombstonesInBatch } from '@/database/tombstones';
|
||||||
import { useFriends } from '@/hooks/useFriends';
|
import { useFriends } from '@/hooks/useFriends';
|
||||||
import Svg, { Path, Circle } from 'react-native-svg';
|
import Svg, { Path, Circle } from 'react-native-svg';
|
||||||
@@ -79,8 +80,10 @@ export default function TaskDetailScreen() {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { theme } = useSettings();
|
const { theme } = useSettings();
|
||||||
const { friends } = useFriends();
|
const { friends } = useFriends();
|
||||||
|
const { notifications: notificationsEnabled, reminderPreference } = useSettings();
|
||||||
const [loaded, setLoaded] = React.useState(false);
|
const [loaded, setLoaded] = React.useState(false);
|
||||||
const [notFound, setNotFound] = React.useState(false);
|
const [notFound, setNotFound] = React.useState(false);
|
||||||
|
const scrollViewRef = useRef<ScrollView>(null);
|
||||||
|
|
||||||
const methods = useForm<TaskFormData>({
|
const methods = useForm<TaskFormData>({
|
||||||
resolver: zodResolver(taskSchema),
|
resolver: zodResolver(taskSchema),
|
||||||
@@ -126,6 +129,8 @@ export default function TaskDetailScreen() {
|
|||||||
const subtasks = await collections.subtasks.query(Q.where('task_id', id)).fetch();
|
const subtasks = await collections.subtasks.query(Q.where('task_id', id)).fetch();
|
||||||
|
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
|
const remindersValue = task.reminders || (task.reminder && task.reminder !== 'none' ? task.reminder : '');
|
||||||
|
|
||||||
reset({
|
reset({
|
||||||
title: task.title,
|
title: task.title,
|
||||||
description: task.description,
|
description: task.description,
|
||||||
@@ -140,6 +145,7 @@ export default function TaskDetailScreen() {
|
|||||||
repeatInterval: task.repeatInterval || 1,
|
repeatInterval: task.repeatInterval || 1,
|
||||||
repeatDays: (task.repeatDays || '').split(',').map(Number).filter((d) => !Number.isNaN(d)),
|
repeatDays: (task.repeatDays || '').split(',').map(Number).filter((d) => !Number.isNaN(d)),
|
||||||
reminder: (task.reminder || 'none') as TaskFormData['reminder'],
|
reminder: (task.reminder || 'none') as TaskFormData['reminder'],
|
||||||
|
reminders: remindersValue,
|
||||||
assigneeId: task.assigneeId ?? null,
|
assigneeId: task.assigneeId ?? null,
|
||||||
subtasks: subtasks.map((s) => ({ title: s.title, _key: s.id })),
|
subtasks: subtasks.map((s) => ({ title: s.title, _key: s.id })),
|
||||||
});
|
});
|
||||||
@@ -155,6 +161,9 @@ export default function TaskDetailScreen() {
|
|||||||
const onSubmit = async (data: TaskFormData) => {
|
const onSubmit = async (data: TaskFormData) => {
|
||||||
if (!id || !isReady) return;
|
if (!id || !isReady) return;
|
||||||
|
|
||||||
|
Keyboard.dismiss();
|
||||||
|
scrollViewRef.current?.scrollTo({ y: 0, animated: true });
|
||||||
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const dueDateTimestamp = data.dueDate ? data.dueDate.getTime() : 0;
|
const dueDateTimestamp = data.dueDate ? data.dueDate.getTime() : 0;
|
||||||
|
|
||||||
@@ -179,6 +188,7 @@ export default function TaskDetailScreen() {
|
|||||||
t.repeatInterval = data.repeatInterval || 1;
|
t.repeatInterval = data.repeatInterval || 1;
|
||||||
t.repeatDays = (data.repeatDays || []).join(',');
|
t.repeatDays = (data.repeatDays || []).join(',');
|
||||||
t.reminder = data.reminder || 'none';
|
t.reminder = data.reminder || 'none';
|
||||||
|
t.reminders = data.reminders || '';
|
||||||
t.assigneeId = data.assigneeId ?? null;
|
t.assigneeId = data.assigneeId ?? null;
|
||||||
if (data.repeat !== 'none' && !t.seriesId) {
|
if (data.repeat !== 'none' && !t.seriesId) {
|
||||||
t.seriesId = `series_${Math.random().toString(36).slice(2, 10)}${Date.now().toString(36)}`;
|
t.seriesId = `series_${Math.random().toString(36).slice(2, 10)}${Date.now().toString(36)}`;
|
||||||
@@ -207,6 +217,7 @@ export default function TaskDetailScreen() {
|
|||||||
await collections.subtasks.create((s) => {
|
await collections.subtasks.create((s) => {
|
||||||
s.taskId = task.id;
|
s.taskId = task.id;
|
||||||
s.categoryId = task.categoryId || '';
|
s.categoryId = task.categoryId || '';
|
||||||
|
s.tags = task.tags || '';
|
||||||
s.title = trimmed;
|
s.title = trimmed;
|
||||||
s.description = '';
|
s.description = '';
|
||||||
s.priority = 'none';
|
s.priority = 'none';
|
||||||
@@ -247,7 +258,7 @@ export default function TaskDetailScreen() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
await scheduleTaskReminder(savedTask);
|
await scheduleTaskReminder(savedTask, notificationsEnabled, reminderPreference);
|
||||||
|
|
||||||
router.back();
|
router.back();
|
||||||
};
|
};
|
||||||
@@ -287,12 +298,15 @@ export default function TaskDetailScreen() {
|
|||||||
<FormProvider {...methods}>
|
<FormProvider {...methods}>
|
||||||
<KeyboardAvoidingView
|
<KeyboardAvoidingView
|
||||||
style={styles.keyboardAvoiding}
|
style={styles.keyboardAvoiding}
|
||||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
||||||
|
keyboardVerticalOffset={Platform.OS === 'ios' ? 0 : 0}
|
||||||
>
|
>
|
||||||
<ScrollView
|
<ScrollView
|
||||||
|
ref={scrollViewRef}
|
||||||
contentContainerStyle={styles.scrollContent}
|
contentContainerStyle={styles.scrollContent}
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
keyboardShouldPersistTaps="handled"
|
keyboardShouldPersistTaps="handled"
|
||||||
|
keyboardDismissMode="interactive"
|
||||||
>
|
>
|
||||||
<CategorySelector
|
<CategorySelector
|
||||||
value={tags}
|
value={tags}
|
||||||
@@ -431,7 +445,7 @@ const styles = StyleSheet.create({
|
|||||||
scrollContent: {
|
scrollContent: {
|
||||||
paddingHorizontal: 12,
|
paddingHorizontal: 12,
|
||||||
paddingTop: 8,
|
paddingTop: 8,
|
||||||
paddingBottom: 80,
|
paddingBottom: 60,
|
||||||
gap: 12,
|
gap: 12,
|
||||||
},
|
},
|
||||||
section: {
|
section: {
|
||||||
|
|||||||
|
After Width: | Height: | Size: 384 KiB |
@@ -0,0 +1,46 @@
|
|||||||
|
module.exports = {
|
||||||
|
appId: 'com.carryyourlive.desktop',
|
||||||
|
productName: 'Carry Your Live',
|
||||||
|
copyright: 'Copyright © 2026',
|
||||||
|
|
||||||
|
directories: {
|
||||||
|
output: 'desktop-build',
|
||||||
|
buildResources: 'build',
|
||||||
|
},
|
||||||
|
|
||||||
|
// Override the entry point in the packaged app (repo keeps expo-router/entry
|
||||||
|
// as `main` so `expo start` keeps working).
|
||||||
|
extraMetadata: {
|
||||||
|
main: 'electron/main.js',
|
||||||
|
},
|
||||||
|
|
||||||
|
// The Electron shell needs zero runtime dependencies: main/preload use Node
|
||||||
|
// built-ins only, and the renderer is fully bundled by Metro into dist/.
|
||||||
|
// Returning false tells electron-builder that node_modules are handled
|
||||||
|
// externally — i.e. don't bundle production deps (expo, react-native, ...)
|
||||||
|
// into the package. This keeps the deb ~100x smaller.
|
||||||
|
// NOTE: do not set npmRebuild:false here — installAppDependencies()
|
||||||
|
// short-circuits on it *before* evaluating beforeBuild, which would
|
||||||
|
// re-enable bundling of node_modules.
|
||||||
|
beforeBuild: async () => false,
|
||||||
|
// Sanity check validates the ORIGINAL package.json `main` (expo-router/entry)
|
||||||
|
// against the asar, which no longer exists once deps are excluded.
|
||||||
|
// The real entry point is set via extraMetadata.main above.
|
||||||
|
disableSanityCheckAsar: true,
|
||||||
|
|
||||||
|
files: ['dist/**/*', 'electron/**/*', 'assets/icon.png', 'package.json'],
|
||||||
|
|
||||||
|
// Icons are generated from build/icon.png (1024x1024) for each platform.
|
||||||
|
mac: {
|
||||||
|
category: 'public.app-category.productivity',
|
||||||
|
target: ['dmg', 'zip'],
|
||||||
|
},
|
||||||
|
win: {
|
||||||
|
target: ['nsis'],
|
||||||
|
},
|
||||||
|
linux: {
|
||||||
|
category: 'Productivity',
|
||||||
|
maintainer: 'carry-your-live',
|
||||||
|
target: ['deb', 'AppImage'],
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
/* global __dirname */
|
/* global __dirname */
|
||||||
const { app, BrowserWindow } = require('electron')
|
const { app, BrowserWindow, ipcMain } = require('electron')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
|
const DEV_SERVER_URL = process.env.ELECTRON_START_URL
|
||||||
|
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
const win = new BrowserWindow({
|
const win = new BrowserWindow({
|
||||||
width: 1200,
|
width: 1200,
|
||||||
@@ -11,24 +13,39 @@ function createWindow() {
|
|||||||
webPreferences: {
|
webPreferences: {
|
||||||
nodeIntegration: false,
|
nodeIntegration: false,
|
||||||
contextIsolation: true,
|
contextIsolation: true,
|
||||||
|
sandbox: true,
|
||||||
webSecurity: true,
|
webSecurity: true,
|
||||||
|
preload: path.join(__dirname, 'preload.js'),
|
||||||
},
|
},
|
||||||
icon: path.join(__dirname, '../assets/icon.png'),
|
icon: path.join(__dirname, '../assets/icon.png'),
|
||||||
titleBarStyle: 'default',
|
titleBarStyle: 'default',
|
||||||
show: false,
|
show: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
win.loadFile(path.join(__dirname, '../dist/index.html'))
|
if (DEV_SERVER_URL) {
|
||||||
|
win.loadURL(DEV_SERVER_URL)
|
||||||
|
} else {
|
||||||
|
win.loadFile(path.join(__dirname, '../dist/index.html'))
|
||||||
|
}
|
||||||
|
|
||||||
win.once('ready-to-show', () => {
|
win.once('ready-to-show', () => {
|
||||||
win.show()
|
win.show()
|
||||||
})
|
})
|
||||||
|
|
||||||
win.on('closed', () => {
|
// In dev, reload instead of quitting when the renderer crashes / navigates away
|
||||||
app.quit()
|
win.webContents.on('didFailLoad', (_event, code, desc) => {
|
||||||
|
console.error(`[electron] failed to load: ${code} ${desc}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
return win
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ipcMain.handle('app:get-info', () => ({
|
||||||
|
version: app.getVersion(),
|
||||||
|
name: app.getName(),
|
||||||
|
platform: process.platform,
|
||||||
|
}))
|
||||||
|
|
||||||
app.whenReady().then(createWindow)
|
app.whenReady().then(createWindow)
|
||||||
|
|
||||||
app.on('window-all-closed', () => {
|
app.on('window-all-closed', () => {
|
||||||
@@ -41,4 +58,4 @@ app.on('activate', () => {
|
|||||||
if (BrowserWindow.getAllWindows().length === 0) {
|
if (BrowserWindow.getAllWindows().length === 0) {
|
||||||
createWindow()
|
createWindow()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||