Feed calculation logic change

This commit is contained in:
Arkadiusz Fal 2022-12-16 21:38:33 +01:00
parent ee9e8bc064
commit 4c0fae19ee
3 changed files with 3 additions and 5 deletions

View File

@ -130,10 +130,12 @@ final class FeedModel: ObservableObject, CacheModel {
} }
let byChannel = Dictionary(grouping: unwatched) { $0.channel.id }.mapValues(\.count) let byChannel = Dictionary(grouping: unwatched) { $0.channel.id }.mapValues(\.count)
if self.unwatchedByChannel[account] != byChannel {
self.unwatchedByChannel[account] = byChannel self.unwatchedByChannel[account] = byChannel
} }
} }
} }
}
func markAllFeedAsWatched() { func markAllFeedAsWatched() {
guard let account = accounts.current, accounts.signedIn else { return } guard let account = accounts.current, accounts.signedIn else { return }

View File

@ -107,8 +107,6 @@ extension PlayerModel {
self.context.delete(watch) self.context.delete(watch)
try? self.context.save() try? self.context.save()
FeedModel.shared.calculateUnwatchedFeed()
} }
} }

View File

@ -42,8 +42,6 @@ struct WatchView: View {
} else { } else {
Watch.markAsWatched(videoID: watch?.videoID ?? videoID, account: AccountsModel.shared.current, duration: watch?.videoDuration ?? duration, context: backgroundContext) Watch.markAsWatched(videoID: watch?.videoID ?? videoID, account: AccountsModel.shared.current, duration: watch?.videoDuration ?? duration, context: backgroundContext)
} }
FeedModel.shared.calculateUnwatchedFeed()
} }
var imageSystemName: String { var imageSystemName: String {