From 6c7c0772fd36e220cc382664149cf17d768f3db5 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sun, 11 Oct 2026 23:57:38 +0200 Subject: [PATCH] Show the Foldable playback settings on hinged devices The section carried its own hinge observer but rendered nothing until a hinge was reported, so the observer never attached and the section never appeared. Observe the hinge on the always-present form instead. --- .../Views/Settings/PlaybackSettingsView.swift | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/Yattee/Views/Settings/PlaybackSettingsView.swift b/Yattee/Views/Settings/PlaybackSettingsView.swift index 0392772a..8aca7935 100644 --- a/Yattee/Views/Settings/PlaybackSettingsView.swift +++ b/Yattee/Views/Settings/PlaybackSettingsView.swift @@ -9,6 +9,9 @@ import SwiftUI struct PlaybackSettingsView: View { @Environment(\.appEnvironment) private var appEnvironment + #if os(iOS) + @State private var hasHinge = HingeLayoutObserver.forceTabletop + #endif var body: some View { SettingsFormContainer { @@ -23,10 +26,17 @@ struct PlaybackSettingsView: View { QueueSection(settings: settings) #if os(iOS) OrientationSection(settings: settings) - FoldableSection(settings: settings) + if hasHinge { + FoldableSection(settings: settings) + } #endif } } + #if os(iOS) + // Observed on the always-present form: an observer on the hidden + // section itself would have no view to attach to and never fire. + .observeHinge(hasHinge: $hasHinge) + #endif #if !os(tvOS) .navigationTitle(String(localized: "settings.playback.title")) #endif @@ -369,23 +379,17 @@ private struct QueueSection: View { /// iPhone Duo only: options for the tabletop (laptop-like) player layout. private struct FoldableSection: View { @Bindable var settings: SettingsManager - @State private var hasHinge = HingeLayoutObserver.forceTabletop var body: some View { - Group { - if hasHinge { - SettingsFormSection( - "settings.playback.foldable.header", - footer: "settings.playback.foldable.tabletopReflection.footer" - ) { - Toggle( - String(localized: "settings.playback.foldable.tabletopReflection"), - isOn: $settings.tabletopReflection - ) - } - } + SettingsFormSection( + "settings.playback.foldable.header", + footer: "settings.playback.foldable.tabletopReflection.footer" + ) { + Toggle( + String(localized: "settings.playback.foldable.tabletopReflection"), + isOn: $settings.tabletopReflection + ) } - .observeHinge(hasHinge: $hasHinge) } } #endif