A cross platform Audiobookshelf client for Android and iOS
Dart
Fix iOS quick actions
Barnabas3e2d9c677918
diff --git a/ios/Runner/SceneDelegate.swift b/ios/Runner/SceneDelegate.swiftindex 8a44865b..42652db2 100644--- a/ios/Runner/SceneDelegate.swift+++ b/ios/Runner/SceneDelegate.swift@@ -5,6 +5,11 @@ import UIKitclass SceneDelegate: UIResponder, UIWindowSceneDelegate {var window: UIWindow?+ // Stash a cold-launch shortcut so we can fire it once Dart is ready (in+ // sceneDidBecomeActive). Forwarding straight from willConnectTo would race+ // the Flutter engine before the QuickActionsService listener is set up.+ private var pendingShortcut: UIApplicationShortcutItem?+func scene(_ scene: UIScene, willConnectTo session: UISceneSession,options connectionOptions: UIScene.ConnectionOptions) {guard let windowScene = scene as? UIWindowScene else { return }@@ -19,10 +24,46 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {if let url = connectionOptions.urlContexts.first?.url {_ = UIApplication.shared.delegate?.application?(UIApplication.shared, open: url, options: [:])}++ // Cold-launch via app-icon long-press shortcut. iOS delivers it here for+ // scene-based apps, NOT through the app delegate's launchOptions. Stash+ // it and play it back in sceneDidBecomeActive so the Flutter engine is+ // ready by the time we forward to plugins.+ if let shortcut = connectionOptions.shortcutItem {+ pendingShortcut = shortcut+ }}func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {guard let url = URLContexts.first?.url else { return }_ = UIApplication.shared.delegate?.application?(UIApplication.shared, open: url, options: [:])}++ func sceneDidBecomeActive(_ scene: UIScene) {+ if let shortcut = pendingShortcut {+ pendingShortcut = nil+ forwardShortcut(shortcut)+ }+ }++ // Warm-launch via shortcut. iOS 13+ scene-based apps get the shortcut here+ // rather than on the app delegate.+ func windowScene(_ windowScene: UIWindowScene,+ performActionFor shortcutItem: UIApplicationShortcutItem,+ completionHandler: @escaping (Bool) -> Void) {+ forwardShortcut(shortcutItem)+ completionHandler(true)+ }++ /// Forward a shortcut tap to the AppDelegate so its registered Flutter+ /// plugins (notably quick_actions_ios) can pick it up. iOS only calls+ /// this method on the actual scene delegate, so the plugin's own scene+ /// handler never fires unless we relay it here.+ private func forwardShortcut(_ shortcut: UIApplicationShortcutItem) {+ _ = UIApplication.shared.delegate?.application?(+ UIApplication.shared,+ performActionFor: shortcut,+ completionHandler: { _ in }+ )+ }}