This is an automated email from the ASF dual-hosted git repository.

dpogue pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/cordova-plugin-inappbrowser.git


The following commit(s) were added to refs/heads/master by this push:
     new e2d8429  fix(iOS): IAB not showing up in apps using UIScenes (#1067)
e2d8429 is described below

commit e2d8429092b5d121745911530091fe9eb1f27c43
Author: Darryl Pogue <dar...@dpogue.ca>
AuthorDate: Thu Aug 29 23:58:15 2024 -0700

    fix(iOS): IAB not showing up in apps using UIScenes (#1067)
---
 src/ios/CDVWKInAppBrowser.m | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/ios/CDVWKInAppBrowser.m b/src/ios/CDVWKInAppBrowser.m
index a121fb1..cee4830 100644
--- a/src/ios/CDVWKInAppBrowser.m
+++ b/src/ios/CDVWKInAppBrowser.m
@@ -246,11 +246,20 @@ static CDVWKInAppBrowser* instance = nil;
             float osVersion = [[[UIDevice currentDevice] systemVersion] 
floatValue];
             __strong __typeof(weakSelf) strongSelf = weakSelf;
             if (!strongSelf->tmpWindow) {
-                CGRect frame = [[UIScreen mainScreen] bounds];
-                if(initHidden && osVersion < 11){
-                   frame.origin.x = -10000;
+                if (@available(iOS 13.0, *)) {
+                    UIWindowScene *scene = 
strongSelf.viewController.view.window.windowScene;
+                    if (scene) {
+                        strongSelf->tmpWindow = [[UIWindow alloc] 
initWithWindowScene:scene];
+                    }
+                }
+
+                if (!strongSelf->tmpWindow) {
+                    CGRect frame = [[UIScreen mainScreen] bounds];
+                    if(initHidden && osVersion < 11){
+                       frame.origin.x = -10000;
+                    }
+                    strongSelf->tmpWindow = [[UIWindow alloc] 
initWithFrame:frame];
                 }
-                strongSelf->tmpWindow = [[UIWindow alloc] initWithFrame:frame];
             }
             UIViewController *tmpController = [[UIViewController alloc] init];
             [strongSelf->tmpWindow setRootViewController:tmpController];


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org
For additional commands, e-mail: commits-h...@cordova.apache.org

Reply via email to