diff --git a/CHANGELOG.md b/CHANGELOG.md index 44d20a0..ede1e86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,13 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- **Android**: `scheduleNotifications` batch API schedules one-shot notifications at epoch-ms timestamps using deterministic `api_` schedule IDs. -- **Android**: `clearPredictiveNotifications` cancels only API-managed schedules (`api_*`) without affecting Daily Reminders, user schedules, dual schedules, or fetch jobs. +- **Android / iOS**: `scheduleApiNotifications` batch API schedules one-shot notifications at epoch-ms timestamps using deterministic `api_` identifiers. +- **Android / iOS**: `clearApiNotifications` cancels or removes only API-managed notifications (`api_*`) without affecting Daily Reminders, user schedules, dual schedules, or fetch jobs. ### Changed -- **Android / iOS**: Internal batch notification ID namespace renamed from `predictive_` to `api_`. Public Capacitor method names are unchanged; scheduling and lifecycle behavior are unchanged. -- **TypeScript**: JSDoc for `scheduleNotifications` and `clearPredictiveNotifications` updated to document `api_*` identifiers. +- **Android / iOS**: Internal batch notification ID namespace renamed from `predictive_` to `api_`. Scheduling and lifecycle behavior are unchanged. +- **Breaking**: Public batch APIs renamed from `scheduleNotifications` / `clearPredictiveNotifications` / `clearAllNotifications` to `scheduleApiNotifications` / `clearApiNotifications`. +- **TypeScript**: JSDoc updated to document `api_*` identifiers and API terminology. ## [3.0.3] - 2026-05-22 @@ -29,13 +30,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- **iOS**: Predictive notification identifiers use epoch **milliseconds** (`predictive_`). Daily reminders persist `predictiveEpochMillis` for cancel/update alignment. -- **iOS**: `clearAllNotifications` removes only **`predictive_*`** pending and delivered notifications (dual/org IDs unchanged). -- **iOS**: `scheduleNotifications` is additive only (no automatic clear); skips stale timestamps in the past. +- **iOS**: API notification identifiers use epoch **milliseconds** (`api_`). Daily reminders persist `predictiveEpochMillis` for cancel/update alignment. +- **iOS**: `clearApiNotifications` removes only **`api_*`** pending and delivered notifications (dual/org IDs unchanged). +- **iOS**: `scheduleApiNotifications` is additive only (no automatic clear); skips stale timestamps in the past. ### Added -- **iOS**: `clearAllNotifications` and `scheduleNotifications` batch APIs on `DailyNotification` (Capacitor). +- **iOS**: `clearApiNotifications` and `scheduleApiNotifications` batch APIs on `DailyNotification` (Capacitor). ## [3.0.1] - 2026-04-16 diff --git a/android/src/main/java/org/timesafari/dailynotification/DailyNotificationPlugin.kt b/android/src/main/java/org/timesafari/dailynotification/DailyNotificationPlugin.kt index 9c93ffe..98ffe24 100644 --- a/android/src/main/java/org/timesafari/dailynotification/DailyNotificationPlugin.kt +++ b/android/src/main/java/org/timesafari/dailynotification/DailyNotificationPlugin.kt @@ -746,10 +746,10 @@ open class DailyNotificationPlugin : Plugin() { /** * Add one-shot API-managed notifications at epoch-ms timestamps (additive; does not clear others). - * Caller should invoke [clearPredictiveNotifications] first when replacing a full batch. + * Caller should invoke [clearApiNotifications] first when replacing a full batch. */ @PluginMethod - fun scheduleNotifications(call: PluginCall) { + fun scheduleApiNotifications(call: PluginCall) { val timestampsArray = call.getArray("timestamps") if (timestampsArray == null) { call.reject("Missing timestamps") @@ -761,7 +761,7 @@ open class DailyNotificationPlugin : Plugin() { if (context == null) { return@launch call.reject("Context not available") } - Log.i(TAG, "DNP-BATCH: scheduleNotifications — additive scheduling for ${timestampsArray.length()} timestamp(s)") + Log.i(TAG, "DNP-BATCH: scheduleApiNotifications — additive scheduling for ${timestampsArray.length()} timestamp(s)") var scheduledCount = 0 for (i in 0 until timestampsArray.length()) { @@ -775,7 +775,7 @@ open class DailyNotificationPlugin : Plugin() { } } - Log.i(TAG, "DNP-BATCH: scheduleNotifications done scheduled=$scheduledCount/${timestampsArray.length()}") + Log.i(TAG, "DNP-BATCH: scheduleApiNotifications done scheduled=$scheduledCount/${timestampsArray.length()}") call.resolve() } catch (e: Exception) { Log.e(TAG, "Failed to schedule notifications", e) @@ -789,7 +789,7 @@ open class DailyNotificationPlugin : Plugin() { * Does not affect Daily Reminders, user-created schedules, dual schedules, or fetch jobs. */ @PluginMethod - fun clearPredictiveNotifications(call: PluginCall) { + fun clearApiNotifications(call: PluginCall) { CoroutineScope(Dispatchers.IO).launch { try { if (context == null) { diff --git a/ios/Plugin/DailyNotificationPlugin.swift b/ios/Plugin/DailyNotificationPlugin.swift index 725a2cc..619e209 100644 --- a/ios/Plugin/DailyNotificationPlugin.swift +++ b/ios/Plugin/DailyNotificationPlugin.swift @@ -1121,9 +1121,9 @@ public class DailyNotificationPlugin: CAPPlugin { // MARK: - API batch notifications (replace-all UNUserNotificationCenter) /// Removes only pending and delivered notifications whose identifiers begin with `api_`. Does not touch dual/org IDs or other stacks. - @objc func clearAllNotifications(_ call: CAPPluginCall) { - NSLog("DNP-BATCH: clearAllNotifications — removing api_* pending and delivered only") - print("DNP-BATCH: clearAllNotifications — removing api_* pending and delivered only") + @objc func clearApiNotifications(_ call: CAPPluginCall) { + NSLog("DNP-BATCH: clearApiNotifications — removing api_* pending and delivered only") + print("DNP-BATCH: clearApiNotifications — removing api_* pending and delivered only") let center = notificationCenter let prefix = apiNotificationPrefix let group = DispatchGroup() @@ -1154,14 +1154,14 @@ public class DailyNotificationPlugin: CAPPlugin { /// Add one-shot reminders at epoch-ms timestamps. Does not remove other requests; identical IDs replace pending entries. Caller should clear first if needed. /// Adds/overwrites API-managed notifications using deterministic IDs. /// Does NOT clear existing notifications. Caller is responsible for lifecycle. - @objc func scheduleNotifications(_ call: CAPPluginCall) { + @objc func scheduleApiNotifications(_ call: CAPPluginCall) { guard let timestamps = call.getArray("timestamps", Double.self) else { call.reject("Missing timestamps") return } - NSLog("DNP-BATCH: scheduleNotifications — additive scheduling for \(timestamps.count) timestamp(s)") - print("DNP-BATCH: scheduleNotifications — additive scheduling for \(timestamps.count) timestamp(s)") + NSLog("DNP-BATCH: scheduleApiNotifications — additive scheduling for \(timestamps.count) timestamp(s)") + print("DNP-BATCH: scheduleApiNotifications — additive scheduling for \(timestamps.count) timestamp(s)") for ts in timestamps { let date = Date(timeIntervalSince1970: ts / 1000) @@ -2793,8 +2793,8 @@ extension DailyNotificationPlugin { methods.append(CAPPluginMethod(name: "updateDailyReminder", returnType: CAPPluginReturnPromise)) // API batch notifications (replace-all UNUserNotificationCenter) - methods.append(CAPPluginMethod(name: "clearAllNotifications", returnType: CAPPluginReturnPromise)) - methods.append(CAPPluginMethod(name: "scheduleNotifications", returnType: CAPPluginReturnPromise)) + methods.append(CAPPluginMethod(name: "clearApiNotifications", returnType: CAPPluginReturnPromise)) + methods.append(CAPPluginMethod(name: "scheduleApiNotifications", returnType: CAPPluginReturnPromise)) // Dual scheduling methods methods.append(CAPPluginMethod(name: "scheduleContentFetch", returnType: CAPPluginReturnPromise)) diff --git a/src/definitions.ts b/src/definitions.ts index 6107c04..f7dd239 100644 --- a/src/definitions.ts +++ b/src/definitions.ts @@ -604,14 +604,14 @@ export interface DailyNotificationPlugin { cancelAllNotifications(): Promise; /** * Add one-shot API-managed notifications at epoch-ms timestamps (additive). - * Android uses `api_` schedule IDs; caller should clear first when replacing a batch. + * Uses `api_` identifiers; caller should clear first when replacing a batch. */ - scheduleNotifications(options: { timestamps: number[] }): Promise; + scheduleApiNotifications(options: { timestamps: number[] }): Promise; /** - * Android only: cancel API-managed notification schedules (`api_*`) without - * affecting Daily Reminders, user schedules, dual schedules, or fetch jobs. + * Cancel API-managed notifications (`api_*`) without affecting Daily Reminders, + * user schedules, dual schedules, or fetch jobs. */ - clearPredictiveNotifications(): Promise; + clearApiNotifications(): Promise; getNotificationStatus(): Promise; updateSettings(settings: NotificationSettings): Promise; getBatteryStatus(): Promise; diff --git a/src/web.ts b/src/web.ts index 5d5f5cc..fda08ba 100644 --- a/src/web.ts +++ b/src/web.ts @@ -118,11 +118,11 @@ export class DailyNotificationWeb implements DailyNotificationPlugin { this.throwNotSupported(); } - async scheduleNotifications(): Promise { + async scheduleApiNotifications(): Promise { this.throwNotSupported(); } - async clearPredictiveNotifications(): Promise { + async clearApiNotifications(): Promise { this.throwNotSupported(); }