fix(notifications): clear scheduled notifications before refresh apply

Cancel all native notifications before applying the backend-provided schedule so
refreshNotifications always performs a full replacement and never leaves stale
entries behind.
This commit is contained in:
Jose Olarte III
2026-05-06 16:45:56 +08:00
parent 7c8ef284c2
commit 1cd329c720

View File

@@ -585,6 +585,10 @@ export async function refreshNotifications(): Promise<void> {
return;
}
// Full replacement: clear prior scheduled notifications before applying backend schedule.
// (Plugin API name is cancelAllNotifications; equivalent intent to "clearAllNotifications".)
await DailyNotification.cancelAllNotifications();
// Apply backend schedule to the native scheduler as recurring notifications.
// The plugin's schedule API is cron/clockTime-based (recurring), so we map
// the backend timestamps to clockTime (HH:mm) schedules.