Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix/rotorgames#753' into build
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilienDup committed Jan 25, 2023
2 parents 5f86193 + 8a97f0a commit e6ab70c
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions Rg.Plugins.Popup/Platforms/Ios/Impl/PopupPlatformIos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,24 @@ public Task AddAsync(PopupPage page)
PopupWindow window;
if (IsiOS13OrNewer)
{
if (UIApplication.SharedApplication.ConnectedScenes.ToArray()
.FirstOrDefault(x => x.ActivationState == UISceneActivationState.ForegroundActive && x is UIWindowScene) is UIWindowScene connectedScene)
window = new PopupWindow(connectedScene);
var connectedWindowScene = UIApplication.SharedApplication
.ConnectedScenes
.ToArray()
.FirstOrDefault(scene =>
{
// The popup should only be displayed on a scene that displays interactive windows
// on the device’s built-in display or an externally connected display.
if (scene.Session?.Role != UIWindowSceneSessionRole.Application)
{
return false;
}
return scene.ActivationState == UISceneActivationState.ForegroundActive
&& scene is UIWindowScene;
}) as UIWindowScene;

if (connectedWindowScene != null)
window = new PopupWindow(connectedWindowScene);
else
window = new PopupWindow();

Expand Down

0 comments on commit e6ab70c

Please sign in to comment.