Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unhandled dismissal of SFSafariViewController #758

Merged
merged 2 commits into from
Feb 17, 2023

Conversation

Widcket
Copy link
Contributor

@Widcket Widcket commented Feb 17, 2023

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

📋 Changes

When the Safari provider is used and the user closes the browser by pressing the Cancel button, the SDK handles it by returning a userCancelled error. But, when the Safari provider is used with the formSheet presentation style, the user can close the browser sheet by swiping down. This dismissal is not caught by the SDK, and no error is returned. When using async/await, this leads to the continuation leaking.

When the user presses the Cancel button, this action is reported through SFSafariViewController's delegate. But when the formSheet browser is swiped down, it's reported through its presentation controller's delegate instead. This PR fixes the issue by implementing the presentation controller's delegate and handling the dismissal.

📎 References

Fixes #757

🎯 Testing

Unit tests were added, and also the changes were tested manually using an iPhone 11 Pro running iOS 16.2, using Xcode 14.2 (14C18).

RPReplay_Final1676605995

@Widcket Widcket requested a review from a team as a code owner February 17, 2023 04:18
@Widcket Widcket changed the title Fix unhandled dismissal of SFSafariViewController Fix unhandled dismissal of SFSafariViewController Feb 17, 2023
@Widcket Widcket enabled auto-merge (squash) February 17, 2023 14:56
@Widcket Widcket merged commit 65c5282 into master Feb 17, 2023
@Widcket Widcket deleted the fix/safari-presentation-delegate branch February 17, 2023 15:09
@Widcket Widcket mentioned this pull request Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

webAuth() leaks continuation when using SFSafariViewController and formSheet presentation style
2 participants