Add options for history: badge color and reset watched status on playing

This commit is contained in:
Arkadiusz Fal
2022-01-02 20:39:19 +01:00
parent 117057dd0e
commit e29982454b
9 changed files with 135 additions and 9 deletions

View File

@@ -13,7 +13,9 @@ struct HistorySettings: View {
@Default(.showWatchingProgress) private var showWatchingProgress
@Default(.watchedThreshold) private var watchedThreshold
@Default(.watchedVideoStyle) private var watchedVideoStyle
@Default(.watchedVideoBadgeColor) private var watchedVideoBadgeColor
@Default(.watchedVideoPlayNowBehavior) private var watchedVideoPlayNowBehavior
@Default(.resetWatchedStatusOnPlaying) private var resetWatchedStatusOnPlaying
var body: some View {
Group {
@@ -26,14 +28,18 @@ struct HistorySettings: View {
#if !os(tvOS)
watchedThresholdPicker
watchedVideoStylePicker
watchedVideoBadgeColorPicker
watchedVideoPlayNowBehaviorPicker
resetWatchedStatusOnPlayingToggle
#endif
}
#if os(tvOS)
watchedThresholdPicker
watchedVideoStylePicker
watchedVideoBadgeColorPicker
watchedVideoPlayNowBehaviorPicker
resetWatchedStatusOnPlayingToggle
#endif
#if os(macOS)
@@ -68,6 +74,7 @@ struct HistorySettings: View {
Text("Nothing").tag(WatchedVideoStyle.nothing)
Text("Badge").tag(WatchedVideoStyle.badge)
Text("Decreased opacity").tag(WatchedVideoStyle.decreasedOpacity)
Text("Badge & Decreased opacity").tag(WatchedVideoStyle.both)
}
.disabled(!saveHistory)
.labelsHidden()
@@ -80,6 +87,25 @@ struct HistorySettings: View {
}
}
private var watchedVideoBadgeColorPicker: some View {
Section(header: header("Badge color")) {
Picker("Badge color", selection: $watchedVideoBadgeColor) {
Text("Based on system color scheme").tag(WatchedVideoBadgeColor.colorSchemeBased)
Text("Blue").tag(WatchedVideoBadgeColor.blue)
Text("Red").tag(WatchedVideoBadgeColor.red)
}
.disabled(!saveHistory)
.disabled(watchedVideoStyle == .decreasedOpacity)
.labelsHidden()
#if os(iOS)
.pickerStyle(.automatic)
#elseif os(tvOS)
.pickerStyle(.inline)
#endif
}
}
private var watchedVideoPlayNowBehaviorPicker: some View {
Section(header: header("When partially watched video is played")) {
Picker("When partially watched video is played", selection: $watchedVideoPlayNowBehavior) {
@@ -97,6 +123,10 @@ struct HistorySettings: View {
}
}
private var resetWatchedStatusOnPlayingToggle: some View {
Toggle("Reset watched status when playing again", isOn: $resetWatchedStatusOnPlaying)
}
private var clearHistoryButton: some View {
Button("Clear History") {
presentingClearHistoryConfirmation = true

View File

@@ -75,7 +75,7 @@ struct SettingsView: View {
.tag(Tabs.updates)
}
.padding(20)
.frame(width: 400, height: 380)
.frame(width: 400, height: 400)
#else
NavigationView {
List {