Player bar visibility modes and settings

This commit is contained in:
Arkadiusz Fal
2022-12-17 19:35:07 +01:00
parent 8e5bafba58
commit fcf527fa87
20 changed files with 320 additions and 168 deletions

View File

@@ -21,6 +21,9 @@ struct BrowsingSettings: View {
@Default(.showOpenActionsToolbarItem) private var showOpenActionsToolbarItem
@Default(.homeHistoryItems) private var homeHistoryItems
@Default(.visibleSections) private var visibleSections
@Default(.playerButtonSingleTapGesture) private var playerButtonSingleTapGesture
@Default(.playerButtonDoubleTapGesture) private var playerButtonDoubleTapGesture
@Default(.playerButtonShowsControlButtonsWhenMinimized) private var playerButtonShowsControlButtonsWhenMinimized
@ObservedObject private var accounts = AccountsModel.shared
@@ -65,6 +68,7 @@ struct BrowsingSettings: View {
interface
}
#else
playerBarSettings
interface
#endif
if !accounts.isEmpty {
@@ -150,6 +154,32 @@ struct BrowsingSettings: View {
}
}
#if !os(tvOS)
private var playerBarSettings: some View {
Section(header: SettingsHeader(text: "Player Bar".localized()), footer: playerBarFooter) {
Toggle("Always show controls buttons", isOn: $playerButtonShowsControlButtonsWhenMinimized)
playerBarGesturePicker("Single tap gesture", selection: $playerButtonSingleTapGesture)
playerBarGesturePicker("Double tap gesture", selection: $playerButtonDoubleTapGesture)
}
}
func playerBarGesturePicker(_ label: String, selection: Binding<PlayerTapGestureAction>) -> some View {
Picker(label, selection: selection) {
ForEach(PlayerTapGestureAction.allCases, id: \.rawValue) { action in
Text(action.label).tag(action)
}
}
}
var playerBarFooter: some View {
#if os(iOS)
Text("Tap and hold channel thumbnail to open context menu with more actions")
#elseif os(macOS)
Text("Right click channel thumbnail to open context menu with more actions")
#endif
}
#endif
private var interfaceSettings: some View {
Section(header: SettingsHeader(text: "Interface".localized())) {
#if !os(tvOS)

View File

@@ -10,7 +10,7 @@ struct SettingsView: View {
case browsing, player, quality, history, sponsorBlock, locations, advanced, help
}
@State private var selection: Tabs?
@State private var selection: Tabs = .browsing
#endif
@Environment(\.colorScheme) private var colorScheme
@@ -224,10 +224,8 @@ struct SettingsView: View {
#if os(macOS)
private var windowHeight: Double {
switch selection {
case nil:
return accounts.isEmpty ? 680 : 580
case .browsing:
return 580
return 680
case .player:
return 900
case .quality: