From 81bec095266ffccecbb052408445259c00f27344 Mon Sep 17 00:00:00 2001 From: Niklas Merz Date: Fri, 6 Sep 2019 14:14:51 +0200 Subject: [PATCH] (ios) Fix iOS 13 show not working Removed tmpWindow and controller. This was introduced to fix IAB with WKWebView before WKIAB existed. --- src/ios/CDVWKInAppBrowser.h | 2 -- src/ios/CDVWKInAppBrowser.m | 24 ++++-------------------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/ios/CDVWKInAppBrowser.h b/src/ios/CDVWKInAppBrowser.h index 7fddf9c..1f359b1 100644 --- a/src/ios/CDVWKInAppBrowser.h +++ b/src/ios/CDVWKInAppBrowser.h @@ -27,8 +27,6 @@ @class CDVWKInAppBrowserViewController; @interface CDVWKInAppBrowser : CDVPlugin { - UIWindow * tmpWindow; - @private NSString* _beforeload; BOOL _waitForBeforeload; diff --git a/src/ios/CDVWKInAppBrowser.m b/src/ios/CDVWKInAppBrowser.m index 02aa80d..f176a91 100644 --- a/src/ios/CDVWKInAppBrowser.m +++ b/src/ios/CDVWKInAppBrowser.m @@ -275,7 +275,9 @@ static CDVWKInAppBrowser* instance = nil; _waitForBeforeload = ![_beforeload isEqualToString:@""]; [self.inAppBrowserViewController navigateTo:url]; - [self show:nil withNoAnimate:browserOptions.hidden]; + if (!browserOptions.hidden) { + [self show:nil withNoAnimate:browserOptions.hidden]; + } } - (void)show:(CDVInvokedUrlCommand*)command{ @@ -312,25 +314,7 @@ static CDVWKInAppBrowser* instance = nil; // Run later to avoid the "took a long time" log message. dispatch_async(dispatch_get_main_queue(), ^{ - if (weakSelf.inAppBrowserViewController != nil) { - float osVersion = [[[UIDevice currentDevice] systemVersion] floatValue]; - if (!self->tmpWindow) { - CGRect frame = [[UIScreen mainScreen] bounds]; - if(initHidden && osVersion < 11){ - frame.origin.x = -10000; - } - self->tmpWindow = [[UIWindow alloc] initWithFrame:frame]; - } - UIViewController *tmpController = [[UIViewController alloc] init]; - - [self->tmpWindow setRootViewController:tmpController]; - [self->tmpWindow setWindowLevel:UIWindowLevelNormal]; - - if(!initHidden || osVersion < 11){ - [self->tmpWindow makeKeyAndVisible]; - } - [tmpController presentViewController:nav animated:!noAnimate completion:nil]; - } + [weakSelf.viewController presentViewController:nav animated:!noAnimate completion:nil]; }); }