forked from trent_larson/crowd-funder-for-time-pwa
feat: implement 72-hour JWT token refresh for daily notification plugin
- Add accessTokenForBackground() with 72-hour default expiration - Supports offline-first prefetch operations - Balances security with offline capability - Implement proactive token refresh strategy - Refresh on component mount (DailyNotificationSection) - Refresh on app resume (Capacitor 'resume' event) - Refresh when notifications are enabled - Automatic refresh without user interaction - Update CapacitorPlatformService.configureNativeFetcher() - Automatically retrieves activeDid from database - Generates 72-hour JWT tokens for background operations - Includes starred plans in configuration - Add BroadcastReceivers to AndroidManifest.xml - DailyNotificationReceiver for scheduled notifications - BootReceiver for rescheduling after device reboot - Add comprehensive documentation - JSDoc comments for all token-related functions - Inline comments explaining refresh strategy - Documentation section on authentication & token management Benefits: - No app wake-up required (refresh when app already open) - Works offline (72-hour validity supports extended periods) - Automatic (no user interaction required) - Graceful degradation (uses cached content if refresh fails)
This commit is contained in:
@@ -36,6 +36,30 @@
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
|
||||
<!-- Daily Notification Plugin Receivers -->
|
||||
<receiver
|
||||
android:name="com.timesafari.dailynotification.DailyNotificationReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.timesafari.daily.NOTIFICATION" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name="com.timesafari.dailynotification.BootReceiver"
|
||||
android:directBootAware="true"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter android:priority="1000">
|
||||
<!-- Delivered very early after reboot (before unlock) -->
|
||||
<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
|
||||
<!-- Delivered after the user unlocks / credential-encrypted storage is available -->
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
<!-- Delivered after app update; great for rescheduling alarms without reboot -->
|
||||
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
|
||||
<!-- Permissions -->
|
||||
|
||||
@@ -35,10 +35,6 @@
|
||||
"pkg": "@capawesome/capacitor-file-picker",
|
||||
"classpath": "io.capawesome.capacitorjs.plugins.filepicker.FilePickerPlugin"
|
||||
},
|
||||
{
|
||||
"pkg": "@timesafari/daily-notification-plugin",
|
||||
"classpath": "com.timesafari.dailynotification.DailyNotificationPlugin"
|
||||
},
|
||||
{
|
||||
"pkg": "@timesafari/daily-notification-plugin",
|
||||
"classpath": "com.timesafari.dailynotification.DailyNotificationPlugin"
|
||||
|
||||
Reference in New Issue
Block a user