import { Capacitor } from "@capacitor/core"; import { DailyNotification } from "@/plugins/DailyNotificationPlugin"; import { logger } from "@/utils/logger"; /** * Pushes starred plan handle IDs to the native Daily Notification plugin so * Android TimeSafariNativeFetcher uses the current list for prefetch * (plansLastUpdatedBetween planIds). * * No-op on web. Ignores UNIMPLEMENTED when the plugin omits the method on some builds. */ export async function syncStarredPlansToNativePlugin( planIds: string[], ): Promise { if (!Capacitor.isNativePlatform()) { return; } try { await DailyNotification.updateStarredPlans({ planIds }); } catch (e: unknown) { if ((e as { code?: string })?.code === "UNIMPLEMENTED") { return; } logger.warn( "[syncStarredPlansToNativePlugin] updateStarredPlans failed", e, ); } }