@@ -113,27 +113,16 @@ - (void)presentSafariVCWithBranchKey:(NSString *)branchKey {
113113 return ;
114114 }
115115
116- UIViewController * safController = [[SFSafariViewControllerClass alloc ] initWithURL: strongMatchUrl];
117- self.secondWindow = [[UIWindow alloc ] initWithFrame: [[[[UIApplication sharedApplication ] windows ] firstObject ] bounds ]];
118- UIViewController *windowRootController = [[UIViewController alloc ] init ];
119- self.secondWindow .rootViewController = windowRootController;
120- self.secondWindow .windowLevel = UIWindowLevelNormal - 1 ;
121- [self .secondWindow setHidden: NO ];
122- [self .secondWindow setAlpha: 0 ];
123-
124- // Must be on next run loop to avoid a warning
125116 dispatch_async (dispatch_get_main_queue (), ^{
126- // Add the safari view controller using view controller containment
127- [windowRootController addChildViewController: safController];
128- [windowRootController.view addSubview: safController.view];
129- [safController didMoveToParentViewController: windowRootController];
130-
131- // Give a little bit of time for safari to load the request.
132- dispatch_after (dispatch_time (DISPATCH_TIME_NOW, (int64_t )(10 * NSEC_PER_SEC)), dispatch_get_main_queue (), ^{
133- // Remove the safari view controller from view controller containment
134- [safController willMoveToParentViewController: nil ];
135- [safController.view removeFromSuperview ];
136- [safController removeFromParentViewController ];
117+ UIViewController * safController = [[SFSafariViewControllerClass alloc ] initWithURL: strongMatchUrl];
118+ self.secondWindow = [[UIWindow alloc ] initWithFrame: [[UIScreen mainScreen ] bounds ]];
119+ self.secondWindow .rootViewController = safController;
120+ self.secondWindow .windowLevel = UIWindowLevelNormal - 100 ;
121+ [self .secondWindow setHidden: NO ];
122+ UIWindow *keyWindow = [[UIApplication sharedApplication ] keyWindow ];
123+ [self .secondWindow makeKeyWindow ];
124+ dispatch_after (dispatch_time (DISPATCH_TIME_NOW, (int64_t )(2 * NSEC_PER_SEC)), dispatch_get_main_queue (), ^{
125+ [keyWindow makeKeyWindow ];
137126
138127 // Remove the window and release it's strong reference. This is important to ensure that
139128 // applications using view controller based status bar appearance are restored.
@@ -144,6 +133,24 @@ - (void)presentSafariVCWithBranchKey:(NSString *)branchKey {
144133 self.requestInProgress = NO ;
145134 });
146135 });
136+
137+ // // Must be on next run loop to avoid a warning
138+ // dispatch_async(dispatch_get_main_queue(), ^{
139+ // // Add the safari view controller using view controller containment
140+ // [windowRootController addChildViewController:safController];
141+ // [windowRootController.view addSubview:safController.view];
142+ // [safController didMoveToParentViewController:windowRootController];
143+ //
144+ // // Give a little bit of time for safari to load the request.
145+ // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
146+ // // Remove the safari view controller from view controller containment
147+ // [safController willMoveToParentViewController:nil];
148+ // [safController.view removeFromSuperview];
149+ // [safController removeFromParentViewController];
150+ //
151+ //
152+ // });
153+ // });
147154 }
148155 else {
149156 self.requestInProgress = NO ;
0 commit comments