Skip to content

Commit

Permalink
Merge pull request #1933 from michalsrutek/bugfix/ipad-crash-present-…
Browse files Browse the repository at this point in the history
…inappbrowser

💥 Fix iPad crash due to missing `sourceView`
  • Loading branch information
pichillilorenzo authored Dec 23, 2023
2 parents 15f3155 + 527a62b commit 5b42251
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 5b42251

Please # to comment.