refactor: remove activity dependency from LinphoneBridge
This commit is contained in:
parent
0375fe4d1a
commit
9a86c4881c
2 changed files with 1 additions and 22 deletions
|
|
@ -6,7 +6,6 @@ public class LiblinphoneFlutterPlugin: NSObject, FlutterPlugin {
|
|||
private var registrationEventsChannel: FlutterEventSink?
|
||||
private var callEventsChannel: FlutterEventSink?
|
||||
|
||||
private var activity: UIViewController?
|
||||
private var remoteViewCache: [Int: UIView] = [:]
|
||||
private var localViewCache: [Int: UIView] = [:]
|
||||
|
||||
|
|
@ -76,13 +75,6 @@ public class LiblinphoneFlutterPlugin: NSObject, FlutterPlugin {
|
|||
}
|
||||
)
|
||||
callEventChannel.setStreamHandler(callStreamHandler)
|
||||
|
||||
// Get root view controller
|
||||
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
|
||||
let window = windowScene.windows.first,
|
||||
let rootViewController = window.rootViewController {
|
||||
instance.activity = rootViewController
|
||||
}
|
||||
}
|
||||
|
||||
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
|
|
@ -92,18 +84,8 @@ public class LiblinphoneFlutterPlugin: NSObject, FlutterPlugin {
|
|||
result(hasPermissions)
|
||||
|
||||
case "initialize":
|
||||
do {
|
||||
guard let activity = self.activity else {
|
||||
result(FlutterError(
|
||||
code: "NO_ACTIVITY",
|
||||
message: "Activity not available",
|
||||
details: nil
|
||||
))
|
||||
return
|
||||
}
|
||||
|
||||
do {
|
||||
linphoneBridge = LinphoneBridge(
|
||||
activity: activity,
|
||||
remoteViewAcquisitor: { [weak self] in
|
||||
return self?.acquireRemoteView()
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue