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


##########
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:
   Ok thanks for the information. So it's better to support the older ones, 
though they are not distributable to the app store.



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