GitToTheHub commented on code in PR #190:
URL:
https://github.com/apache/cordova-plugin-dialogs/pull/190#discussion_r2423026176
##########
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:
cordova-ios 6 is the first one, which supports iOS 11. So we should support
minimum this cordova-ios version. But for cordova-ios 8.0.0, we should raise
the minimum iOS version to 15, because you can't test your app on older OSs.
XCode doesn't let you install older simulators and according to ChatGPT, you
can't install with the oldest supported XCode 16 your app on a device which has
an iOS version older than 15. I started a discussion for this here:
https://github.com/apache/cordova/discussions/566
--
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]