From cd32895281a79a61ddbb0d3b576f5beb3fab5a3b Mon Sep 17 00:00:00 2001 From: Jose Olarte III Date: Tue, 9 Jun 2026 19:39:50 +0800 Subject: [PATCH] refactor(notifications): use clearApiNotifications and scheduleApiNotifications Update the refresh replacement flow for the renamed plugin APIs and remove the obsolete clearPredictiveNotifications type augmentation. --- package-lock.json | 4 ++-- .../NativeNotificationService.ts | 22 ++++++------------- src/types/daily-notification-plugin.d.ts | 7 ------ 3 files changed, 9 insertions(+), 24 deletions(-) delete mode 100644 src/types/daily-notification-plugin.d.ts diff --git a/package-lock.json b/package-lock.json index 4c809823..c80605e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9923,8 +9923,8 @@ } }, "node_modules/@timesafari/daily-notification-plugin": { - "version": "3.0.4", - "resolved": "git+https://gitea.anomalistdesign.com/trent_larson/daily-notification-plugin.git#6de300b7d4d50eae8feef09ba9f7238c210866f0", + "version": "4.0.1", + "resolved": "git+https://gitea.anomalistdesign.com/trent_larson/daily-notification-plugin.git#5703d2a1e3be39587ed4a0a81837fbdb591e9d89", "license": "MIT", "workspaces": [ "packages/*" diff --git a/src/services/notifications/NativeNotificationService.ts b/src/services/notifications/NativeNotificationService.ts index e971a2e0..490a1591 100644 --- a/src/services/notifications/NativeNotificationService.ts +++ b/src/services/notifications/NativeNotificationService.ts @@ -707,17 +707,9 @@ export async function applyNotificationRefreshPayload( logScheduleReplacement(timestamps.length); - // Plugin API still exposes clearPredictiveNotifications(); it clears API-managed notifications only. - const plugin = DailyNotification as unknown as { - clearPredictiveNotifications?: () => Promise; - scheduleNotifications?: (options: { - timestamps: number[]; - }) => Promise; - }; - - if (typeof plugin.clearPredictiveNotifications !== "function") { + if (typeof DailyNotification.clearApiNotifications !== "function") { logger.warn( - "[NativeNotificationService] API notification clear unavailable (plugin clearPredictiveNotifications missing); cannot replace schedule", + "[NativeNotificationService] API notification clear unavailable (plugin clearApiNotifications missing); cannot replace schedule", ); logNotification( "Schedule replacement aborted (API notification clear unavailable on plugin)", @@ -726,20 +718,20 @@ export async function applyNotificationRefreshPayload( } logNotification("Clearing API notifications before refresh"); - await plugin.clearPredictiveNotifications(); + await DailyNotification.clearApiNotifications(); logNotification("Cleared API notifications"); - if (typeof plugin.scheduleNotifications !== "function") { + if (typeof DailyNotification.scheduleApiNotifications !== "function") { logger.warn( - "[NativeNotificationService] scheduleNotifications not available on plugin; cannot apply timestamps", + "[NativeNotificationService] scheduleApiNotifications not available on plugin; cannot apply timestamps", ); logNotification( - "Schedule replacement aborted (scheduleNotifications unavailable)", + "Schedule replacement aborted (scheduleApiNotifications unavailable)", ); return; } - await plugin.scheduleNotifications({ timestamps }); + await DailyNotification.scheduleApiNotifications({ timestamps }); logNotification( `Schedule replacement applied (${timestamps.length} timestamp(s))`, ); diff --git a/src/types/daily-notification-plugin.d.ts b/src/types/daily-notification-plugin.d.ts deleted file mode 100644 index e6a9bd58..00000000 --- a/src/types/daily-notification-plugin.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type {} from "@timesafari/daily-notification-plugin"; - -declare module "@timesafari/daily-notification-plugin" { - interface DailyNotificationPlugin { - clearPredictiveNotifications(): Promise; - } -}