refactor: text streaming

This commit is contained in:
cogwheel0
2025-09-13 10:16:58 +05:30
parent d903e795d9
commit 7e6009d2cc
16 changed files with 719 additions and 348 deletions

View File

@@ -145,8 +145,16 @@ class BackgroundStreamingHandler: NSObject {
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
// Setup background streaming handler manually
if let controller = window?.rootViewController as? FlutterViewController {
// Setup background streaming handler with scene-safe rootViewController access
var controller: FlutterViewController?
if let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
let root = scene.windows.first?.rootViewController as? FlutterViewController {
controller = root
} else if let legacy = window?.rootViewController as? FlutterViewController {
controller = legacy
}
if let controller {
let channel = FlutterMethodChannel(
name: "conduit/background_streaming",
binaryMessenger: controller.binaryMessenger