mirror of
				https://github.com/yattee/yattee.git
				synced 2025-11-03 22:22:02 +00:00 
			
		
		
		
	Add setting for toggle video watch status
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user