@@ -29,8 +29,7 @@ + (UIWindow *)UIWindowForModalView {
29
29
dispatch_once (&onceToken, ^{
30
30
#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
31
31
if (@available (iOS 13.0 , *)) {
32
- UIWindowScene *foregroundedScene = [[self class ] foregroundedScene ];
33
- UIWindowForModal = [[UIWindow alloc ] initWithWindowScene: foregroundedScene];
32
+ UIWindowForModal = [[self class ] iOS13PlusWindow ];
34
33
} else {
35
34
#endif // defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
36
35
UIWindowForModal = [[UIWindow alloc ] initWithFrame: [UIScreen mainScreen ].bounds];
@@ -49,8 +48,7 @@ + (UIWindow *)UIWindowForBannerView {
49
48
dispatch_once (&onceToken, ^{
50
49
#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
51
50
if (@available (iOS 13.0 , *)) {
52
- UIWindowScene *foregroundedScene = [[self class ] foregroundedScene ];
53
- UIWindowForBanner = [[FIRIAMBannerViewUIWindow alloc ] initWithWindowScene: foregroundedScene];
51
+ UIWindowForBanner = [[self class ] iOS13PlusBannerWindow ];
54
52
} else {
55
53
#endif // defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
56
54
UIWindowForBanner =
@@ -71,8 +69,7 @@ + (UIWindow *)UIWindowForImageOnlyView {
71
69
dispatch_once (&onceToken, ^{
72
70
#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
73
71
if (@available (iOS 13.0 , *)) {
74
- UIWindowScene *foregroundedScene = [[self class ] foregroundedScene ];
75
- UIWindowForImageOnly = [[UIWindow alloc ] initWithWindowScene: foregroundedScene];
72
+ UIWindowForImageOnly = [[self class ] iOS13PlusWindow ];
76
73
} else {
77
74
#endif // defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
78
75
UIWindowForImageOnly = [[UIWindow alloc ] initWithFrame: [UIScreen mainScreen ].bounds];
@@ -94,6 +91,25 @@ + (UIWindowScene *)foregroundedScene API_AVAILABLE(ios(13.0)) {
94
91
}
95
92
return nil ;
96
93
}
94
+
95
+ + (UIWindow *)iOS13PlusWindow API_AVAILABLE (ios (13.0 )) {
96
+ UIWindowScene *foregroundedScene = [[self class ] foregroundedScene ];
97
+ if (foregroundedScene.delegate ) {
98
+ return [[UIWindow alloc ] initWithWindowScene: foregroundedScene];
99
+ } else {
100
+ return [[UIWindow alloc ] initWithFrame: [UIScreen mainScreen ].bounds];
101
+ }
102
+ }
103
+
104
+ + (FIRIAMBannerViewUIWindow *)iOS13PlusBannerWindow API_AVAILABLE (ios (13.0 )) {
105
+ UIWindowScene *foregroundedScene = [[self class ] foregroundedScene ];
106
+ if (foregroundedScene.delegate ) {
107
+ return [[FIRIAMBannerViewUIWindow alloc ] initWithWindowScene: foregroundedScene];
108
+ } else {
109
+ return [[FIRIAMBannerViewUIWindow alloc ] initWithFrame: [UIScreen mainScreen ].bounds];
110
+ }
111
+ }
112
+
97
113
#endif
98
114
@end
99
115
0 commit comments