From 4c0fae19eeed19547d8d8d93e9761e218d296337 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Fri, 16 Dec 2022 21:38:33 +0100 Subject: [PATCH] Feed calculation logic change --- Model/FeedModel.swift | 4 +++- Model/HistoryModel.swift | 2 -- Shared/Videos/WatchView.swift | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Model/FeedModel.swift b/Model/FeedModel.swift index 3e13b782..4189d250 100644 --- a/Model/FeedModel.swift +++ b/Model/FeedModel.swift @@ -130,7 +130,9 @@ final class FeedModel: ObservableObject, CacheModel { } let byChannel = Dictionary(grouping: unwatched) { $0.channel.id }.mapValues(\.count) - self.unwatchedByChannel[account] = byChannel + if self.unwatchedByChannel[account] != byChannel { + self.unwatchedByChannel[account] = byChannel + } } } } diff --git a/Model/HistoryModel.swift b/Model/HistoryModel.swift index 14653419..bb23d1a6 100644 --- a/Model/HistoryModel.swift +++ b/Model/HistoryModel.swift @@ -107,8 +107,6 @@ 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 64e253d8..2128b8e8 100644 --- a/Shared/Videos/WatchView.swift +++ b/Shared/Videos/WatchView.swift @@ -42,8 +42,6 @@ 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 {