From 99065e835eeb3a2f2cec5f9c27cd83b8fb1144b6 Mon Sep 17 00:00:00 2001 From: Aleksandr Lozhkovoi Date: Sat, 23 May 2026 08:43:33 +0200 Subject: [PATCH] Migrate ios_books SceneDelegate for UIScene --- .../ios_books/IosBooks/SceneDelegate.swift | 47 +++++++++++++++++-- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/add_to_app/books/ios_books/IosBooks/SceneDelegate.swift b/add_to_app/books/ios_books/IosBooks/SceneDelegate.swift index a5cb47c5f..1c8670663 100644 --- a/add_to_app/books/ios_books/IosBooks/SceneDelegate.swift +++ b/add_to_app/books/ios_books/IosBooks/SceneDelegate.swift @@ -2,31 +2,68 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import Flutter import UIKit -class SceneDelegate: UIResponder, UIWindowSceneDelegate { +class SceneDelegate: UIResponder, UIWindowSceneDelegate, FlutterSceneLifeCycleProvider +{ + var sceneLifeCycleDelegate: FlutterPluginSceneLifeCycleDelegate = + FlutterPluginSceneLifeCycleDelegate() var window: UIWindow? func scene( - _ scene: UIScene, willConnectTo session: UISceneSession, + _ scene: UIScene, + willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions ) { - guard let _ = (scene as? UIWindowScene) else { return } + sceneLifeCycleDelegate.scene( + scene, + willConnectTo: session, + options: connectionOptions + ) } func sceneDidDisconnect(_ scene: UIScene) { + sceneLifeCycleDelegate.sceneDidDisconnect(scene) + } + + func sceneWillEnterForeground(_ scene: UIScene) { + sceneLifeCycleDelegate.sceneWillEnterForeground(scene) } func sceneDidBecomeActive(_ scene: UIScene) { + sceneLifeCycleDelegate.sceneDidBecomeActive(scene) } func sceneWillResignActive(_ scene: UIScene) { + sceneLifeCycleDelegate.sceneWillResignActive(scene) } - func sceneWillEnterForeground(_ scene: UIScene) { + func sceneDidEnterBackground(_ scene: UIScene) { + sceneLifeCycleDelegate.sceneDidEnterBackground(scene) } - func sceneDidEnterBackground(_ scene: UIScene) { + func scene( + _ scene: UIScene, + openURLContexts URLContexts: Set + ) { + sceneLifeCycleDelegate.scene(scene, openURLContexts: URLContexts) + } + + func scene(_ scene: UIScene, continue userActivity: NSUserActivity) { + sceneLifeCycleDelegate.scene(scene, continue: userActivity) + } + + func windowScene( + _ windowScene: UIWindowScene, + performActionFor shortcutItem: UIApplicationShortcutItem, + completionHandler: @escaping (Bool) -> Void + ) { + sceneLifeCycleDelegate.windowScene( + windowScene, + performActionFor: shortcutItem, + completionHandler: completionHandler + ) } }