Merge pull request #1933 from michalsrutek/bugfix/ipad-crash-present-inappbrowser

💥 Fix iPad crash due to missing `sourceView`
This commit is contained in:
Lorenzo Pichilli 2023-12-23 13:59:11 +01:00 committed by GitHub
commit 5b422511c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -114,7 +114,15 @@ public class InAppBrowserManager: ChannelDelegate {
assertionFailure("Failure init the visibleViewController!")
return
}
if let popover = navController.popoverPresentationController {
let sourceView = visibleViewController.view ?? UIView()
popover.sourceRect = CGRect(x: sourceView.bounds.midX, y: sourceView.bounds.midY, width: 0, height: 0)
popover.permittedArrowDirections = []
popover.sourceView = sourceView
}
visibleViewController.present(navController, animated: animated)
}