Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions ios/Classes/SwiftTwilioVoicePlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,17 @@ public class SwiftTwilioVoicePlugin: NSObject, FlutterPlugin, FlutterStreamHand
_ = updateCallKitIcon(icon: defaultIcon)

voipRegistry.delegate = self
voipRegistry.desiredPushTypes = Set([PKPushType.voIP])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since Pushkit was introduced in iOS 8 which has a negligible market share, this issue may be better served by bumping the minimum supported iOS version which currently stands at iOS 11.0.

// Only set PushKit types if available (requires PushKit entitlement)
if #available(iOS 8.0, *) {
voipRegistry.desiredPushTypes = Set([PKPushType.voIP])
}

UNUserNotificationCenter.current().delegate = self

let appDelegate = UIApplication.shared.delegate
guard let controller = appDelegate?.window??.rootViewController as? FlutterViewController else {
fatalError("rootViewController is not type FlutterViewController")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this were to occur, it is a symptom of a larger problem. We do not wish to hide it. This is indicative of an issue with the package, either early initialisation, test written with package, etc.

NSLog("Warning: FlutterViewController not available during Twilio Voice plugin init, event channel setup will be skipped")
return
}
let registrar = controller.registrar(forPlugin: "twilio_voice")
if let unwrappedRegistrar = registrar {
Expand Down