File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
src/Essentials/src/Platform Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -140,7 +140,8 @@ public void Init(Func<UIViewController?>? getCurrentUIViewController) =>
140140 try
141141 {
142142 using var scenes = UIApplication . SharedApplication . ConnectedScenes ;
143- var windowScene = scenes . ToArray < UIWindowScene > ( ) . FirstOrDefault ( ) ;
143+ var windowScene = scenes . ToArray ( ) . OfType < UIWindowScene > ( ) . FirstOrDefault ( scene =>
144+ scene . Session . Role == UIWindowSceneSessionRole . Application ) ;
144145 return windowScene ? . Windows . FirstOrDefault ( ) ;
145146 }
146147 catch ( InvalidCastException )
@@ -163,7 +164,8 @@ public void Init(Func<UIViewController?>? getCurrentUIViewController) =>
163164 try
164165 {
165166 using var scenes = UIApplication . SharedApplication . ConnectedScenes ;
166- var windowScene = scenes . ToArray < UIWindowScene > ( ) . FirstOrDefault ( ) ;
167+ var windowScene = scenes . ToArray ( ) . OfType < UIWindowScene > ( ) . FirstOrDefault ( scene =>
168+ scene . Session . Role == UIWindowSceneSessionRole . Application ) ;
167169 return windowScene ? . Windows ;
168170 }
169171 catch ( InvalidCastException )
You can’t perform that action at this time.
0 commit comments