Skip to content

Commit 82d496a

Browse files
committed
Use tmpWindow and hide on close
1 parent 8805f5d commit 82d496a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/ios/CDVWKInAppBrowser.m

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ - (void)close:(CDVInvokedUrlCommand*)command
8080
NSLog(@"IAB.close() called but it was already closed.");
8181
return;
8282
}
83+
84+
// Set tmpWindow to hidden to make main webview responsive to touch again
85+
// https://stackoverflow.com/questions/4544489/how-to-remove-a-uiwindow
86+
self->tmpWindow.hidden = YES;
87+
8388
// Things are cleaned up in browserExit.
8489
[self.inAppBrowserViewController close];
8590
}
@@ -314,17 +319,18 @@ - (void)show:(CDVInvokedUrlCommand*)command withNoAnimate:(BOOL)noAnimate
314319
dispatch_async(dispatch_get_main_queue(), ^{
315320
if (weakSelf.inAppBrowserViewController != nil) {
316321
float osVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
317-
if (!self->tmpWindow) {
322+
__strong __typeof(weakSelf) strongSelf = weakSelf;
323+
if (!strongSelf->tmpWindow) {
318324
CGRect frame = [[UIScreen mainScreen] bounds];
319325
if(initHidden && osVersion < 11){
320326
frame.origin.x = -10000;
321327
}
322-
self->tmpWindow = [[UIWindow alloc] initWithFrame:frame];
328+
strongSelf->tmpWindow = [[UIWindow alloc] initWithFrame:frame];
323329
}
324330
UIViewController *tmpController = [[UIViewController alloc] init];
325331

326-
[self->tmpWindow setRootViewController:tmpController];
327-
[self->tmpWindow setWindowLevel:UIWindowLevelNormal];
332+
[strongSelf->tmpWindow setRootViewController:tmpController];
333+
[strongSelf->tmpWindow setWindowLevel:UIWindowLevelNormal];
328334

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

0 commit comments

Comments
 (0)