Apple's systems take actions from categories registered at start: one for each length a snooze can be, its action in the language the app starts in, not to the foreground, so that iOS snoozes in the plugin's isolate with the app closed (AppDelegate registers the plugins for it). Windows hands back only the button's arguments, which carry the notification's ID and payload. macOS and Windows launch the app for an action while it is closed, and the gateway snoozes what launched it as it starts. Not yet tried on any of the three devices. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
26 lines
1.1 KiB
Swift
26 lines
1.1 KiB
Swift
import Flutter
|
|
import UIKit
|
|
import UserNotifications
|
|
// For FlutterLocalNotificationsPlugin.setPluginRegistrantCallback.
|
|
import flutter_local_notifications
|
|
|
|
@main
|
|
@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate {
|
|
override func application(
|
|
_ application: UIApplication,
|
|
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
|
) -> Bool {
|
|
// Reminders show while the app is open too (flutter_local_notifications).
|
|
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
|
|
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
|
}
|
|
|
|
func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) {
|
|
// A reminder snoozed with the app closed is scheduled again in an
|
|
// isolate of the plugin's, which needs the plugins too (ADR 0033, D4).
|
|
FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { (registry) in
|
|
GeneratedPluginRegistrant.register(with: registry)
|
|
}
|
|
GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)
|
|
}
|
|
}
|