feat!: rename batch APIs to scheduleApiNotifications and clearApiNotifications
BREAKING CHANGE: Replaces scheduleNotifications, clearPredictiveNotifications, and iOS clearAllNotifications. Behavior and api_ IDs unchanged.
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user