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:
Arkadiusz Fal
2026-09-27 16:36:42 +02:00
parent 61786ec6f7
commit 7f74b50e94
4 changed files with 54 additions and 209 deletions

View File

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