mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-17 11:00:07 +00:00
Fix holes
This commit is contained in:
parent
1b3b5aad52
commit
20b755baf3
@ -228,13 +228,14 @@ func fetchChatList(postbox: Postbox, network: Network, location: FetchChatListLo
|
||||
additionalPinnedChats = .single(nil)
|
||||
}
|
||||
|
||||
let flags: Int32 = 1 << 1
|
||||
var flags: Int32 = 1 << 1
|
||||
let requestFolderId: Int32
|
||||
|
||||
switch location {
|
||||
case .general:
|
||||
requestFolderId = 0
|
||||
case let .group(groupId):
|
||||
flags |= 1 << 0
|
||||
requestFolderId = groupId.rawValue
|
||||
}
|
||||
let requestChats = network.request(Api.functions.messages.getDialogs(flags: flags, folderId: requestFolderId, offsetDate: timestamp, offsetId: id, offsetPeer: peer, limit: limit, hash: hash))
|
||||
@ -336,6 +337,22 @@ func fetchChatList(postbox: Postbox, network: Network, location: FetchChatListLo
|
||||
storeMessages.append(contentsOf: folderChats.storeMessages)
|
||||
}
|
||||
|
||||
var pinnedItemIds: [PinnedItemId]?
|
||||
if let parsedPinnedChats = parsedPinnedChats {
|
||||
var array: [PinnedItemId] = []
|
||||
for itemId in parsedPinnedChats.itemIds {
|
||||
switch itemId {
|
||||
case let .peer(peerId):
|
||||
if peerGroupIds[peerId] == nil {
|
||||
array.append(itemId)
|
||||
}
|
||||
case .group:
|
||||
break
|
||||
}
|
||||
}
|
||||
pinnedItemIds = array
|
||||
}
|
||||
|
||||
return FetchedChatList(
|
||||
peers: peers,
|
||||
peerPresences: peerPresences,
|
||||
@ -348,7 +365,7 @@ func fetchChatList(postbox: Postbox, network: Network, location: FetchChatListLo
|
||||
|
||||
lowerNonPinnedIndex: parsedRemoteChats.lowerNonPinnedIndex,
|
||||
|
||||
pinnedItemIds: parsedPinnedChats.flatMap { $0.itemIds },
|
||||
pinnedItemIds: pinnedItemIds,
|
||||
folders: folders.map { ($0.0, $0.1.lowerNonPinnedIndex) },
|
||||
peerGroupIds: peerGroupIds
|
||||
)
|
||||
|
@ -385,12 +385,6 @@ func fetchChatListHole(postbox: Postbox, network: Network, accountPeerId: PeerId
|
||||
transaction.updatePeerGroupId(peerId, groupId: groupId)
|
||||
}
|
||||
|
||||
/*for (groupId, lowerIndex) in fetchedChats.folders {
|
||||
if let hole = postbox.seedConfiguration.initializeChatListWithHole.groups {
|
||||
transaction.replaceChatListHole(groupId: groupId, index: hole.index, hole: lowerIndex.flatMap(ChatListHole.init))
|
||||
}
|
||||
}*/
|
||||
|
||||
for (peerId, chatState) in fetchedChats.chatStates {
|
||||
if let chatState = chatState as? ChannelState {
|
||||
if let current = transaction.getPeerChatState(peerId) as? ChannelState {
|
||||
|
@ -690,6 +690,9 @@ func multipartFetch(postbox: Postbox, network: Network, mediaReferenceRevalidati
|
||||
switch info.reference {
|
||||
case let .avatar(peer, _):
|
||||
return resource.apiInputLocation(peerReference: peer)
|
||||
case let .messageAuthorAvatar(message, resource):
|
||||
|
||||
return nil
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user