diff --git a/Shared/Defaults.swift b/Shared/Defaults.swift index 4b19922a..f6347413 100644 --- a/Shared/Defaults.swift +++ b/Shared/Defaults.swift @@ -187,11 +187,12 @@ extension Defaults.Keys { static let showMPVPlaybackStats = Key("showMPVPlaybackStats", default: false) #if os(macOS) - static let playerDetailsPageButtonLabelStyleDefault = PlayerDetailsPageButtonLabelStyle.iconAndText + static let playerDetailsPageButtonLabelStyleDefault = ButtonLabelStyle.iconAndText #else - static let playerDetailsPageButtonLabelStyleDefault = UIDevice.current.userInterfaceIdiom == .phone ? PlayerDetailsPageButtonLabelStyle.iconOnly : .iconAndText + static let playerDetailsPageButtonLabelStyleDefault = UIDevice.current.userInterfaceIdiom == .phone ? ButtonLabelStyle.iconOnly : .iconAndText #endif - static let playerDetailsPageButtonLabelStyle = Key("playerDetailsPageButtonLabelStyle", default: playerDetailsPageButtonLabelStyleDefault) + static let playerActionsButtonLabelStyle = Key("playerActionsButtonLabelStyle", default: .iconAndText) + static let playerDetailsPageButtonLabelStyle = Key("playerDetailsPageButtonLabelStyle", default: playerDetailsPageButtonLabelStyleDefault) static let systemControlsCommands = Key("systemControlsCommands", default: .restartAndAdvanceToNext) static let mpvCacheSecs = Key("mpvCacheSecs", default: "120") @@ -305,7 +306,7 @@ enum WatchedVideoPlayNowBehavior: String, Defaults.Serializable { } #endif -enum PlayerDetailsPageButtonLabelStyle: String, CaseIterable, Defaults.Serializable { +enum ButtonLabelStyle: String, CaseIterable, Defaults.Serializable { case iconOnly, iconAndText var text: Bool { diff --git a/Shared/Player/Video Details/VideoActions.swift b/Shared/Player/Video Details/VideoActions.swift index 146bae80..c9e34268 100644 --- a/Shared/Player/Video Details/VideoActions.swift +++ b/Shared/Player/Video Details/VideoActions.swift @@ -9,6 +9,8 @@ struct VideoActions: View { var video: Video? + @Default(.playerActionsButtonLabelStyle) private var playerActionsButtonLabelStyle + var body: some View { HStack { if let video { @@ -82,13 +84,15 @@ struct VideoActions: View { VStack(spacing: 3) { Image(systemName: systemImage) .frame(width: 20, height: 20) - Text(name) - .foregroundColor(.secondary) - .font(.caption2) - .allowsTightening(true) + if playerActionsButtonLabelStyle.text { + Text(name) + .foregroundColor(.secondary) + .font(.caption2) + .allowsTightening(true) + } } - .padding(.horizontal, 6) - .padding(.vertical, 5) + .padding(.horizontal, playerActionsButtonLabelStyle.text ? 6 : 12) + .padding(.vertical, playerActionsButtonLabelStyle.text ? 5 : 10) .contentShape(Rectangle()) } .buttonStyle(.plain) diff --git a/Shared/Settings/PlayerSettings.swift b/Shared/Settings/PlayerSettings.swift index fba6a91f..3983de17 100644 --- a/Shared/Settings/PlayerSettings.swift +++ b/Shared/Settings/PlayerSettings.swift @@ -6,6 +6,7 @@ struct PlayerSettings: View { @Default(.playerInstanceID) private var playerInstanceID @Default(.playerSidebar) private var playerSidebar + @Default(.playerActionsButtonLabelStyle) private var playerActionsButtonLabelStyle @Default(.playerDetailsPageButtonLabelStyle) private var playerDetailsPageButtonLabelStyle @Default(.detailsToolbarPosition) private var detailsToolbarPosition @Default(.showInspector) private var showInspector @@ -92,7 +93,7 @@ struct PlayerSettings: View { } #endif - Section(header: SettingsHeader(text: "Interface".localized())) { + let interface = Section(header: SettingsHeader(text: "Interface".localized())) { #if os(iOS) if idiom == .pad { sidebarPicker @@ -109,9 +110,22 @@ struct PlayerSettings: View { } } + #if os(tvOS) + if !accounts.isEmpty { + interface + } + #elseif os(macOS) + interface + #elseif os(iOS) + if idiom == .pad || !accounts.isEmpty { + interface + } + #endif + #if !os(tvOS) Section(header: SettingsHeader(text: "Video Details").padding(.bottom, videoDetailsHeaderPadding)) { SettingsHeader(text: "Buttons labels".localized(), secondary: true) + playerActionsButtonLabelStylePicker detailsButtonLabelStylePicker SettingsHeader(text: "Show Inspector".localized(), secondary: true) @@ -196,10 +210,18 @@ struct PlayerSettings: View { .modifier(SettingsPickerModifier()) } + private var playerActionsButtonLabelStylePicker: some View { + Picker("Video actions buttons", selection: $playerActionsButtonLabelStyle) { + Text("Show only icons").tag(ButtonLabelStyle.iconOnly) + Text("Show icons and text when space permits").tag(ButtonLabelStyle.iconAndText) + } + .modifier(SettingsPickerModifier()) + } + private var detailsButtonLabelStylePicker: some View { - Picker("Buttons labels", selection: $playerDetailsPageButtonLabelStyle) { - Text("Show only icons").tag(PlayerDetailsPageButtonLabelStyle.iconOnly) - Text("Show icons and text when space permits").tag(PlayerDetailsPageButtonLabelStyle.iconAndText) + Picker("Pages buttons", selection: $playerDetailsPageButtonLabelStyle) { + Text("Show only icons").tag(ButtonLabelStyle.iconOnly) + Text("Show icons and text when space permits").tag(ButtonLabelStyle.iconAndText) } .modifier(SettingsPickerModifier()) }