mirror of
https://github.com/yattee/yattee.git
synced 2026-11-01 09:27:18 +00:00
Invalidate the subscription feed when subscriptions change (#968)
Subscribing or unsubscribing, locally or via iCloud, only posted a notification, so the cached feed stayed valid and Yattee Server never received the new channel list until the cache expired. Invalidate the feed cache on every subscription add and removal, and skip the disk write when it is already stale.
This commit is contained in:
@@ -31,7 +31,10 @@ extension DataManager {
|
||||
|
||||
// Queue for CloudKit sync
|
||||
cloudKitSync?.queueSubscriptionSave(subscription)
|
||||
|
||||
|
||||
// The stateless feed must be rebuilt from the new channel list (#968)
|
||||
SubscriptionFeedCache.shared.invalidate()
|
||||
|
||||
let change = SubscriptionChange(addedSubscriptions: [subscription], removedChannelIDs: [])
|
||||
NotificationCenter.default.post(
|
||||
name: .subscriptionsDidChange,
|
||||
@@ -71,6 +74,8 @@ extension DataManager {
|
||||
cloudKitSync?.queueSubscriptionDelete(channelID: channelID, scope: scope)
|
||||
}
|
||||
|
||||
SubscriptionFeedCache.shared.invalidate()
|
||||
|
||||
let change = SubscriptionChange(addedSubscriptions: [], removedChannelIDs: [channelID])
|
||||
NotificationCenter.default.post(
|
||||
name: .subscriptionsDidChange,
|
||||
|
||||
Reference in New Issue
Block a user