Skip to content

Commit 81bec09

Browse files
committed
(ios) Fix iOS 13 show not working
Removed tmpWindow and controller. This was introduced to fix IAB with WKWebView before WKIAB existed.
1 parent 8805f5d commit 81bec09

File tree

2 files changed

+4
-22
lines changed

2 files changed

+4
-22
lines changed

src/ios/CDVWKInAppBrowser.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
@class CDVWKInAppBrowserViewController;
2828

2929
@interface CDVWKInAppBrowser : CDVPlugin {
30-
UIWindow * tmpWindow;
31-
3230
@private
3331
NSString* _beforeload;
3432
BOOL _waitForBeforeload;

src/ios/CDVWKInAppBrowser.m

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,9 @@ - (void)openInInAppBrowser:(NSURL*)url withOptions:(NSString*)options
275275
_waitForBeforeload = ![_beforeload isEqualToString:@""];
276276

277277
[self.inAppBrowserViewController navigateTo:url];
278-
[self show:nil withNoAnimate:browserOptions.hidden];
278+
if (!browserOptions.hidden) {
279+
[self show:nil withNoAnimate:browserOptions.hidden];
280+
}
279281
}
280282

281283
- (void)show:(CDVInvokedUrlCommand*)command{
@@ -312,25 +314,7 @@ - (void)show:(CDVInvokedUrlCommand*)command withNoAnimate:(BOOL)noAnimate
312314

313315
// Run later to avoid the "took a long time" log message.
314316
dispatch_async(dispatch_get_main_queue(), ^{
315-
if (weakSelf.inAppBrowserViewController != nil) {
316-
float osVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
317-
if (!self->tmpWindow) {
318-
CGRect frame = [[UIScreen mainScreen] bounds];
319-
if(initHidden && osVersion < 11){
320-
frame.origin.x = -10000;
321-
}
322-
self->tmpWindow = [[UIWindow alloc] initWithFrame:frame];
323-
}
324-
UIViewController *tmpController = [[UIViewController alloc] init];
325-
326-
[self->tmpWindow setRootViewController:tmpController];
327-
[self->tmpWindow setWindowLevel:UIWindowLevelNormal];
328-
329-
if(!initHidden || osVersion < 11){
330-
[self->tmpWindow makeKeyAndVisible];
331-
}
332-
[tmpController presentViewController:nav animated:!noAnimate completion:nil];
333-
}
317+
[weakSelf.viewController presentViewController:nav animated:!noAnimate completion:nil];
334318
});
335319
}
336320

0 commit comments

Comments
 (0)