Files
daily-notification-plugin/android
Matthew Raymer f31bae1563 feat(android): implement cancelAllNotifications() method
- Add cancelAllNotifications() method to DailyNotificationPlugin
  - Cancels all AlarmManager alarms (exact and inexact)
  - Cancels all WorkManager prefetch/fetch jobs by tag
  - Clears notification schedules from database (sets enabled=false)
  - Idempotent - safe to call multiple times

- Implementation details:
  - Reads scheduled notifications from database
  - Uses NotifyReceiver.cancelNotification() for each scheduled alarm
  - Includes fallback cleanup for orphaned alarms
  - Cancels WorkManager jobs with tags: prefetch, daily_notification_fetch,
    daily_notification_maintenance, soft_refetch, daily_notification_display,
    daily_notification_dismiss
  - Disables all notification and fetch schedules in database

- Add required imports:
  - android.app.PendingIntent for alarm cancellation
  - androidx.work.WorkManager for job cancellation

- Error handling:
  - Gracefully handles missing alarms/jobs (logs warnings, doesn't fail)
  - Continues cleanup even if individual operations fail
  - Comprehensive logging for debugging

Fixes:
- 'not implemented' error when host app calls cancelAllNotifications()
- Enables users to update notification time without errors
- Allows users to disable notifications completely
- Prevents orphaned alarms and jobs after cancellation

The method matches TypeScript interface and is ready for use.
2025-11-10 04:17:45 +00:00
..