mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Merge branch 'master' into experimental-2
This commit is contained in:
@@ -72,15 +72,21 @@ final class MutableItemCollectionInfosView: MutablePostboxView {
|
||||
}
|
||||
self.entriesByNamespace = entriesByNamespace
|
||||
} else if !reloadTopItemCollectionIds.isEmpty {
|
||||
var entriesByNamespace = self.entriesByNamespace
|
||||
for (namespace, entries) in self.entriesByNamespace {
|
||||
var items: [ItemCollectionInfoEntry] = []
|
||||
for i in 0 ..< entries.count {
|
||||
if reloadTopItemCollectionIds.contains(entries[i].id) {
|
||||
updated = true
|
||||
let firstItem = postbox.itemCollectionItemTable.higherItems(collectionId: entries[i].id, itemIndex: ItemCollectionItemIndex.lowerBound, count: 1).first
|
||||
self.entriesByNamespace[namespace]![i] = ItemCollectionInfoEntry(id: entries[i].id, info: entries[i].info, count: postbox.itemCollectionItemTable.itemCount(collectionId: entries[i].id), firstItem: firstItem)
|
||||
items.append(ItemCollectionInfoEntry(id: entries[i].id, info: entries[i].info, count: postbox.itemCollectionItemTable.itemCount(collectionId: entries[i].id), firstItem: firstItem))
|
||||
} else {
|
||||
items.append(entriesByNamespace[namespace]![i])
|
||||
}
|
||||
}
|
||||
entriesByNamespace[namespace] = items
|
||||
}
|
||||
self.entriesByNamespace = entriesByNamespace
|
||||
}
|
||||
return updated
|
||||
}
|
||||
@@ -88,6 +94,8 @@ final class MutableItemCollectionInfosView: MutablePostboxView {
|
||||
func immutableView() -> PostboxView {
|
||||
return ItemCollectionInfosView(self)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public final class ItemCollectionInfosView: PostboxView {
|
||||
|
||||
@@ -270,7 +270,7 @@ public func searchMessages(account: Account, location: SearchMessagesLocation, q
|
||||
}
|
||||
}
|
||||
|> mapToSignal { (nextRate, lowerBound, inputPeer) in
|
||||
return account.network.request(Api.functions.messages.searchGlobal(flags: 0, folderId: nil, q: query, filter: filter, offsetRate: nextRate, offsetPeer: inputPeer, offsetId: lowerBound?.id.id ?? 0, limit: limit), automaticFloodWait: false)
|
||||
return account.network.request(Api.functions.messages.searchGlobal(flags: 0, folderId: nil, q: query, filter: .inputMessagesFilterEmpty, offsetRate: nextRate, offsetPeer: inputPeer, offsetId: lowerBound?.id.id ?? 0, limit: limit), automaticFloodWait: false)
|
||||
|> map { result -> (Api.messages.Messages?, Api.messages.Messages?) in
|
||||
return (result, nil)
|
||||
}
|
||||
@@ -293,12 +293,13 @@ public func searchMessages(account: Account, location: SearchMessagesLocation, q
|
||||
return (inputChannel, 0, lowerBound, .inputPeerEmpty)
|
||||
}
|
||||
}
|
||||
|> mapToSignal { (inputChannel, nextRate, lowerBound, inputPeer) in
|
||||
|> mapToSignal { (inputChannel, nextRate, lowerBound, inputPeer) -> Signal<(Api.messages.Messages?, Api.messages.Messages?), NoError> in
|
||||
guard let inputChannel = inputChannel else {
|
||||
return .complete()
|
||||
}
|
||||
return .single((nil, nil))
|
||||
|
||||
let request = Api.functions.stats.getMessagePublicForwards(channel: inputChannel, msgId: messageId.id, offsetRate: nextRate, offsetPeer: inputPeer, offsetId: lowerBound?.id.id ?? 0, limit: limit)
|
||||
/*let request = Api.functions.stats.getMessagePublicForwards(channel: inputChannel, msgId: messageId.id, offsetRate: nextRate, offsetPeer: inputPeer, offsetId: lowerBound?.id.id ?? 0, limit: limit)
|
||||
let signal: Signal<Api.messages.Messages, MTRpcError>
|
||||
if let datacenterId = datacenterId, account.network.datacenterId != datacenterId {
|
||||
signal = account.network.download(datacenterId: datacenterId, isMedia: false, tag: nil)
|
||||
@@ -315,7 +316,7 @@ public func searchMessages(account: Account, location: SearchMessagesLocation, q
|
||||
}
|
||||
|> `catch` { _ -> Signal<(Api.messages.Messages?, Api.messages.Messages?), NoError> in
|
||||
return .single((nil, nil))
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -534,9 +534,9 @@ extension StoreMessage {
|
||||
attributes.append(ViewCountMessageAttribute(count: Int(views)))
|
||||
}
|
||||
|
||||
if let forwards = forwards {
|
||||
/*if let forwards = forwards {
|
||||
attributes.append(ForwardCountMessageAttribute(count: Int(forwards)))
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
if let editDate = editDate {
|
||||
|
||||
Reference in New Issue
Block a user