1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 22:00:31 +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)
#endif
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 channelOnThumbnail = Key<Bool>("channelOnThumbnail", default: false)
static let timeOnThumbnail = Key<Bool>("timeOnThumbnail", default: true)

View File

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

View File

@ -8,21 +8,28 @@ struct WatchView: View {
var duration: Double
@Default(.watchedVideoBadgeColor) private var watchedVideoBadgeColor
@Default(.showToggleWatchedStatusButton) private var showToggleWatchedStatusButton
var backgroundContext = PersistenceController.shared.container.newBackgroundContext()
var body: some View {
#if os(tvOS)
if showToggleWatchedStatusButton {
#if os(tvOS)
if finished {
image
}
#else
Button(action: toggleWatch) {
image
}
.opacity(finished ? 1 : 0.4)
.buttonStyle(.plain)
#endif
} else {
if finished {
image
}
#else
Button(action: toggleWatch) {
image
}
.opacity(finished ? 1 : 0.4)
.buttonStyle(.plain)
#endif
}
}
var image: some View {