From f1bf247f5a26bc2fe9dd3307c827af4ebbfffd6f Mon Sep 17 00:00:00 2001 From: PangMo5 Date: Thu, 14 Jul 2022 00:07:27 +0900 Subject: [PATCH] Add shouldShowChaptersInfoInBottomOverlay to Settings.Overlay --- Shared/Generated/Strings.swift | 2 ++ .../SwiftfinStore/SwiftfinStoreDefaults.swift | 4 ++++ .../VideoPlayerViewModel.swift | 2 ++ .../SettingsView/OverlaySettingsView.swift | 9 +++++++++ .../Overlays/VLCPlayerOverlayView.swift | 5 ++--- Translations/en.lproj/Localizable.strings | Bin 13562 -> 13714 bytes 6 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Shared/Generated/Strings.swift b/Shared/Generated/Strings.swift index 392492ec..a794cc91 100644 --- a/Shared/Generated/Strings.swift +++ b/Shared/Generated/Strings.swift @@ -354,6 +354,8 @@ internal enum L10n { internal static var settings: String { return L10n.tr("Localizable", "settings") } /// Show Cast & Crew internal static var showCastAndCrew: String { return L10n.tr("Localizable", "showCastAndCrew") } + /// Show Chapters Info In Bottom Overlay + internal static var showChaptersInfoInBottomOverlay: String { return L10n.tr("Localizable", "showChaptersInfoInBottomOverlay") } /// Flatten Library Items internal static var showFlattenView: String { return L10n.tr("Localizable", "showFlattenView") } /// Show Missing Episodes diff --git a/Shared/SwiftfinStore/SwiftfinStoreDefaults.swift b/Shared/SwiftfinStore/SwiftfinStoreDefaults.swift index 20630909..c25b0153 100644 --- a/Shared/SwiftfinStore/SwiftfinStoreDefaults.swift +++ b/Shared/SwiftfinStore/SwiftfinStoreDefaults.swift @@ -73,6 +73,10 @@ extension Defaults.Keys { default: true, suite: SwiftfinStore.Defaults.generalSuite) + static let shouldShowChaptersInfoInBottomOverlay = Key("shouldShowChaptersInfoInBottomOverlay", + default: true, + suite: SwiftfinStore.Defaults.generalSuite) + // Experimental settings enum Experimental { static let syncSubtitleStateWithAdjacent = Key("experimental.syncSubtitleState", diff --git a/Shared/ViewModels/VideoPlayerViewModel/VideoPlayerViewModel.swift b/Shared/ViewModels/VideoPlayerViewModel/VideoPlayerViewModel.swift index f515d5ad..69763874 100644 --- a/Shared/ViewModels/VideoPlayerViewModel/VideoPlayerViewModel.swift +++ b/Shared/ViewModels/VideoPlayerViewModel/VideoPlayerViewModel.swift @@ -131,6 +131,7 @@ final class VideoPlayerViewModel: ViewModel { let systemControlGesturesEnabled: Bool let seekSlideGestureEnabled: Bool let playerGesturesLockGestureEnabled: Bool + let shouldShowChaptersInfoInBottomOverlay: Bool let resumeOffset: Bool let streamType: ServerStreamType let container: String @@ -263,6 +264,7 @@ final class VideoPlayerViewModel: ViewModel { self.playerGesturesLockGestureEnabled = Defaults[.playerGesturesLockGestureEnabled] self.seekSlideGestureEnabled = Defaults[.seekSlideGestureEnabled] self.shouldShowJumpButtonsInOverlayMenu = Defaults[.shouldShowJumpButtonsInOverlayMenu] + self.shouldShowChaptersInfoInBottomOverlay = Defaults[.shouldShowChaptersInfoInBottomOverlay] self.resumeOffset = Defaults[.resumeOffset] diff --git a/Swiftfin/Views/SettingsView/OverlaySettingsView.swift b/Swiftfin/Views/SettingsView/OverlaySettingsView.swift index 1fa04dd1..537af6a6 100644 --- a/Swiftfin/Views/SettingsView/OverlaySettingsView.swift +++ b/Swiftfin/Views/SettingsView/OverlaySettingsView.swift @@ -21,6 +21,8 @@ struct OverlaySettingsView: View { var shouldShowAutoPlay @Default(.shouldShowJumpButtonsInOverlayMenu) var shouldShowJumpButtonsInOverlayMenu + @Default(.shouldShowChaptersInfoInBottomOverlay) + var shouldShowChaptersInfoInBottomOverlay var body: some View { Form { @@ -52,6 +54,13 @@ struct OverlaySettingsView: View { } } + Toggle(isOn: $shouldShowChaptersInfoInBottomOverlay) { + HStack { + Image(systemName: "photo.on.rectangle") + L10n.showChaptersInfoInBottomOverlay.text + } + } + Toggle(L10n.editJumpLengths, isOn: $shouldShowJumpButtonsInOverlayMenu) } } diff --git a/Swiftfin/Views/VideoPlayer/Overlays/VLCPlayerOverlayView.swift b/Swiftfin/Views/VideoPlayer/Overlays/VLCPlayerOverlayView.swift index 5e9af22d..79e21cf5 100644 --- a/Swiftfin/Views/VideoPlayer/Overlays/VLCPlayerOverlayView.swift +++ b/Swiftfin/Views/VideoPlayer/Overlays/VLCPlayerOverlayView.swift @@ -340,7 +340,7 @@ struct VLCPlayerOverlayView: View { } VStack(alignment: .leading, spacing: 0) { - if viewModel.overlayType == .normal, + if viewModel.shouldShowChaptersInfoInBottomOverlay, let currentChapter = viewModel.currentChapter { Button { @@ -352,7 +352,6 @@ struct VLCPlayerOverlayView: View { } .font(.system(size: 16, weight: .semibold, design: .default)) } - .padding(.leading, 16) } HStack { @@ -399,7 +398,7 @@ struct VLCPlayerOverlayView: View { Capsule().foregroundColor(.purple)) .background(Capsule().foregroundColor(Color.gray.opacity(0.75))) - if viewModel.overlayType == .normal { + if viewModel.shouldShowChaptersInfoInBottomOverlay { // Chapters seek masks ForEach(viewModel.chapters, id: \.startPositionTicks) { chapter in let ticksRatio = CGFloat(chapter.startPositionTicks ?? 0) / diff --git a/Translations/en.lproj/Localizable.strings b/Translations/en.lproj/Localizable.strings index 39a9f2cb085d02e95c8cf674ef8b1fdf8765493e..e6c374d09465f6e576ad88108c783a12295ff5bb 100644 GIT binary patch delta 153 zcmeyBIVpR?FO$hX6nW}17!nx@7)lsY8HyN+89W*C7}6N>!L$>QE&;-PhFk`JhBB~< z9H8n-1|KtJ;9>v(|CAq5 delta 7 OcmbP~{VQ|BFB1R}MFc+p