mirror of
https://github.com/yattee/yattee.git
synced 2026-05-13 19:05:03 +00:00
Dismiss tvOS sidebar detail pages when sidebar selection changes
tvOS's sidebarAdaptable TabView leaves the previously-pushed detail view visible after the user picks another sidebar item, until they manually press Menu. Broadcast a notification on tab change so any pushed TVSidebarDetailContainer dismisses itself, and reset each tab's NavigationPath. Also drop a redundant inner NavigationStack in the tvOS SettingsView so subpages register on the tab's outer stack.
This commit is contained in:
@@ -9,6 +9,10 @@
|
||||
#if os(tvOS)
|
||||
import SwiftUI
|
||||
|
||||
extension Notification.Name {
|
||||
static let yatteeTVForcePopDetail = Notification.Name("yatteeTVForcePopDetail")
|
||||
}
|
||||
|
||||
struct TVSidebarDetailContainer<Content: View>: View {
|
||||
let content: Content
|
||||
var systemImage: String?
|
||||
@@ -65,6 +69,9 @@ struct TVSidebarDetailContainer<Content: View>: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.onReceive(NotificationCenter.default.publisher(for: .yatteeTVForcePopDetail)) { _ in
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user