fix: alerts could freeze the application #1437
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Platforms affected
iOS
Motivation and Context
Closes GH-1120.
Closes GH-1121.
Closes GH-1429.
Description
In cases where the system was presenting something on the screen (such as a permission prompt, or an undo dialog) or in cases where the
CDVViewController
was not the root view controller (such as in a tabbed navigator), trying to show any dialogs triggered from the WebView would attempt to create an alert on the root view controller and get the view hierarchy into a bad state.Now, we only try to display alerts on the
CDVViewController
that owns the WebView. This means that alerts can potentially end up behind other system dialogs, but the view controller no longer freezes.(As an aside, having access to the
CDVViewController
here will be helpful for some future things too...)Testing
Tested manually by triggering an alert while a permission prompt was being displayed and confirmed that the app continued working as expected.
Checklist