mirror of
https://github.com/yattee/yattee.git
synced 2025-08-05 02:04:07 +00:00
Add action to mark channel feed as watched/unwatched
This commit is contained in:
@@ -28,6 +28,9 @@ struct ChannelsView: View {
|
||||
.badge(channelBadge(channel))
|
||||
}
|
||||
.contextMenu {
|
||||
if subscriptions.isSubscribing(channel.id) {
|
||||
toggleWatchedButton(channel)
|
||||
}
|
||||
Button {
|
||||
subscriptions.unsubscribe(channel.id)
|
||||
} label: {
|
||||
@@ -124,6 +127,31 @@ struct ChannelsView: View {
|
||||
.padding(.top, 15)
|
||||
#endif
|
||||
}
|
||||
|
||||
@ViewBuilder func toggleWatchedButton(_ channel: Channel) -> some View {
|
||||
if feed.canMarkChannelAsWatched(channel.id) {
|
||||
markChannelAsWatchedButton(channel)
|
||||
} else {
|
||||
markChannelAsUnwatchedButton(channel)
|
||||
}
|
||||
}
|
||||
|
||||
func markChannelAsWatchedButton(_ channel: Channel) -> some View {
|
||||
Button {
|
||||
feed.markChannelAsWatched(channel.id)
|
||||
} label: {
|
||||
Label("Mark channel feed as watched", systemImage: "checkmark.circle.fill")
|
||||
}
|
||||
.disabled(!feed.canMarkAllFeedAsWatched)
|
||||
}
|
||||
|
||||
func markChannelAsUnwatchedButton(_ channel: Channel) -> some View {
|
||||
Button {
|
||||
feed.markChannelAsUnwatched(channel.id)
|
||||
} label: {
|
||||
Label("Mark channel feed as unwatched", systemImage: "checkmark.circle")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct ChannelsView_Previews: PreviewProvider {
|
||||
|
Reference in New Issue
Block a user