Browse Source

fix: Store starred plans in SharedPreferences when configuring native fetcher

- Add updateStarredPlans call in configureNativeFetcher to store starred
  plan IDs in SharedPreferences for the native fetcher to use
- Clear starred plans if none provided to ensure state consistency
- Add starredPlansCount to configuration log for debugging

This fixes the issue where the native fetcher was querying the API
with an empty planIds array because starred plans weren't being stored
in SharedPreferences. Now when configureNativeFetcher is called with
starredPlanHandleIds, they are properly stored and available for
background prefetch operations.

Also updates package-lock.json for daily-notification-plugin v1.0.11.
pull/214/head
Matthew Raymer 2 days ago
parent
commit
2deb84aa42
  1. 2
      package-lock.json
  2. 23
      src/services/platforms/CapacitorPlatformService.ts

2
package-lock.json

@ -152,7 +152,7 @@
}, },
"../daily-notification-plugin": { "../daily-notification-plugin": {
"name": "@timesafari/daily-notification-plugin", "name": "@timesafari/daily-notification-plugin",
"version": "1.0.8", "version": "1.0.11",
"license": "MIT", "license": "MIT",
"workspaces": [ "workspaces": [
"packages/*" "packages/*"

23
src/services/platforms/CapacitorPlatformService.ts

@ -1716,11 +1716,34 @@ export class CapacitorPlatformService
jwtToken, jwtToken,
}); });
// Step 5: Update starred plans if provided
// This stores the starred plan IDs in SharedPreferences for the native fetcher
if (
config.starredPlanHandleIds &&
config.starredPlanHandleIds.length > 0
) {
await DailyNotification.updateStarredPlans({
planIds: config.starredPlanHandleIds,
});
logger.info(
`[CapacitorPlatformService] Updated starred plans: ${config.starredPlanHandleIds.length} plans`,
);
} else {
// Clear starred plans if none provided
await DailyNotification.updateStarredPlans({
planIds: [],
});
logger.info(
"[CapacitorPlatformService] Cleared starred plans (none provided)",
);
}
logger.info("[CapacitorPlatformService] Configured native fetcher", { logger.info("[CapacitorPlatformService] Configured native fetcher", {
activeDid, activeDid,
apiServer, apiServer,
tokenExpirationHours: 72, tokenExpirationHours: 72,
tokenExpirationMinutes: expirationMinutes, tokenExpirationMinutes: expirationMinutes,
starredPlansCount: config.starredPlanHandleIds?.length || 0,
}); });
} catch (error) { } catch (error) {
logger.error( logger.error(

Loading…
Cancel
Save