jcesarmobile commented on code in PR #190:
URL:
https://github.com/apache/cordova-plugin-dialogs/pull/190#discussion_r2422983929
##########
src/ios/CDVNotification.m:
##########
@@ -149,14 +149,39 @@ - (void)beep:(CDVInvokedUrlCommand*)command
}
-(UIViewController *)getTopPresentedViewController {
+ UIWindow *keyWindow = nil;
+
+ if (@available(iOS 13.0, *)) {
+ // iOS 13+ approach - get the first active window scene
+ // Since iOS 13, Apple introduced UIScene and multiple window support.
+ // The deprecated keyWindow property doesn't work reliably with
multiple scenes
+ // as it returns a key window across all connected scenes, which can
be from
+ // different app instances or windows. We need to find the active
foreground
+ // scene to get the correct window for presenting our alert.
+ for (UIWindowScene *windowScene in [UIApplication
sharedApplication].connectedScenes) {
+ if (windowScene.activationState ==
UISceneActivationStateForegroundActive) {
+ keyWindow = windowScene.windows.firstObject;
+ break;
+ }
+ }
+ } else {
+ // Fallback for iOS 11-12
Review Comment:
It's not specified anywhere at the moment, when the version was bumped to
3.0.0-dev and iOS 7 and older code was removed we should have added a
cordova-ios >= 4 and the > 100 should have been moved to a new 4.0.0 entry.
The > 100 was supposed to be a protective measure to prevent installing a
version when a major bump happens or something, that has only caused issues as
we usually forget to update it and it prevents the installing on the version of
the plugin.
you can read about the proposal here
https://lists.apache.org/thread/lfnxoss879yqw0rbljqycms7r0g6vgy7
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]