Skip to content
Permalink
Browse files
Use tmpWindow and hide on close
  • Loading branch information
NiklasMerz committed Sep 20, 2019
1 parent 8805f5d commit 82d496ae5cdbbc7f46ce20c77d6ad7bcbe2fb207
Showing 1 changed file with 10 additions and 4 deletions.
@@ -80,6 +80,11 @@ - (void)close:(CDVInvokedUrlCommand*)command
NSLog(@"IAB.close() called but it was already closed.");
return;
}

// Set tmpWindow to hidden to make main webview responsive to touch again
// https://stackoverflow.com/questions/4544489/how-to-remove-a-uiwindow
self->tmpWindow.hidden = YES;

// Things are cleaned up in browserExit.
[self.inAppBrowserViewController close];
}
@@ -314,17 +319,18 @@ - (void)show:(CDVInvokedUrlCommand*)command withNoAnimate:(BOOL)noAnimate
dispatch_async(dispatch_get_main_queue(), ^{
if (weakSelf.inAppBrowserViewController != nil) {
float osVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
if (!self->tmpWindow) {
__strong __typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf->tmpWindow) {
CGRect frame = [[UIScreen mainScreen] bounds];
if(initHidden && osVersion < 11){
frame.origin.x = -10000;
}
self->tmpWindow = [[UIWindow alloc] initWithFrame:frame];
strongSelf->tmpWindow = [[UIWindow alloc] initWithFrame:frame];
}
UIViewController *tmpController = [[UIViewController alloc] init];

[self->tmpWindow setRootViewController:tmpController];
[self->tmpWindow setWindowLevel:UIWindowLevelNormal];
[strongSelf->tmpWindow setRootViewController:tmpController];
[strongSelf->tmpWindow setWindowLevel:UIWindowLevelNormal];

if(!initHidden || osVersion < 11){
[self->tmpWindow makeKeyAndVisible];

0 comments on commit 82d496a

Please sign in to comment.