@@ -239,8 +239,10 @@ - (void)show:(CDVInvokedUrlCommand*)command
239
239
// Run later to avoid the "took a long time" log message.
240
240
dispatch_async (dispatch_get_main_queue (), ^{
241
241
if (weakSelf.inAppBrowserViewController != nil ) {
242
- CGRect frame = [[UIScreen mainScreen ] bounds ];
243
- UIWindow *tmpWindow = [[UIWindow alloc ] initWithFrame: frame];
242
+ if (!tmpWindow) {
243
+ CGRect frame = [[UIScreen mainScreen ] bounds ];
244
+ tmpWindow = [[UIWindow alloc ] initWithFrame: frame];
245
+ }
244
246
UIViewController *tmpController = [[UIViewController alloc ] init ];
245
247
[tmpWindow setRootViewController: tmpController];
246
248
[tmpWindow setWindowLevel: UIWindowLevelNormal];
@@ -270,7 +272,9 @@ - (void)hide:(CDVInvokedUrlCommand*)command
270
272
dispatch_async (dispatch_get_main_queue (), ^{
271
273
if (self.inAppBrowserViewController != nil ) {
272
274
_previousStatusBarStyle = -1 ;
273
- [self .inAppBrowserViewController.presentingViewController dismissViewControllerAnimated: YES completion: nil ];
275
+ [self .inAppBrowserViewController.presentingViewController dismissViewControllerAnimated: YES completion: ^{
276
+ [[[[UIApplication sharedApplication ] delegate ] window ] makeKeyAndVisible ];
277
+ }];
274
278
}
275
279
});
276
280
}
@@ -835,9 +839,13 @@ - (void)close
835
839
// Run later to avoid the "took a long time" log message.
836
840
dispatch_async (dispatch_get_main_queue (), ^{
837
841
if ([weakSelf respondsToSelector: @selector (presentingViewController )]) {
838
- [[weakSelf presentingViewController ] dismissViewControllerAnimated: YES completion: nil ];
842
+ [[weakSelf presentingViewController ] dismissViewControllerAnimated: YES completion: ^{
843
+ [[[[UIApplication sharedApplication ] delegate ] window ] makeKeyAndVisible ];
844
+ }];
839
845
} else {
840
- [[weakSelf parentViewController ] dismissViewControllerAnimated: YES completion: nil ];
846
+ [[weakSelf parentViewController ] dismissViewControllerAnimated: YES completion: ^{
847
+ [[[[UIApplication sharedApplication ] delegate ] window ] makeKeyAndVisible ];
848
+ }];
841
849
}
842
850
});
843
851
}
0 commit comments