1
0
mirror of https://github.com/yattee/yattee.git synced 2025-04-28 07:50:33 +05:30

Add setting for toggle video watch status

This commit is contained in:
Arkadiusz Fal 2023-04-22 18:04:28 +02:00
parent f852782f5e
commit 2fe211edb4
3 changed files with 20 additions and 8 deletions

View File

@ -52,6 +52,7 @@ extension Defaults.Keys {
static let lockPortraitWhenBrowsing = Key<Bool>("lockPortraitWhenBrowsing", default: UIDevice.current.userInterfaceIdiom == .phone) static let lockPortraitWhenBrowsing = Key<Bool>("lockPortraitWhenBrowsing", default: UIDevice.current.userInterfaceIdiom == .phone)
#endif #endif
static let showUnwatchedFeedBadges = Key<Bool>("showUnwatchedFeedBadges", default: false) static let showUnwatchedFeedBadges = Key<Bool>("showUnwatchedFeedBadges", default: false)
static let showToggleWatchedStatusButton = Key<Bool>("showToggleWatchedStatusButton", default: false)
static let expandChannelDescription = Key<Bool>("expandChannelDescription", default: false) static let expandChannelDescription = Key<Bool>("expandChannelDescription", default: false)
static let channelOnThumbnail = Key<Bool>("channelOnThumbnail", default: false) static let channelOnThumbnail = Key<Bool>("channelOnThumbnail", default: false)
static let timeOnThumbnail = Key<Bool>("timeOnThumbnail", default: true) static let timeOnThumbnail = Key<Bool>("timeOnThumbnail", default: true)

View File

@ -16,6 +16,7 @@ struct BrowsingSettings: View {
@Default(.thumbnailsQuality) private var thumbnailsQuality @Default(.thumbnailsQuality) private var thumbnailsQuality
@Default(.channelOnThumbnail) private var channelOnThumbnail @Default(.channelOnThumbnail) private var channelOnThumbnail
@Default(.timeOnThumbnail) private var timeOnThumbnail @Default(.timeOnThumbnail) private var timeOnThumbnail
@Default(.showToggleWatchedStatusButton) private var showToggleWatchedStatusButton
@Default(.showHome) private var showHome @Default(.showHome) private var showHome
@Default(.showFavoritesInHome) private var showFavoritesInHome @Default(.showFavoritesInHome) private var showFavoritesInHome
@Default(.showQueueInHome) private var showQueueInHome @Default(.showQueueInHome) private var showQueueInHome
@ -244,6 +245,9 @@ struct BrowsingSettings: View {
#endif #endif
Toggle("Show channel name", isOn: $channelOnThumbnail) Toggle("Show channel name", isOn: $channelOnThumbnail)
Toggle("Show video length", isOn: $timeOnThumbnail) Toggle("Show video length", isOn: $timeOnThumbnail)
#if !os(tvOS)
Toggle("Show toggle watch status button", isOn: $showToggleWatchedStatusButton)
#endif
} }
} }

View File

@ -8,10 +8,12 @@ struct WatchView: View {
var duration: Double var duration: Double
@Default(.watchedVideoBadgeColor) private var watchedVideoBadgeColor @Default(.watchedVideoBadgeColor) private var watchedVideoBadgeColor
@Default(.showToggleWatchedStatusButton) private var showToggleWatchedStatusButton
var backgroundContext = PersistenceController.shared.container.newBackgroundContext() var backgroundContext = PersistenceController.shared.container.newBackgroundContext()
var body: some View { var body: some View {
if showToggleWatchedStatusButton {
#if os(tvOS) #if os(tvOS)
if finished { if finished {
image image
@ -23,6 +25,11 @@ struct WatchView: View {
.opacity(finished ? 1 : 0.4) .opacity(finished ? 1 : 0.4)
.buttonStyle(.plain) .buttonStyle(.plain)
#endif #endif
} else {
if finished {
image
}
}
} }
var image: some View { var image: some View {