File tree Expand file tree Collapse file tree
iOS_SDK/OneSignalSDK/Source Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,10 +52,20 @@ + (BOOL)isAppUsingUIScene {
5252
5353+ (UIWindow *)firstKeyWindowForConnectedScenes {
5454 if (@available (iOS 13.0 , *)) {
55+ for (UIScene *scene in UIApplication.sharedApplication .connectedScenes ) {
56+ if ([scene isKindOfClass: [UIWindowScene class ]] &&
57+ scene.activationState == UISceneActivationStateForegroundActive) {
58+ for (UIWindow *window in ((UIWindowScene *)scene).windows ) {
59+ if (window.isKeyWindow ) {
60+ return window;
61+ }
62+ }
63+ }
64+ }
65+ // fall back to any connected scene if none is foreground-active yet
5566 for (UIScene *scene in UIApplication.sharedApplication .connectedScenes ) {
5667 if ([scene isKindOfClass: [UIWindowScene class ]]) {
57- UIWindowScene *windowScene = (UIWindowScene *)scene;
58- for (UIWindow *window in windowScene.windows ) {
68+ for (UIWindow *window in ((UIWindowScene *)scene).windows ) {
5969 if (window.isKeyWindow ) {
6070 return window;
6171 }
You can’t perform that action at this time.
0 commit comments