Add shouldShowChaptersInfoInBottomOverlay to Settings.Overlay

This commit is contained in:
PangMo5 2022-07-14 00:07:27 +09:00
parent add9615aa8
commit f1bf247f5a
6 changed files with 19 additions and 3 deletions

View File

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

View File

@ -73,6 +73,10 @@ extension Defaults.Keys {
default: true,
suite: SwiftfinStore.Defaults.generalSuite)
static let shouldShowChaptersInfoInBottomOverlay = Key<Bool>("shouldShowChaptersInfoInBottomOverlay",
default: true,
suite: SwiftfinStore.Defaults.generalSuite)
// Experimental settings
enum Experimental {
static let syncSubtitleStateWithAdjacent = Key<Bool>("experimental.syncSubtitleState",

View File

@ -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]

View File

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

View File

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