Stats and recommendations improvements

This commit is contained in:
Ilya Laktyushin
2023-11-19 19:10:13 +04:00
parent 13baadc3e7
commit cc2bd5ec92
43 changed files with 25474 additions and 25369 deletions

View File

@@ -34,12 +34,12 @@ private func entryId(peerId: EnginePeer.Id) -> ItemCacheEntryId {
return ItemCacheEntryId(collectionId: Namespaces.CachedItemCollection.recommendedChannels, key: cacheKey)
}
func _internal_requestRecommendedChannels(account: Account, peerId: EnginePeer.Id) -> Signal<Never, NoError> {
func _internal_requestRecommendedChannels(account: Account, peerId: EnginePeer.Id, forceUpdate: Bool) -> Signal<Never, NoError> {
return account.postbox.transaction { transaction -> Peer? in
guard let channel = transaction.getPeer(peerId) else {
guard let channel = transaction.getPeer(peerId) as? TelegramChannel, case .broadcast = channel.info else {
return nil
}
if let entry = transaction.retrieveItemCacheEntry(id: entryId(peerId: peerId))?.get(CachedRecommendedChannels.self), !entry.peerIds.isEmpty {
if let entry = transaction.retrieveItemCacheEntry(id: entryId(peerId: peerId))?.get(CachedRecommendedChannels.self), !entry.peerIds.isEmpty && !forceUpdate {
return nil
} else {
return channel