mirror of
https://github.com/yattee/yattee.git
synced 2026-10-31 08:57:17 +00:00
Make the player pill an on/off setting on iPad, drop the dead wide-layout pill overlay
On iPad both orientations show the video next to a panel, the corner layout hosts the portrait panel in landscape, and Split View windows make "portrait" mean "narrow", so the portrait/landscape visibility split never matched what the user saw. PillVisibility now treats any mode except Never as visible on iPad, and the pill editor shows a Show pill toggle there (writes Both/Never, reads synced orientation modes as on). iPhone keeps the four-way picker. ExpandedPlayerSheet's bottomPillsOverlay was unreferenced; the floating panel renders its own pill row.
This commit is contained in:
@@ -41,23 +41,39 @@ struct PlayerPillEditorView: View {
|
||||
|
||||
private var visibilitySection: some View {
|
||||
Section {
|
||||
Picker(
|
||||
String(localized: "pill.visibility.title"),
|
||||
selection: $visibility
|
||||
) {
|
||||
ForEach(PillVisibility.allCases, id: \.self) { mode in
|
||||
Text(mode.displayName).tag(mode)
|
||||
if PillVisibility.isOrientationAgnostic {
|
||||
// iPad: on/off only. Any orientation mode from a synced preset
|
||||
// reads as "on"; turning it on stores `.both` so the preset
|
||||
// shows the pill everywhere on iPhone too.
|
||||
Toggle(
|
||||
String(localized: "pill.visibility.title"),
|
||||
isOn: Binding(
|
||||
get: { visibility.isEnabled },
|
||||
set: { visibility = $0 ? .both : .never }
|
||||
)
|
||||
)
|
||||
.disabled(!viewModel.canEditActivePreset)
|
||||
} else {
|
||||
Picker(
|
||||
String(localized: "pill.visibility.title"),
|
||||
selection: $visibility
|
||||
) {
|
||||
ForEach(PillVisibility.allCases, id: \.self) { mode in
|
||||
Text(mode.displayName).tag(mode)
|
||||
}
|
||||
}
|
||||
}
|
||||
.disabled(!viewModel.canEditActivePreset)
|
||||
.onChange(of: visibility) { _, newValue in
|
||||
guard newValue != viewModel.pillVisibility else { return }
|
||||
viewModel.syncPillVisibility(newValue)
|
||||
.disabled(!viewModel.canEditActivePreset)
|
||||
}
|
||||
} header: {
|
||||
Text(String(localized: "pill.visibility.header"))
|
||||
} footer: {
|
||||
Text(String(localized: "pill.visibility.footer"))
|
||||
Text(String(localized: PillVisibility.isOrientationAgnostic
|
||||
? "pill.visibility.footer.toggle"
|
||||
: "pill.visibility.footer"))
|
||||
}
|
||||
.onChange(of: visibility) { _, newValue in
|
||||
guard newValue != viewModel.pillVisibility else { return }
|
||||
viewModel.syncPillVisibility(newValue)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user