mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 03:09:56 +00:00
preload history small optimization
This commit is contained in:
parent
7d335e817a
commit
3eec2e834e
@ -330,14 +330,14 @@ public final class AccountViewTracker {
|
||||
|
||||
private let externallyUpdatedPeerIdDisposable = MetaDisposable()
|
||||
|
||||
public let chatListPreloadItems = Promise<[ChatHistoryPreloadItem]>([])
|
||||
public let chatListPreloadItems = Promise<Set<ChatHistoryPreloadItem>>([])
|
||||
|
||||
init(account: Account) {
|
||||
self.account = account
|
||||
|
||||
self.historyViewStateValidationContexts = HistoryViewStateValidationContexts(queue: self.queue, postbox: account.postbox, network: account.network, accountPeerId: account.peerId)
|
||||
|
||||
self.chatHistoryPreloadManager = ChatHistoryPreloadManager(postbox: account.postbox, network: account.network, accountPeerId: account.peerId, networkState: account.networkState, preloadItemsSignal: self.chatListPreloadItems.get() |> distinctUntilChanged)
|
||||
self.chatHistoryPreloadManager = ChatHistoryPreloadManager(postbox: account.postbox, network: account.network, accountPeerId: account.peerId, networkState: account.networkState, preloadItemsSignal: self.chatListPreloadItems.get() |> distinctUntilChanged |> map { Array($0) })
|
||||
|
||||
self.externallyUpdatedPeerIdDisposable.set((account.stateManager.externallyUpdatedPeerIds
|
||||
|> deliverOn(self.queue)).start(next: { [weak self] peerIds in
|
||||
|
||||
@ -247,12 +247,19 @@ private final class AdditionalPreloadPeerIdsContext {
|
||||
}
|
||||
}
|
||||
|
||||
public struct ChatHistoryPreloadItem : Equatable {
|
||||
public struct ChatHistoryPreloadItem : Equatable, Hashable {
|
||||
public let index: ChatListIndex
|
||||
public let threadId: Int64?
|
||||
public let isMuted: Bool
|
||||
public let hasUnread: Bool
|
||||
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
hasher.combine(index.hashValue)
|
||||
if let threadId = threadId {
|
||||
hasher.combine(threadId)
|
||||
}
|
||||
}
|
||||
|
||||
public init(index: ChatListIndex, threadId: Int64?, isMuted: Bool, hasUnread: Bool) {
|
||||
self.index = index
|
||||
self.threadId = threadId
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user