CB-11136: (ios) Fix InAppBrowser when closing with WKWebView

This closes #187
This commit is contained in:
Manu Mtz.-Almeida 2016-09-19 22:51:08 +02:00 committed by Shazron Abdullah
parent d735649fcd
commit f32917df31

View File

@ -239,7 +239,14 @@
// Run later to avoid the "took a long time" log message. // Run later to avoid the "took a long time" log message.
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (weakSelf.inAppBrowserViewController != nil) { if (weakSelf.inAppBrowserViewController != nil) {
[weakSelf.viewController presentViewController:nav animated:YES completion:nil]; CGRect frame = [[UIScreen mainScreen] bounds];
UIWindow *tmpWindow = [[UIWindow alloc] initWithFrame:frame];
UIViewController *tmpController = [[UIViewController alloc] init];
[tmpWindow setRootViewController:tmpController];
[tmpWindow setWindowLevel:UIWindowLevelAlert];
[tmpWindow makeKeyAndVisible];
[tmpController presentViewController:nav animated:YES completion:nil];
} }
}); });
} }
@ -426,7 +433,7 @@
[self.commandDelegate sendPluginResult:pluginResult callbackId:scriptCallbackId]; [self.commandDelegate sendPluginResult:pluginResult callbackId:scriptCallbackId];
return NO; return NO;
} }
} }
//if is an app store link, let the system handle it, otherwise it fails to load it //if is an app store link, let the system handle it, otherwise it fails to load it
else if ([[ url scheme] isEqualToString:@"itms-appss"] || [[ url scheme] isEqualToString:@"itms-apps"]) { else if ([[ url scheme] isEqualToString:@"itms-appss"] || [[ url scheme] isEqualToString:@"itms-apps"]) {
[theWebView stopLoading]; [theWebView stopLoading];
@ -517,7 +524,7 @@
#else #else
_webViewDelegate = [[CDVWebViewDelegate alloc] initWithDelegate:self]; _webViewDelegate = [[CDVWebViewDelegate alloc] initWithDelegate:self];
#endif #endif
[self createViews]; [self createViews];
} }