Files
submanager/doc/pr/codex-fix-notification-reliability.md

1.8 KiB

Summary

  • Improve local notification reliability on iOS and Android without adding dependencies.
  • Keep diffs minimal: platform tweaks + small service/UI updates.

Changes

  • iOS
    • ios/Runner/AppDelegate.swift
      • Set UNUserNotificationCenter delegate on launch.
      • Implement willPresent to show [.banner, .sound, .badge] while in foreground.
  • Android
    • android/app/src/main/AndroidManifest.xml
      • Add RECEIVE_BOOT_COMPLETED for reboot rescheduling by plugin.
      • Add SCHEDULE_EXACT_ALARM to allow exact timing on Android 12+.
    • lib/services/notification_service.dart
      • Create Android channels on init (subscription_channel, expiration_channel).
      • Use AndroidScheduleMode.exactAllowWhileIdle for scheduled notifications.
      • Ensure iOS DarwinNotificationDetails always present alert/sound/badge.
      • Fix local variable overshadowing method parameter (title).
      • Add canScheduleExactAlarms()/requestExactAlarmsPermission() wrappers.
    • lib/screens/settings_screen.dart
      • Add UI entry to request exact alarms permission when not granted (Android 12+).

Validation

  • Ran scripts/check.sh
    • Formatting check: OK
    • flutter analyze: No issues
    • flutter test: All tests passed
  • Manual assertions
    • Foreground iOS notifications display banners/sounds.
    • Android channels created proactively to avoid muted/low-importance.

Risk & Rollback

  • Risk
    • Android 12+: Exact alarms require user approval in Settings > Special access > Alarms & reminders.
    • Slight battery impact from exact alarms.
  • Rollback
    • Remove SCHEDULE_EXACT_ALARM and RECEIVE_BOOT_COMPLETED from AndroidManifest.
    • Switch schedule mode back to AndroidScheduleMode.inexact in NotificationService.

Notes

  • No dependency changes.
  • Reboot rescheduling relies on flutter_local_notifications standard behavior with RECEIVE_BOOT_COMPLETED.