@@ -329,16 +329,27 @@ - (void)show:(CDVInvokedUrlCommand*)command withAnimation:(BOOL)animated
329329 initWithRootViewController: self .themeableBrowserViewController];
330330 nav.orientationDelegate = self.themeableBrowserViewController ;
331331 nav.navigationBarHidden = YES ;
332+ if (@available (iOS 13.0 , *)) {
333+ nav.modalInPresentation = true ;
334+ nav.modalPresentationStyle = UIModalPresentationOverFullScreen;
335+ }
336+
337+ __weak CDVThemeableBrowser* weakSelf = self;
338+
332339 // Run later to avoid the "took a long time" log message.
333340 dispatch_async (dispatch_get_main_queue (), ^{
334341 if (self.themeableBrowserViewController != nil ) {
335- CGRect frame = [[UIScreen mainScreen ] bounds ];
336- UIWindow *tmpWindow = [[UIWindow alloc ] initWithFrame: frame];
342+ __strong __typeof (weakSelf) strongSelf = weakSelf;
343+ if (!strongSelf->tmpWindow ) {
344+ CGRect frame = [[UIScreen mainScreen ] bounds ];
345+ strongSelf->tmpWindow = [[UIWindow alloc ] initWithFrame: frame];
346+ }
347+
337348 UIViewController *tmpController = [[UIViewController alloc ] init ];
338- [tmpWindow setRootViewController: tmpController];
339- [tmpWindow setWindowLevel: UIWindowLevelNormal];
349+ [strongSelf-> tmpWindow setRootViewController: tmpController];
350+
340351
341- [tmpWindow makeKeyAndVisible ];
352+ [strongSelf-> tmpWindow makeKeyAndVisible ];
342353 [tmpController presentViewController: nav animated: YES completion: nil ];
343354 }
344355 });
@@ -626,6 +637,8 @@ - (void)browserExit
626637 // Don't recycle the ViewController since it may be consuming a lot of memory.
627638 // Also - this is required for the PDF/User-Agent bug work-around.
628639 self.themeableBrowserViewController = nil ;
640+
641+
629642 self.callbackId = nil ;
630643 self.callbackIdPattern = nil ;
631644
0 commit comments