From 4acf9284f4681d7b6ef0a0d1c9a135a45a263d9d Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Fri, 16 Dec 2022 22:22:59 +0100 Subject: [PATCH] Revert "Feed calculation logic change" This reverts commit 2624b7dd0e07674f3639fb18618a5e11b3e9f53f. --- Model/FeedModel.swift | 4 +--- Model/HistoryModel.swift | 2 ++ Shared/Videos/WatchView.swift | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Model/FeedModel.swift b/Model/FeedModel.swift index 4189d250..3e13b782 100644 --- a/Model/FeedModel.swift +++ b/Model/FeedModel.swift @@ -130,9 +130,7 @@ final class FeedModel: ObservableObject, CacheModel { } let byChannel = Dictionary(grouping: unwatched) { $0.channel.id }.mapValues(\.count) - if self.unwatchedByChannel[account] != byChannel { - self.unwatchedByChannel[account] = byChannel - } + self.unwatchedByChannel[account] = byChannel } } } diff --git a/Model/HistoryModel.swift b/Model/HistoryModel.swift index bb23d1a6..14653419 100644 --- a/Model/HistoryModel.swift +++ b/Model/HistoryModel.swift @@ -107,6 +107,8 @@ extension PlayerModel { self.context.delete(watch) try? self.context.save() + + FeedModel.shared.calculateUnwatchedFeed() } } diff --git a/Shared/Videos/WatchView.swift b/Shared/Videos/WatchView.swift index 2128b8e8..64e253d8 100644 --- a/Shared/Videos/WatchView.swift +++ b/Shared/Videos/WatchView.swift @@ -42,6 +42,8 @@ struct WatchView: View { } else { Watch.markAsWatched(videoID: watch?.videoID ?? videoID, account: AccountsModel.shared.current, duration: watch?.videoDuration ?? duration, context: backgroundContext) } + + FeedModel.shared.calculateUnwatchedFeed() } var imageSystemName: String {