Files
daily-notification-plugin/ios/Plugin
Matthew Raymer bdee842ea9 feat(ios): implement isAlarmScheduled, getNextAlarmTime, and testAlarm methods
Implemented alarm status and testing methods matching Android functionality:

isAlarmScheduled():
- Checks if notification is scheduled for given trigger time
- Searches pending notifications for matching trigger date
- Uses 1-minute tolerance for time comparison
- Returns scheduled status and triggerAtMillis

getNextAlarmTime():
- Gets the next scheduled notification time
- Finds earliest scheduled daily notification
- Returns scheduled status and triggerAtMillis (or just scheduled: false)

testAlarm():
- Schedules test notification for testing purposes
- Defaults to 5 seconds from now (configurable)
- Creates test notification with title and body
- Returns scheduled status, secondsFromNow, and triggerAtMillis
- Useful for verifying notification delivery works

iOS Adaptations:
- Uses UNCalendarNotificationTrigger for scheduling
- Searches pending notifications to check status
- Date component matching for precise scheduling

Progress: 30/52 methods implemented (58% complete)
2025-11-11 02:12:35 -08:00
..

iOS Implementation

This directory contains the iOS-specific implementation of the DailyNotification plugin.

Current Implementation Status

IMPLEMENTED:

  • Basic plugin structure (DailyNotificationPlugin.swift)
  • UserDefaults for local data storage
  • Power management (DailyNotificationPowerManager.swift)
  • Battery optimization handling
  • iOS notification categories and actions

NOT IMPLEMENTED (Planned):

  • BGTaskScheduler for background data fetching
  • Background task management
  • Silent push nudge support
  • Tlead prefetch logic

Implementation Details

The iOS implementation currently uses:

  • UNUserNotificationCenter for notification management
  • UserDefaults for local data storage
  • iOS notification categories and actions
  • Power management and battery optimization

Planned additions:

  • BGTaskScheduler for background data fetching
  • Background task management
  • Silent push support

Native Code Location

The native iOS implementation is located in the ios/ directory at the project root.

Key Components

  1. DailyNotificationPlugin.swift: Main plugin class
  2. DailyNotificationPowerManager.swift: Power state management
  3. DailyNotificationConfig.swift: Configuration options
  4. DailyNotificationMaintenanceWorker.swift: Maintenance tasks
  5. DailyNotificationLogger.swift: Logging system

Missing Components (Planned):

  • BackgroundTaskManager.swift: Handles background fetch scheduling
  • NotificationManager.swift: Manages notification creation and display
  • DataStore.swift: Handles local data persistence

Implementation Notes

  • Uses UserDefaults for lightweight data storage
  • Implements proper battery optimization handling
  • Supports iOS notification categories and actions
  • Handles background refresh limitations

Planned Features:

  • BGTaskScheduler for reliable background execution
  • Silent push notification support
  • Background task budget management

Testing

Run iOS-specific tests with:

npm run test:ios