mirror of
https://github.com/yattee/yattee.git
synced 2026-11-04 02:47:18 +00:00
Open Settings from yattee://settings
SettingsView owns its navigation stack, so pushing it onto a section's stack rendered nothing. Select the Settings section where the layout has one, otherwise present Home's settings sheet; open the Settings window on macOS.
This commit is contained in:
@@ -198,6 +198,10 @@ struct HomeView: View {
|
||||
.liquidGlassSheetContent(sourceID: "homeSettings", in: sheetTransition)
|
||||
}
|
||||
.dismissesOnExternalNavigation($showingSettings)
|
||||
.onAppear { presentPendingSettingsSheet() }
|
||||
.onChange(of: appEnvironment?.navigationCoordinator.router.pendingSettingsSheet) { _, _ in
|
||||
presentPendingSettingsSheet()
|
||||
}
|
||||
#endif
|
||||
.sheet(isPresented: $showingRemoteControl) {
|
||||
RemoteDevicesSheet()
|
||||
@@ -306,6 +310,20 @@ struct HomeView: View {
|
||||
}
|
||||
}
|
||||
|
||||
#if !os(tvOS) && !os(macOS)
|
||||
/// Presents Settings for a request the layout had no Settings section for.
|
||||
/// Deferred a turn: the same external navigation also dismisses sheets,
|
||||
/// and that reset must not land after this one.
|
||||
private func presentPendingSettingsSheet() {
|
||||
guard let router = appEnvironment?.navigationCoordinator.router,
|
||||
router.pendingSettingsSheet else { return }
|
||||
router.pendingSettingsSheet = false
|
||||
Task { @MainActor in
|
||||
showingSettings = true
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// MARK: - Main Content
|
||||
|
||||
#if os(tvOS)
|
||||
|
||||
Reference in New Issue
Block a user