mirror of
https://github.com/cogwheel0/conduit.git
synced 2026-10-19 09:43:36 +00:00
Some checks failed
CI / Mobile app (analyze + test) (push) Has been cancelled
CI / Dart packages (push) Has been cancelled
CI / Dart packages-1 (push) Has been cancelled
CI / Dart packages-2 (push) Has been cancelled
CI / Dart packages-3 (push) Has been cancelled
CI / Web-safe packages (push) Has been cancelled
CI / Localization (push) Has been cancelled
Split ios/Runner/AppDelegate.swift into one file per bridge and put the bridges behind a host-neutral ConduitBridgeHost protocol, so each bridge can be tested and reused without the Flutter view controller. The boundary check in tool/check_package_boundaries.dart now holds every Swift file in ios/Runner to one side of that seam. No intended behaviour change. Review follow-ups: an expiring streaming background task that keepAlive already replaced no longer reports a suspension, and the Send Image App Intent rejects files that do not resolve to an image type.
37 lines
1.1 KiB
Swift
37 lines
1.1 KiB
Swift
import Flutter
|
|
import UIKit
|
|
|
|
// FLUTTER HOST ONLY. This is the Flutter app's implementation of
|
|
// `ConduitBridgeHost`; other hosts provide their own and do not copy
|
|
// this file.
|
|
|
|
/// Exposes one Flutter engine's messenger, and the app's key window, to the
|
|
/// native feature bridges.
|
|
///
|
|
/// The app delegate creates one for each engine it attaches: the shared
|
|
/// scene engine, or the implicit engine through its application registrar.
|
|
final class FlutterConduitBridgeHost: ConduitBridgeHost {
|
|
let messenger: FlutterBinaryMessenger
|
|
|
|
init(messenger: FlutterBinaryMessenger) {
|
|
self.messenger = messenger
|
|
}
|
|
|
|
var presentingViewController: UIViewController? {
|
|
UIApplication.shared.connectedScenes
|
|
.compactMap { $0 as? UIWindowScene }
|
|
.flatMap(\.windows)
|
|
.first { $0.isKeyWindow }?
|
|
.rootViewController
|
|
}
|
|
|
|
var activeWindowScene: UIWindowScene? {
|
|
UIApplication.shared.connectedScenes
|
|
.compactMap { $0 as? UIWindowScene }
|
|
.first { $0.activationState == .foregroundActive }
|
|
}
|
|
|
|
var appGroupIdentifier: String? {
|
|
ConduitAppGroup.identifier()
|
|
}
|
|
}
|