This commit is contained in:
Ali
2023-07-13 23:51:40 +04:00
parent 03e64b2f74
commit 6f084010d8
40 changed files with 1922 additions and 99 deletions

View File

@@ -33,5 +33,28 @@ public extension TelegramEngine.EngineData.Item {
return EngineContactList(peers: view.peers.map(EnginePeer.init), presences: view.peerPresences.mapValues(EnginePeer.Presence.init))
}
}
public struct Top: TelegramEngineDataItem, PostboxViewDataItem {
public typealias Result = Array<EnginePeer.Id>
public init() {
}
var key: PostboxViewKey {
return .cachedItem(cachedRecentPeersEntryId())
}
func extract(view: PostboxView) -> [EnginePeer.Id] {
if let value = (view as? CachedItemView)?.value?.get(CachedRecentPeers.self) {
if value.enabled {
return value.ids
} else {
return []
}
} else {
return []
}
}
}
}
}