mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-04 05:26:48 +00:00
no message
This commit is contained in:
parent
a3e4d97b6e
commit
78fdebcce3
@ -232,62 +232,53 @@ public final class PendingMessageManager {
|
|||||||
|
|
||||||
let disposable = MetaDisposable()
|
let disposable = MetaDisposable()
|
||||||
let messages = self.postbox.messagesAtIds(ids)
|
let messages = self.postbox.messagesAtIds(ids)
|
||||||
|> deliverOn(self.queue)
|
|> deliverOn(self.queue)
|
||||||
|> afterDisposed { [weak self, weak disposable] in
|
|> afterDisposed { [weak self, weak disposable] in
|
||||||
if let strongSelf = self, let strongDisposable = disposable {
|
if let strongSelf = self, let strongDisposable = disposable {
|
||||||
strongSelf.beginSendingMessagesDisposables.remove(strongDisposable)
|
strongSelf.beginSendingMessagesDisposables.remove(strongDisposable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.beginSendingMessagesDisposables.add(disposable)
|
self.beginSendingMessagesDisposables.add(disposable)
|
||||||
disposable.set(messages.start(next: { [weak self] messages in
|
disposable.set(messages.start(next: { [weak self] messages in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
assert(strongSelf.queue.isCurrent())
|
assert(strongSelf.queue.isCurrent())
|
||||||
|
|
||||||
//var groupIds = Set<Int64>()
|
var currentGroupId: Int64? = nil
|
||||||
|
|
||||||
var currentGroupId:Int64? = nil
|
for message in messages.filter({ !$0.flags.contains(.Sending) }).sorted(by: { $0.id < $1.id }) {
|
||||||
|
|
||||||
for message in messages.filter({!$0.flags.contains(.Sending)}).sorted(by: { $0.id < $1.id }) {
|
|
||||||
guard let messageContext = strongSelf.messageContexts[message.id] else {
|
guard let messageContext = strongSelf.messageContexts[message.id] else {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let contentToUpload = messageContentToUpload(network: strongSelf.network, postbox: strongSelf.postbox, auxiliaryMethods: strongSelf.auxiliaryMethods, transformOutgoingMessageMedia: strongSelf.transformOutgoingMessageMedia, message: message)
|
let contentToUpload = messageContentToUpload(network: strongSelf.network, postbox: strongSelf.postbox, auxiliaryMethods: strongSelf.auxiliaryMethods, transformOutgoingMessageMedia: strongSelf.transformOutgoingMessageMedia, message: message)
|
||||||
|
|
||||||
switch contentToUpload {
|
switch contentToUpload {
|
||||||
case let .ready(content):
|
case let .ready(content):
|
||||||
|
if let groupingKey = message.groupingKey {
|
||||||
|
|
||||||
if let groupingKey = message.groupingKey {
|
|
||||||
strongSelf.beginSendingMessage(messageContext: messageContext, messageId: message.id, groupId: message.groupingKey, content: content)
|
|
||||||
if let current = currentGroupId, current != groupingKey {
|
|
||||||
strongSelf.beginSendingGroupIfPossible(groupId: current)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if let currentGroupId = currentGroupId {
|
|
||||||
strongSelf.beginSendingGroupIfPossible(groupId: currentGroupId)
|
|
||||||
strongSelf.beginSendingMessage(messageContext: messageContext, messageId: message.id, groupId: message.groupingKey, content: content)
|
strongSelf.beginSendingMessage(messageContext: messageContext, messageId: message.id, groupId: message.groupingKey, content: content)
|
||||||
|
if let current = currentGroupId, current != groupingKey {
|
||||||
|
strongSelf.beginSendingGroupIfPossible(groupId: current)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if let currentGroupId = currentGroupId {
|
||||||
|
strongSelf.beginSendingGroupIfPossible(groupId: currentGroupId)
|
||||||
|
}
|
||||||
strongSelf.beginSendingMessage(messageContext: messageContext, messageId: message.id, groupId: message.groupingKey, content: content)
|
strongSelf.beginSendingMessage(messageContext: messageContext, messageId: message.id, groupId: message.groupingKey, content: content)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
currentGroupId = message.groupingKey
|
||||||
currentGroupId = message.groupingKey
|
case let .upload(uploadSignal):
|
||||||
|
if strongSelf.canBeginUploadingMessage(id: message.id) {
|
||||||
case let .upload(uploadSignal):
|
strongSelf.beginUploadingMessage(messageContext: messageContext, id: message.id, groupId: message.groupingKey, uploadSignal: uploadSignal)
|
||||||
if strongSelf.canBeginUploadingMessage(id: message.id) {
|
} else {
|
||||||
strongSelf.beginUploadingMessage(messageContext: messageContext, id: message.id, groupId: message.groupingKey, uploadSignal: uploadSignal)
|
messageContext.state = .waitingForUploadToStart(groupId: message.groupingKey, upload: uploadSignal)
|
||||||
} else {
|
}
|
||||||
messageContext.state = .waitingForUploadToStart(groupId: message.groupingKey, upload: uploadSignal)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let currentGroupId = currentGroupId {
|
if let currentGroupId = currentGroupId {
|
||||||
strongSelf.beginSendingGroupIfPossible(groupId: currentGroupId)
|
strongSelf.beginSendingGroupIfPossible(groupId: currentGroupId)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -382,9 +382,6 @@ private func uploadedMediaFileContent(network: Network, postbox: Postbox, auxili
|
|||||||
if file.resource.headerSize != 0 {
|
if file.resource.headerSize != 0 {
|
||||||
hintFileIsLarge = true
|
hintFileIsLarge = true
|
||||||
}
|
}
|
||||||
if file.attributes.count == 1, case .FileName = file.attributes[0] {
|
|
||||||
hintFileIsLarge = true
|
|
||||||
}
|
|
||||||
let upload = multipartUpload(network: network, postbox: postbox, source: .resource(file.resource), encrypt: peerId.namespace == Namespaces.Peer.SecretChat, tag: TelegramMediaResourceFetchTag(statsCategory: statsCategoryForFileWithAttributes(file.attributes)), hintFileSize: hintSize, hintFileIsLarge: hintFileIsLarge)
|
let upload = multipartUpload(network: network, postbox: postbox, source: .resource(file.resource), encrypt: peerId.namespace == Namespaces.Peer.SecretChat, tag: TelegramMediaResourceFetchTag(statsCategory: statsCategoryForFileWithAttributes(file.attributes)), hintFileSize: hintSize, hintFileIsLarge: hintFileIsLarge)
|
||||||
|> mapError { _ -> PendingMessageUploadError in return .generic }
|
|> mapError { _ -> PendingMessageUploadError in return .generic }
|
||||||
var alreadyTransformed = false
|
var alreadyTransformed = false
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user