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:
Arkadiusz Fal
2026-10-05 23:37:14 +02:00
parent dea4f590ec
commit 498a282396
5 changed files with 66 additions and 4 deletions

View File

@@ -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)