Skip to content

fix: Make PushKit optional and handle missing FlutterViewController g…#311

Open
NarekManukyan wants to merge 1 commit intocybex-dev:masterfrom
NarekManukyan:fix/pushkit-optional-and-flutterviewcontroller-handling
Open

fix: Make PushKit optional and handle missing FlutterViewController g…#311
NarekManukyan wants to merge 1 commit intocybex-dev:masterfrom
NarekManukyan:fix/pushkit-optional-and-flutterviewcontroller-handling

Conversation

@NarekManukyan
Copy link
Copy Markdown

…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.

…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.
Copy link
Copy Markdown
Owner

@cybex-dev cybex-dev left a comment

Choose a reason for hiding this comment

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

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])
Copy link
Copy Markdown
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.


let appDelegate = UIApplication.shared.delegate
guard let controller = appDelegate?.window??.rootViewController as? FlutterViewController else {
fatalError("rootViewController is not type FlutterViewController")
Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants