halkyon/apps/todo/halkyon_todo_flutter/ios/Runner/AppDelegate.swift
Tizian 「ティツィアーン」 e26ba47fb9
feat(todo): Snooze on a reminder on iOS, macOS and Windows (ADR 0033, D4)
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>
2026-11-01 21:57:00 +01:00

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)
}
}