# Daily Notification Plugin - Integration Checklist

**Integration Date**: 2026-01-21  
**Plugin Version**: 1.0.11  
**Status**: Phase 1 Complete ✅

---

## Phase 1: Infrastructure Setup ✅ COMPLETE

### Code Files
- [x] Created `src/plugins/DailyNotificationPlugin.ts`
- [x] Created `src/services/notifications/NotificationService.ts`
- [x] Created `src/services/notifications/NativeNotificationService.ts`
- [x] Created `src/services/notifications/WebPushNotificationService.ts`
- [x] Created `src/services/notifications/index.ts`

### Android Configuration
- [x] Added permissions to `AndroidManifest.xml`:
  - [x] `POST_NOTIFICATIONS`
  - [x] `SCHEDULE_EXACT_ALARM`
  - [x] `USE_EXACT_ALARM`
  - [x] `RECEIVE_BOOT_COMPLETED`
  - [x] `WAKE_LOCK`
- [x] Registered receivers in `AndroidManifest.xml`:
  - [x] `DailyNotificationReceiver`
  - [x] `BootReceiver`
- [x] Added dependencies to `build.gradle`:
  - [x] Room (`androidx.room:room-runtime:2.6.1`)
  - [x] WorkManager (`androidx.work:work-runtime-ktx:2.9.0`)
  - [x] Coroutines (`org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3`)
  - [x] Room Compiler (`androidx.room:room-compiler:2.6.1`)
- [x] Registered plugin in `MainActivity.java`

### iOS Configuration
- [x] Added to `Info.plist`:
  - [x] `UIBackgroundModes` (fetch, processing)
  - [x] `BGTaskSchedulerPermittedIdentifiers`
  - [x] `NSUserNotificationAlertStyle`
- [ ] ⚠️ **MANUAL STEP**: Xcode capabilities (see Phase 5)

### Documentation
- [x] Created `doc/daily-notification-plugin-integration.md`
- [x] Created `doc/daily-notification-plugin-integration-summary.md`
- [x] Created `doc/daily-notification-plugin-architecture.md`
- [x] Created this checklist

---

## Phase 2: UI Integration ⏳ TODO

### Update Components
- [ ] Modify `PushNotificationPermission.vue`:
  - [ ] Import `NotificationService`
  - [ ] Replace direct web push calls with service methods
  - [ ] Add platform-aware messaging
  - [ ] Test permission flow
  - [ ] Test notification scheduling

### Update Views
- [ ] Update `AccountViewView.vue`:
  - [ ] Use `NotificationService` for status checks
  - [ ] Add platform indicator
  - [ ] Test settings display
  
### Settings Integration
- [ ] Verify settings save/load correctly:
  - [ ] `notifyingNewActivityTime` for native
  - [ ] `notifyingReminderMessage` for native
  - [ ] `notifyingReminderTime` for native
  - [ ] Existing web push settings preserved

---

## Phase 3: Web Push Integration ⏳ TODO

### Wire WebPushNotificationService
- [ ] Extract subscription logic from `PushNotificationPermission.vue`
- [ ] Implement `scheduleDailyNotification()` method
- [ ] Implement `cancelDailyNotification()` method
- [ ] Implement `getStatus()` method
- [ ] Test web platform notification flow

### Server Integration
- [ ] Verify web push server endpoints still work
- [ ] Test subscription/unsubscription
- [ ] Test scheduled message delivery

---

## Phase 4: Testing ⏳ TODO

### Desktop Development
- [ ] Code compiles without errors
- [ ] ESLint passes
- [ ] TypeScript types are correct
- [ ] Platform detection works in browser console

### Android Emulator
- [ ] App builds successfully
- [ ] Plugin loads without errors
- [ ] Can open app and navigate
- [ ] No JavaScript console errors

### Android Device (Real)
- [ ] Request permissions dialog appears
- [ ] Permissions can be granted
- [ ] Schedule notification succeeds
- [ ] Notification appears at scheduled time
- [ ] Notification survives app close
- [ ] Notification survives device reboot
- [ ] Notification can be cancelled

### iOS Simulator
- [ ] App builds successfully
- [ ] Plugin loads without errors
- [ ] Can open app and navigate
- [ ] No JavaScript console errors

### iOS Device (Real)
- [ ] Request permissions dialog appears
- [ ] Permissions can be granted
- [ ] Schedule notification succeeds
- [ ] Notification appears at scheduled time
- [ ] Background fetch works
- [ ] Notification survives app close
- [ ] Notification can be cancelled

### Web Browser
- [ ] Existing web push still works
- [ ] No JavaScript errors
- [ ] Platform detection selects web service
- [ ] Permission flow works
- [ ] Subscription works

---

## Phase 5: iOS Xcode Setup ⚠️ MANUAL REQUIRED

### Open Xcode Project
```bash
cd ios
open App/App.xcodeproj
```

