GitToTheHub commented on code in PR #190:
URL: 
https://github.com/apache/cordova-plugin-dialogs/pull/190#discussion_r2423350539


##########
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:
   > Not everybody submit apps to the Apple App Store, so in those cases there 
are no Xcode restrictions and people can have real devices to test with those 
older iOS versions.
   
   Do this really do people? Do know real examples, or this just a guess? I 
mean also with the old os versions.
   
   Thanks for the hint with the dev list, I will try this.



-- 
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]

Reply via email to