fix: Make PushKit optional and handle missing FlutterViewController g…#311
Conversation
…racefully - Replace fatalError with warning when FlutterViewController is not available during init - Make PushKit desiredPushTypes optional to prevent crashes when PushKit entitlement is missing - Allows plugin to initialize for outgoing calls even without PushKit support Fixes crash on app startup when PushKit is not configured.
cybex-dev
left a comment
There was a problem hiding this comment.
Thank you for your PR.
The changes suggested are either redundant or a mask to hide potential issues - these I do not agree to add as it will give unexpected behaviour to current users.
Issues addressing an early initialisation need to be addressed instead.
| _ = updateCallKitIcon(icon: defaultIcon) | ||
|
|
||
| voipRegistry.delegate = self | ||
| voipRegistry.desiredPushTypes = Set([PKPushType.voIP]) |
There was a problem hiding this comment.
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.
|
|
||
| let appDelegate = UIApplication.shared.delegate | ||
| guard let controller = appDelegate?.window??.rootViewController as? FlutterViewController else { | ||
| fatalError("rootViewController is not type FlutterViewController") |
There was a problem hiding this comment.
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.
…racefully
Fixes crash on app startup when PushKit is not configured.