### Configure Capabilities
- [ ] Select "App" target in project navigator
- [ ] Go to "Signing & Capabilities" tab
- [ ] Click "+ Capability" button
- [ ] Add "Background Modes":
  - [ ] Enable "Background fetch"
  - [ ] Enable "Background processing"
- [ ] Click "+ Capability" button again
- [ ] Add "Push Notifications" (if using remote notifications)

### Install CocoaPods
```bash
cd ios
pod install
cd ..
```
- [ ] Run `pod install` successfully
- [ ] Verify `CapacitorDailyNotification` pod is installed

### Verify Configuration
- [ ] Build succeeds in Xcode
- [ ] No capability warnings
- [ ] No pod errors
- [ ] Can run on simulator

---

## Phase 6: Build & Deploy ⏳ TODO

### Sync Capacitor
```bash
npx cap sync
```
- [ ] Sync completes without errors
- [ ] Plugin files copied to native projects

### Build Android
```bash
npm run build:android:debug
```
- [ ] Build succeeds
- [ ] APK/AAB generated
- [ ] Can install on device/emulator

### Build iOS
```bash
npm run build:ios:debug
```
- [ ] Build succeeds
- [ ] IPA generated (if release)
- [ ] Can install on device/simulator

### Test Production Builds
- [ ] Android release build works
- [ ] iOS release build works
- [ ] Notifications work in production

---

## Troubleshooting Checklist

### Android Issues

#### Notifications Not Appearing
- [ ] Verified `DailyNotificationReceiver` is in AndroidManifest.xml
- [ ] Checked logcat for errors: `adb logcat | grep DailyNotification`
- [ ] Verified permissions granted in app settings
- [ ] Checked "Exact alarms" permission (Android 12+)
- [ ] Verified notification channel is created

#### Build Errors
- [ ] Verified all dependencies in build.gradle
- [ ] Ran `./gradlew clean` and rebuilt
- [ ] Verified Kotlin version compatibility
- [ ] Checked for conflicting dependencies

### iOS Issues

#### Notifications Not Appearing
- [ ] Verified Background Modes enabled in Xcode
- [ ] Checked Xcode console for errors
- [ ] Verified permissions granted in Settings app
- [ ] Tested on real device (not just simulator)
- [ ] Checked BGTaskScheduler identifiers match Info.plist

#### Build Errors
- [ ] Ran `pod install` successfully
- [ ] Verified deployment target is iOS 13.0+
- [ ] Checked for pod conflicts
- [ ] Cleaned build folder (Xcode → Product → Clean Build Folder)

### Web Issues

#### Web Push Not Working
- [ ] Verified service worker is registered
- [ ] Checked browser console for errors
- [ ] Verified VAPID keys are correct
- [ ] Tested in supported browser (Chrome 42+, Firefox)
- [ ] Checked push server is running

#### Permission Issues
- [ ] Verified permissions not blocked in browser
- [ ] Checked site settings in browser
- [ ] Verified HTTPS connection (required for web push)

---

## Verification Commands

### Check Plugin is Installed
```bash
npm list @timesafari/daily-notification-plugin
```

### Check Capacitor Sync
```bash
npx cap ls
```

### Check Android Build
```bash
cd android
./gradlew clean
./gradlew assembleDebug
```

### Check iOS Build
```bash
cd ios
pod install
xcodebuild -workspace App/App.xcworkspace -scheme App -configuration Debug build
```

### Check TypeScript
```bash
npm run type-check
```

### Check Linting
```bash
npm run lint
```

---

## Next Immediate Actions

1. **Run Capacitor Sync**:
   ```bash
   npx cap sync
   ```

2. **For iOS Development**:
   ```bash
   cd ios
   open App/App.xcodeproj
   # Enable Background Modes capability
   pod install
   cd ..
   ```

3. **Test on Emulator/Simulator**:
   ```bash
   npm run build:android:debug  # For Android
   npm run build:ios:debug      # For iOS
   ```

4. **Update UI Components**:
   - Start with `PushNotificationPermission.vue`
   - Import and use `NotificationService`

---

## Success Criteria

- [x] **Phase 1**: All files created and configurations applied
- [ ] **Phase 2**: Components use NotificationService
- [ ] **Phase 3**: Web push integrated with service
- [ ] **Phase 4**: All tests pass on all platforms
- [ ] **Phase 5**: iOS capabilities configured in Xcode
- [ ] **Phase 6**: Production builds work on real devices

---

## Questions or Issues?

See documentation:
- Full guide: `doc/daily-notification-plugin-integration.md`
- Architecture: `doc/daily-notification-plugin-architecture.md`
- Summary: `doc/daily-notification-plugin-integration-summary.md`

Plugin docs: `node_modules/@timesafari/daily-notification-plugin/README.md`

---

**Current Status**: Ready for Phase 2 (UI Integration) 🚀
