mirror of
https://github.com/yattee/yattee.git
synced 2026-10-28 15:37:17 +00:00
Look up the foreground scene instead of the first connected one
The swipe-action share sheet, the expanded player's safe area and the Dynamic Island side check took connectedScenes.first, which ignores which scene is active (on the iPhone Duo it can be the other panel's) and presented the share sheet from the main window, behind an expanded player. UIApplication.foregroundWindowScene/foregroundWindow resolve the foreground-active scene (else foreground-inactive, else any) and its key window, the order the widescreen layout already used. The share sheet now presents from the key window, which is the player's while it is up. The tvOS display mode manager uses the same lookup.
This commit is contained in:
@@ -186,9 +186,9 @@ struct VideoSwipeActionsModifier: ViewModifier {
|
||||
activityItems: [appEnvironment?.shareURL(for: video) ?? video.shareURL],
|
||||
applicationActivities: nil
|
||||
)
|
||||
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
|
||||
let window = windowScene.windows.first,
|
||||
let rootVC = window.rootViewController {
|
||||
// The key window is the expanded player's while it is up, so the
|
||||
// share sheet opens above it rather than behind it.
|
||||
if let rootVC = UIApplication.shared.foregroundWindow?.rootViewController {
|
||||
// Find the top-most view controller
|
||||
var topVC = rootVC
|
||||
while let presented = topVC.presentedViewController {
|
||||
|
||||
Reference in New Issue
Block a user