Affects Version/s: 3.5.0
Fix Version/s: None
navigator.notifications.alert / confirm is supposed to display a dialog on top of the app, however when there's another plugin that's being shown (such as InAppBrwoser or its forks), navigator.notifications.alert / confirm will do nothing. In Xcode console you can see the following warning:
Warning: Attempt to present UIAlertController on MainViewController whose view is not in the window hierarchy
1. Install cordova-plugin-dialogs
2. Install cordova-plugin-inappbrowser
3. Create a dummy button that launches InAppBrowser
4. Listen to one of InAppBrowser's events, such as loadstop. Inside the event listener, call navigator.notification.alert / confirm
5. Build iOS
6. Click dummy button to launch InAppBrowser. Observe that alert does not show up and the above warning in Xcode console.
I have already debugged this issue, so please allow me to explain. iOS only allows you to stack a new UIViewController on top of the top most UiViewController. In case of cordova-plugin-dialogs, it simply stacks on top of self.viewController, which is the app's default UIViewController. However when another plugin (think InAppBrowser) that also stacks on top of self.viewController, now the other plugin is the top most UIViewController, and iOS prevents further UIViewController to be stacked on self.viewController. Therefore cordova-plugin-dialogs now does nothing but a warning from Xcode console.
This issue is somewhat related to
CB-9347 and its pull request https://github.com/apache/cordova-plugin-dialogs/pull/54 can mostly fix this issue along with it. However CB-9347 addresses a very different use case, and it doesn't address a case where a third party plugin may be in the process of dismissing and navigator.notification.alert / confirm may be called.