Files
daily-notification-plugin/doc/_archive/2025-legacy-doc/IOS_PHASE1_QUICK_REFERENCE.md

3.1 KiB

iOS Phase 1 Quick Reference

Status: PHASE 1 COMPLETE
Quick reference for developers working with iOS implementation


File Structure

Core Components

ios/Plugin/
├── DailyNotificationPlugin.swift          # Main plugin (1157 lines)
├── DailyNotificationStorage.swift         # Storage abstraction (334 lines)
├── DailyNotificationScheduler.swift       # Scheduler (322 lines)
├── DailyNotificationStateActor.swift      # Thread-safe state (211 lines)
├── DailyNotificationErrorCodes.swift      # Error codes (113 lines)
├── NotificationContent.swift              # Data model (238 lines)
└── DailyNotificationDatabase.swift        # Database (241 lines)

Key Methods (Phase 1)

Configuration

@objc func configure(_ call: CAPPluginCall)

Core Notification Methods

@objc func scheduleDailyNotification(_ call: CAPPluginCall)
@objc func getLastNotification(_ call: CAPPluginCall)
@objc func cancelAllNotifications(_ call: CAPPluginCall)
@objc func getNotificationStatus(_ call: CAPPluginCall)
@objc func updateSettings(_ call: CAPPluginCall)

Error Codes

DailyNotificationErrorCodes.NOTIFICATIONS_DENIED
DailyNotificationErrorCodes.INVALID_TIME_FORMAT
DailyNotificationErrorCodes.SCHEDULING_FAILED
DailyNotificationErrorCodes.PLUGIN_NOT_INITIALIZED
DailyNotificationErrorCodes.MISSING_REQUIRED_PARAMETER

Log Prefixes

  • DNP-PLUGIN: - Main plugin operations
  • DNP-FETCH: - Background fetch operations
  • DNP-FETCH-SCHEDULE: - BGTask scheduling
  • DailyNotificationStorage: - Storage operations
  • DailyNotificationScheduler: - Scheduling operations

Testing

Primary Guide: doc/IOS_PHASE1_TESTING_GUIDE.md

Quick Test:

// Schedule notification
await DailyNotification.scheduleDailyNotification({
  options: {
    time: "09:00",
    title: "Test",
    body: "Test notification"
  }
});

// Check status
const status = await DailyNotification.getNotificationStatus();

Common Debugging Commands

Xcode Debugger:

// Check pending notifications
po UNUserNotificationCenter.current().pendingNotificationRequests()

// Check permissions
po await UNUserNotificationCenter.current().notificationSettings()

// Manually trigger BGTask (Simulator only)
e -l objc -- (void)[[BGTaskScheduler sharedScheduler] _simulateLaunchForTaskWithIdentifier:@"org.timesafari.dailynotification.fetch"]

Phase 1 Scope

Implemented:

  • Single daily schedule (one prefetch + one notification)
  • Permission auto-healing
  • BGTask miss detection
  • Thread-safe state access
  • Error code matching

Deferred to Phase 2:

  • Rolling window (beyond single daily)
  • TTL enforcement
  • Reboot recovery (full implementation)
  • Power management

Deferred to Phase 3:

  • JWT authentication
  • ETag caching
  • TimeSafari API integration

References

  • Directive: doc/directives/0003-iOS-Android-Parity-Directive.md
  • Testing Guide: doc/IOS_PHASE1_TESTING_GUIDE.md
  • Completion Summary: doc/PHASE1_COMPLETION_SUMMARY.md