(ios) Fix inappbrowser not opening on iOS 13 by using reusable window

Closes #492
This commit is contained in:
Niklas Merz 2019-09-06 08:29:55 +02:00
parent 2b59941514
commit 8810c6a8a0
2 changed files with 10 additions and 7 deletions

View File

@ -27,6 +27,8 @@
@class CDVWKInAppBrowserViewController; @class CDVWKInAppBrowserViewController;
@interface CDVWKInAppBrowser : CDVPlugin { @interface CDVWKInAppBrowser : CDVPlugin {
UIWindow * tmpWindow;
@private @private
NSString* _beforeload; NSString* _beforeload;
BOOL _waitForBeforeload; BOOL _waitForBeforeload;

View File

@ -314,17 +314,18 @@ static CDVWKInAppBrowser* instance = nil;
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (weakSelf.inAppBrowserViewController != nil) { if (weakSelf.inAppBrowserViewController != nil) {
float osVersion = [[[UIDevice currentDevice] systemVersion] floatValue]; float osVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
CGRect frame = [[UIScreen mainScreen] bounds]; if (!tmpWindow) {
if(initHidden && osVersion < 11){ CGRect frame = [[UIScreen mainScreen] bounds];
frame.origin.x = -10000; if(initHidden && osVersion < 11){
frame.origin.x = -10000;
}
tmpWindow = [[UIWindow alloc] initWithFrame:frame];
} }
UIWindow *tmpWindow = [[UIWindow alloc] initWithFrame:frame];
UIViewController *tmpController = [[UIViewController alloc] init]; UIViewController *tmpController = [[UIViewController alloc] init];
[tmpWindow setRootViewController:tmpController]; [tmpWindow setRootViewController:tmpController];
[tmpWindow setWindowLevel:UIWindowLevelNormal]; [tmpWindow setWindowLevel:UIWindowLevelNormal];
if(!initHidden || osVersion < 11){ if(!initHidden || osVersion < 11){
[tmpWindow makeKeyAndVisible]; [tmpWindow makeKeyAndVisible];
} }