- Add visual indicator when notification is received (shows for 30s)
- Poll notification status every 5 seconds to detect recent deliveries
- Add helpful message in test notification success about checking top of screen
- Improve user feedback for notification testing workflow
Fix configure() method to read parameters directly from CAPPluginCall
instead of expecting nested options object, matching Android implementation.
Improve build process to ensure canonical UI is always copied:
- iOS build script: Copy www/index.html to test app before build
- Android build.gradle: Add copyCanonicalUI task to run before build
- Ensures test apps always use latest UI from www/index.html
This fixes the issue where configure() was returning 'Configuration
options required' error because it expected a nested options object
when Capacitor passes parameters directly on the call object.
Implement UNUserNotificationCenterDelegate in AppDelegate to display
notifications when app is in foreground. Add visual feedback indicator
in test app UI to confirm notification delivery.
Changes:
- AppDelegate: Conform to UNUserNotificationCenterDelegate protocol
- AppDelegate: Implement willPresent and didReceive delegate methods
- AppDelegate: Set delegate at multiple lifecycle points to ensure
it's always active (immediate, after Capacitor init, on app active)
- UI: Add notification received indicator in status card
- UI: Add periodic check for notification delivery (every 5 seconds)
- UI: Add instructions on where to look for notification banner
- Docs: Add IOS_LOGGING_GUIDE.md for debugging iOS logs
This fixes the issue where scheduled notifications were not visible
when the app was in the foreground. The delegate method now properly
presents notifications with banner, sound, and badge options.
Verified working: Logs show delegate method called successfully when
notification fires, with proper presentation options set.
Fixed iOS 13.0 compatibility issue in test harness by replacing Logger
(iOS 14+) with os_log (iOS 13+). Fixed build script to correctly detect
and sync Capacitor config from App subdirectory. Unified both Android
and iOS test app UIs to use www/index.html as the canonical source.
Changes:
- DailyNotificationBackgroundTaskTestHarness: Replace Logger with os_log
for iOS 13.0 deployment target compatibility
- build-ios-test-app.sh: Fix Capacitor sync path detection to check
both current directory and App/ subdirectory for config files
- test-apps: Update both Android and iOS test apps to use www/index.html
as the canonical UI source for consistency
This ensures the plugin builds on iOS 13.0+ and both test apps provide
the same testing experience across platforms.
- Fix isChannelEnabled() to create channel if missing and re-fetch from system
to get actual state (handles previously blocked channels)
- Use correct channel ID 'timesafari.daily' instead of 'daily_notification_channel'
- Add detailed logging for channel status checks
- Fix UI to refresh channel status after notification permissions are granted
- Channel status now correctly reflects both app-level and channel-level settings
Static reminders scheduled via scheduleDailyNotification() with
isStaticReminder=true were being skipped because they don't have content
in storage - title/body are in Intent extras. Fixed by:
- DailyNotificationReceiver: Extract static reminder extras from Intent
and pass to WorkManager as input data
- DailyNotificationWorker: Check for static reminder flag in input data
and create NotificationContent from input data instead of loading from
storage
- DailyNotificationWorker: Ensure notification channel exists before
displaying (fixes "No Channel found" errors)
Also updated prefetch timing from 5 minutes to 2 minutes before notification
time in plugin code and web UI.
Fix documentation to address Xcode behavior where 'Simulate Background
Fetch' menu item only appears when app is NOT running.
Changes:
- Add explicit note about Xcode menu item availability
- Prioritize LLDB command method when app is running (recommended)
- Document three methods: LLDB command, Xcode menu, and UI button
- Add troubleshooting section for common issues
- Update quick start section to reference LLDB method
- Explicitly reference test-apps/ios-test-app path for clarity
This resolves confusion when 'Simulate Background Fetch' disappears
from Debug menu while app is running. LLDB command method works reliably
in all scenarios.
Add iOS prefetch testing guide with detailed procedures, log checklists,
and behavior classification. Enhance iOS test app requirements with
security constraints, sign-off checklists, and changelog structure.
Update main directive with testing strategy and method behavior mapping.
Changes:
- Add IOS_PREFETCH_TESTING.md with simulator/device test plans, log
diagnostics, telemetry expectations, and test run templates
- Add DailyNotificationBackgroundTaskTestHarness.swift as reference
implementation for BGTaskScheduler testing
- Enhance IOS_TEST_APP_REQUIREMENTS.md with security/privacy constraints,
review checklists, CI hints, and glossary cross-links
- Update 0003-iOS-Android-Parity-Directive.md with testing strategy
section, method behavior classification, and validation matrix updates
All documents now include changelog stubs, cross-references, and
completion criteria for Phase 1 implementation and testing.
Fixed scheduleDailyNotification to read parameters directly from CAPPluginCall
(matching Android pattern) instead of looking for wrapped "options" object.
Improved BGTaskScheduler error handling to clearly indicate simulator limitations.
Changes:
- Read parameters directly from call (call.getString("time"), etc.) instead of
call.getObject("options") - Capacitor passes options object directly as call data
- Improved BGTaskScheduler error handling with clear simulator limitation message
- Added priority parameter extraction (was missing)
- Error handling doesn't fail notification scheduling if background fetch fails
BGTaskScheduler Simulator Limitation:
- BGTaskSchedulerErrorDomain Code=1 (notPermitted) is expected on simulator
- Background fetch scheduling fails on simulator but works on real devices
- Notification scheduling still works correctly; prefetch won't run on simulator
- Error messages now clearly indicate this is expected behavior
Result: scheduleDailyNotification now works correctly. Notification scheduling
verified working on simulator. Background fetch error is expected and documented.
Files modified:
- ios/Plugin/DailyNotificationPlugin.swift: Parameter reading fix, error handling
- doc/directives/0003-iOS-Android-Parity-Directive.md: Implementation details documented
Capacitor iOS was not discovering DailyNotificationPlugin because it did not
conform to the CAPBridgedPlugin protocol required for runtime discovery.
Changes:
- Add @objc extension to DailyNotificationPlugin implementing CAPBridgedPlugin
with identifier, jsName, and pluginMethods properties
- Force-load plugin framework in AppDelegate before Capacitor initializes
- Remove duplicate BGTaskScheduler registration from AppDelegate (plugin handles it)
- Update podspec to use dynamic framework (static_framework = false)
- Add diagnostic logging to verify plugin discovery
Result: Plugin is now discovered by Capacitor and all methods are accessible
from JavaScript. Verified working with checkPermissionStatus() method.
Files modified:
- ios/Plugin/DailyNotificationPlugin.swift: Added CAPBridgedPlugin extension
- test-apps/ios-test-app/ios/App/App/AppDelegate.swift: Force-load + diagnostics
- ios/DailyNotificationPlugin.podspec: Dynamic framework setting
- doc/directives/0003-iOS-Android-Parity-Directive.md: Documented solution
Fix three critical issues in the Android notification system:
1. configureNativeFetcher() now actually calls nativeFetcher.configure() method
- Previously only stored config in database without configuring fetcher instance
- Added synchronous configure() call with proper error handling
- Stores valid but empty config entry if configure() fails to prevent downstream errors
- Adds FETCHER|CONFIGURE_START and FETCHER|CONFIGURE_COMPLETE instrumentation logs
2. Prefetch operations now use DailyNotificationFetchWorker instead of legacy FetchWorker
- Replaced FetchWorker.scheduleDelayedFetch() with WorkManager scheduling
- Uses correct input data format (scheduled_time, fetch_time, retry_count, immediate)
- Enables native fetcher SPI to be used for prefetch operations
- Handles both delayed and immediate prefetch scenarios
3. Notification dismiss now cancels notification from NotificationManager
- Added notification cancellation before removing from storage
- Uses notificationId.hashCode() to match display notification ID
- Ensures notification disappears immediately when dismiss button is clicked
- Adds DN|DISMISS_CANCEL_NOTIF instrumentation log
Version bump: 1.0.8 → 1.0.11
Fix issue where prefetch worker saved content to ContentCache but didn't
create NotificationContentEntity, causing notification worker to skip
notifications with "content_not_found" error.
Changes:
- Extract notificationTime from input data in doWork()
- Create NotificationContentEntity with matching notification_id when
notificationTime > 0 (prefetch operations)
- Add parsePayload() helper to extract title/body from JSON or plain text
- Save entity to Room database so notification worker can find it
The notification_id format matches NotifyReceiver.kt: "notify_${notificationTime}",
ensuring the notification worker can retrieve content when the alarm fires.
Fixes issue where alarms triggered correctly but notifications were skipped
because DailyNotificationWorker couldn't find content in storage.
Fix reflection-based permission check that was failing with NoSuchMethodException.
Add multiple fallback strategies to ensure permission check works reliably.
Changes:
- Add getDeclaredMethod() fallback when getMethod() fails
- Add heuristic fallback: if exact alarms not allowed, assume they can be requested
- Improve error handling: catch NoSuchMethodException separately from other exceptions
- Add debug logging to track which reflection path is taken
- Change reflection failure log level from ERROR to WARNING (we have fallback)
The heuristic fallback is safe because:
- If exact alarms are not currently allowed, we should try to request them
- Only edge case is permanently denied (rare), worst case is unnecessary Settings redirect
- Better than failing silently or blocking permission requests
Fixes reflection failures seen in logcat where Settings.canRequestScheduleExactAlarms()
method lookup was failing, causing unnecessary Settings redirects.
Add comprehensive exact alarm permission handling for Android 12+ (API 31+)
and fix critical bugs preventing notifications from triggering.
Features:
- Add checkExactAlarmPermission() and requestExactAlarmPermission() plugin methods
- Add canScheduleExactAlarms() and canRequestExactAlarmPermission() helper methods
- Update all scheduling methods to check/request permission before scheduling
- Use reflection for canRequestScheduleExactAlarms() to avoid compilation issues
Bug Fixes:
- Fix receiver mismatch: change alarm intents from NotifyReceiver to DailyNotificationReceiver
- Fix coroutine compilation error: wrap getLatest() suspend call in runBlocking
- Store notification content in database before scheduling alarms
- Update intent action to match manifest registration
The permission request flow opens Settings intent when SCHEDULE_EXACT_ALARM
permission is not granted, providing clear user guidance. All scheduling
methods now check permission status and request it if needed before proceeding.
Version bumped to 1.0.8
- 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.
- Fix MainActivity ClassNotFoundException by using dynamic package launcher intent
- Replace hardcoded MainActivity class references with getLaunchIntent() helper
- Uses packageManager.getLaunchIntentForPackage() to work with any host app
- Removes dependency on specific MainActivity package/class name
- Fixes 3 occurrences in NotifyReceiver.kt (alarm clock, notification click, reminder click)
- Add exact alarm permission check before scheduling (Android 12+)
- Add canScheduleExactAlarms() helper to check SCHEDULE_EXACT_ALARM permission
- Check permission before scheduling exact alarms in scheduleExactNotification()
- Gracefully fall back to inexact alarms when permission not granted
- Prevents SecurityException and provides clear logging
- Bump version to 1.0.2
Fixes:
- ClassNotFoundException when plugin tries to resolve hardcoded MainActivity path
- SecurityException on Android 12+ when exact alarm permission not granted
- Plugin now works with any host app regardless of MainActivity package/class
All changes maintain backward compatibility and improve reliability.
The Vue test app was missing the NotifyReceiver registration in
AndroidManifest.xml, preventing alarm broadcasts from being delivered
to the BroadcastReceiver. This caused notifications scheduled via
setAlarmClock() to fire but not display.
Added NotifyReceiver registration matching the working android-test-app
configuration. Also includes supporting improvements:
- Enhanced alarm scheduling with setAlarmClock() for Doze exemption
- Unique request codes based on trigger time to prevent PendingIntent conflicts
- Diagnostic methods (isAlarmScheduled, getNextAlarmTime, testAlarm)
- TypeScript definitions for new methods
Verified: Notification successfully fired at 09:41:00 and was displayed.
- Add handleOnResume() fallback to resolve permission requests when
Capacitor Bridge doesn't route results (requestCode 1001)
- Implement checkPermissions() with override modifier for Capacitor
standard PermissionStatus format
- Implement getExactAlarmStatus() to return exact alarm capability info
- Implement updateStarredPlans() to store plan IDs in SharedPreferences
- Fix requestPermissions() override to properly delegate to
requestNotificationPermissions()
- Fix handleRequestPermissionsResult() return type to Unit
These changes ensure permission requests resolve correctly even when
Capacitor's Bridge doesn't recognize our custom request code, and
implement all missing methods called by the test application.
- Fix cron parsing to correctly calculate next run time based on hour/minute
- Always schedule prefetch 5 minutes before notification (even without URL)
- Make notifications dismissable with setAutoCancel(true)
- Add click action to launch app when notification is tapped
- Conditionally require network only when URL is provided for prefetch
- Generate mock content when no URL is specified
These changes ensure notifications fire at the correct time, are
user-friendly (dismissable and clickable), and prefetch works reliably
even without a content URL.
Restructure Android project from nested module layout to standard
Capacitor plugin structure following community conventions.
Structure Changes:
- Move plugin code from android/plugin/ to android/src/main/java/
- Move test app from android/app/ to test-apps/android-test-app/app/
- Remove nested android/plugin module structure
- Remove nested android/app test app structure
Build Infrastructure:
- Add Gradle wrapper files (gradlew, gradlew.bat, gradle/wrapper/)
- Transform android/build.gradle from root project to library module
- Update android/settings.gradle for standalone plugin builds
- Add android/gradle.properties with AndroidX configuration
- Add android/consumer-rules.pro for ProGuard rules
Configuration Updates:
- Add prepare script to package.json for automatic builds on npm install
- Update package.json version to 1.0.1
- Update android/build.gradle to properly resolve Capacitor dependencies
- Update test-apps/android-test-app/settings.gradle with correct paths
- Remove android/variables.gradle (hardcode values in build.gradle)
Documentation:
- Update BUILDING.md with new structure and build process
- Update INTEGRATION_GUIDE.md to reflect standard structure
- Update README.md to remove path fix warnings
- Add test-apps/BUILD_PROCESS.md documenting test app build flows
Test App Configuration:
- Fix android-test-app to correctly reference plugin and Capacitor
- Remove capacitor-cordova-android-plugins dependency (not needed)
- Update capacitor.settings.gradle path verification in fix script
BREAKING CHANGE: Plugin now uses standard Capacitor Android structure.
Consuming apps must update their capacitor.settings.gradle to reference
android/ instead of android/plugin/. This is automatically handled by
Capacitor CLI for apps using standard plugin installation.
The /api/v2/report/plansLastUpdatedBetween endpoint requires the afterId
parameter. When no previous jwtId is stored, default to "0" for the first
request. This ensures afterId is always present and never null/omitted.
Fix resolves "afterId parameter is required" API errors. Verified working:
prefetch execution shows request body includes afterId: "0" and API returns
HTTP 200 successfully.
Remove the aud (audience) claim from JWT payloads. The server's did-jwt
verification requires an audience option when aud is present, but the server
isn't configured to validate it, causing "JWT audience is required but your
app address has not been configured" errors.
Changes:
- Removed aud claim from JWT payload in generateEndorserJWT()
- Updated key derivation to User Zero's specific path (m/84737769'/0'/0'/0')
- Added public key verification against expected User Zero key
- Enhanced JWT diagnostics logging throughout
- Added alarm deduplication optimization (prevent duplicate alarms for same time)
Verified: JWT validation now passes (token length 360→333 chars, no audience
error). New error is API parameter validation (afterId required - separate issue).
Move native fetcher configuration from App.vue mounted() to HomeView.vue
onMounted() because App.vue's mounted hook was not executing reliably,
likely due to Vue router lifecycle timing.
Changes:
- App.vue: Remove non-executing configuration code, add note explaining move
- HomeView.vue: Add configureNativeFetcher() function with full configuration
flow including ES256K JWT generation, API URL setup, and starred plans update
- Add nativeFetcherConfigured ref to prevent duplicate configuration attempts
- Wrap starred plans update in try-catch (non-blocking if it fails)
This fixes the issue where TestNativeFetcher was not being configured,
causing all prefetch operations to fail with "Not configured" error and
fall back to emergency content.
Verified: Configuration now executes successfully on HomeView mount,
TestNativeFetcher shows "Configured with API" in logcat.
Add detailed logging when cancelling existing alarms to aid in
debugging notification scheduling issues. Logs now indicate whether
an existing alarm was found and cancelled, or if no alarm existed.
This improves observability when investigating duplicate notifications
or scheduling conflicts.
Implement unique work names to prevent duplicate WorkManager tasks
from being enqueued when multiple notifications are scheduled for
the same time or when the receiver is triggered multiple times.
Changes:
- DailyNotificationReceiver: Use enqueueUniqueWork with unique names
("display_{id}", "dismiss_{id}") and ExistingWorkPolicy.KEEP/REPLACE
- DailyNotificationFetcher: Use unique work names based on scheduled
time rounded to minutes ("fetch_{minutes}") with ExistingWorkPolicy.REPLACE
This resolves the issue where ~25+ concurrent workers were being
enqueued for the same notification, leading to race conditions and
resource waste. Now only one worker processes each notification/fetch
at a time.
Verified in logcat: Worker count reduced from 25+ to 1 per notification.
- Update JWT section to reflect current status:
- JWT Generation: ✅ COMPLETE (TypeScript generates ES256K correctly)
- JWT Verification: 🟡 PARTIAL (generation works, server verification fails)
- Document verification issue:
- Error: 'no matching public key found'
- Root cause: Server cannot resolve DID to get public key
- JWT signature is cryptographically valid
- Issue is DID resolution, not JWT generation
- Add verification status table:
- Component-level status breakdown
- Clear distinction between generation (✅) and verification (❌)
- Add next steps checklist:
- Verify DID registration on resolver
- Test with known DID
- Check server resolver config
- Verify test API server supports DID-based JWT verification
- Update implementation status:
- Mark TypeScript JWT generation as complete
- Mark DID resolution as pending verification
- Remove outdated HMAC-SHA256 references
- Fix TestNativeFetcher to read from same SharedPreferences as plugin
- Changed PREFS_NAME from 'DailyNotificationPrefs' to 'daily_notification_timesafari'
- Changed KEY_STARRED_PLAN_IDS from 'starred_plan_ids' to 'starredPlanIds'
- Updated getStarredPlanIds() to read from plugin's SharedPreferences location
- Added diagnostic logging for plan ID loading
- Add updateStarredPlans() call in App.vue mounted() hook
- Ensures starred plan IDs are persisted to native storage on app startup
- Allows native fetcher to read plan IDs from SharedPreferences
- Added diagnostic logging for configuration flow
- Document cross-platform storage pattern
- Created docs/CROSS_PLATFORM_STORAGE_PATTERN.md with architecture flow
- Documented TypeScript → Capacitor bridge → Plugin → Native storage → Native fetcher flow
- Added iOS implementation checklist with code examples
- Clarified why native storage is needed (background workers can't use bridge)
- Add JWT generation logging to test-user-zero.ts
- Log JWT algorithm (ES256K) and DID when token is generated
- Helps diagnose JWT verification issues
Fixes:
- Empty planIds array in native fetcher requests
- SharedPreferences key mismatch between plugin and native fetcher
- Missing documentation for iOS implementation
All changes maintain backward compatibility.
- Move native fetcher configuration from HomeView.vue to App.vue mounted() hook
- Single source of truth for configuration on app startup
- Removed duplicate configuration logic from HomeView
- Added diagnostic logging to trace configuration flow
- Fix ES module compatibility issue with Capacitor CLI
- Replace direct logger import with lazy async loading in test-user-zero.ts
- Prevents 'exports is not defined' error when Capacitor CLI loads config
- Update refreshToken() and setBaseUrl() methods to async for logger access
- Add centralized logger utility (src/lib/logger.ts)
- Single ESLint whitelist location for console usage
- Structured logging with levels and emoji support
- Updated router/index.ts and stores/app.ts to use logger
- Enhance Android notification deduplication
- Add within-batch duplicate detection in fetch workers
- Improve storage deduplication with alarm cancellation
- Cancel alarms for removed duplicate notifications
- Update UserZeroView.vue to await async refreshToken() call
Fixes:
- npx cap sync android ES module error
- Duplicate notification accumulation
- Console statement lint warnings
All changes maintain backward compatibility and improve debugging visibility.
Fix critical bug where NotificationContent deserializer was corrupting
notification data every time storage was loaded:
1. Deserializer was creating new NotificationContent() which:
- Generated new random UUIDs (losing original IDs)
- Set fetchedAt to current time (losing original timestamps)
- Caused excessive debug logging (40+ log lines per load)
2. This caused:
- Notifications to appear as 'new' on every app restart
- Duplicate notification detection to fail (different IDs)
- Log spam making debugging difficult
- 40+ notifications accumulating over time
Changes:
- Add package-private constructor NotificationContent(id, fetchedAt) to
preserve original data during deserialization
- Update NotificationContentDeserializer to read fetchedAt from JSON
and use new constructor to preserve original values
- Remove excessive constructor logging that caused log spam
- Preserve notification IDs during deserialization
This ensures notifications maintain their original identity and timestamps
when loaded from persistent storage, preventing data corruption and
duplicate accumulation.
Fixes issue where prefetch correctly skipped but 40+ notifications
accumulated due to deserializer corruption.
Add eslint-disable-next-line comments for intentional console.log statements
in test configuration and router files. These console statements are
intentional for debugging and testing purposes.
Files updated:
- test-user-zero.ts: 5 console statements suppressed
- router/index.ts: 2 console statements suppressed
All lint warnings resolved.
Add configureNativeFetcher() plugin method to enable TypeScript configuration
of native fetchers with API credentials. This provides a cross-platform
mechanism for passing configuration from JavaScript to native code without
relying on platform-specific storage.
- Add configure() method to NativeNotificationContentFetcher interface
(optional, defaults to no-op for fetchers that don't need config)
- Add configureNativeFetcher plugin method in DailyNotificationPlugin
- Add TypeScript definitions and comprehensive JSDoc
- Create NATIVE_FETCHER_CONFIGURATION.md documentation
- Update TestNativeFetcher to use real API endpoint (10.0.2.2:3000)
- Update DemoNativeFetcher Javadoc explaining configure() is optional
- Add configureNativeFetcher() call to demo app's configurePlugin()
Enables host apps to configure native fetchers from TypeScript, keeping
the interface consistent across Android, iOS, and web platforms.
Add duplicate checking in handleSuccessfulFetch() to ensure one prefetch
creates at most one notification per scheduled time. This prevents prefetch
from creating duplicate notifications when a manual notification already
exists for the same time.
- Check existing notifications before saving prefetch-created content
- Skip notification creation if duplicate found (within 1 minute tolerance)
- Add null check for fetcher in scheduleBackgroundFetch() with error logging
- Log skipped duplicates for debugging
Ensures one prefetch → one notification pairing and prevents duplicate
notifications from firing at the same time.