Skip to content
Permalink
Browse files
(ios) Fix inappbrowser not opening on iOS 13 by using reusable window
Closes #492
  • Loading branch information
NiklasMerz committed Sep 6, 2019
1 parent 2b59941 commit 8810c6a8a0300eef154246c1007acfc862238e57
Showing 2 changed files with 10 additions and 7 deletions.
@@ -27,6 +27,8 @@
@class CDVWKInAppBrowserViewController;

@interface CDVWKInAppBrowser : CDVPlugin {
UIWindow * tmpWindow;

@private
NSString* _beforeload;
BOOL _waitForBeforeload;
@@ -314,17 +314,18 @@ - (void)show:(CDVInvokedUrlCommand*)command withNoAnimate:(BOOL)noAnimate
dispatch_async(dispatch_get_main_queue(), ^{
if (weakSelf.inAppBrowserViewController != nil) {
float osVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
CGRect frame = [[UIScreen mainScreen] bounds];
if(initHidden && osVersion < 11){
frame.origin.x = -10000;
if (!tmpWindow) {
CGRect frame = [[UIScreen mainScreen] bounds];
if(initHidden && osVersion < 11){
frame.origin.x = -10000;
}
tmpWindow = [[UIWindow alloc] initWithFrame:frame];
}

UIWindow *tmpWindow = [[UIWindow alloc] initWithFrame:frame];
UIViewController *tmpController = [[UIViewController alloc] init];

[tmpWindow setRootViewController:tmpController];
[tmpWindow setWindowLevel:UIWindowLevelNormal];

if(!initHidden || osVersion < 11){
[tmpWindow makeKeyAndVisible];
}

0 comments on commit 8810c6a

Please sign in to comment.