Honor "Keep channels with unwatched videos on top of subscriptions list"

setting in sidebar
This commit is contained in:
Arkadiusz Fal 2023-07-22 19:20:46 +02:00
parent 3c9e04d243
commit 99ffaed5fc

View File

@ -16,7 +16,7 @@ struct AppSidebarSubscriptions: View {
var body: some View {
Section(header: Text("Subscriptions")) {
ForEach(subscriptions.all) { channel in
ForEach(channels) { channel in
NavigationLink(tag: TabSelection.channel(channel.id), selection: $navigation.tabSelection) {
LazyView(ChannelVideosView(channel: channel))
} label: {
@ -44,6 +44,10 @@ struct AppSidebarSubscriptions: View {
}
}
}
var channels: [Channel] {
keepChannelsWithUnwatchedFeedOnTop ? subscriptions.allByUnwatchedCount : subscriptions.all
}
}
struct AppSidebarSubscriptions_Previews: PreviewProvider {