mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-03 21:16:35 +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 messages = self.postbox.messagesAtIds(ids)
|
||||
|> deliverOn(self.queue)
|
||||
|> afterDisposed { [weak self, weak disposable] in
|
||||
if let strongSelf = self, let strongDisposable = disposable {
|
||||
strongSelf.beginSendingMessagesDisposables.remove(strongDisposable)
|
||||
}
|
||||
|> deliverOn(self.queue)
|
||||
|> afterDisposed { [weak self, weak disposable] in
|
||||
if let strongSelf = self, let strongDisposable = disposable {
|
||||
strongSelf.beginSendingMessagesDisposables.remove(strongDisposable)
|
||||
}
|
||||
}
|
||||
self.beginSendingMessagesDisposables.add(disposable)
|
||||
disposable.set(messages.start(next: { [weak self] messages in
|
||||
if let strongSelf = self {
|
||||
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 {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
let contentToUpload = messageContentToUpload(network: strongSelf.network, postbox: strongSelf.postbox, auxiliaryMethods: strongSelf.auxiliaryMethods, transformOutgoingMessageMedia: strongSelf.transformOutgoingMessageMedia, message: message)
|
||||
|
||||
switch contentToUpload {
|
||||
case let .ready(content):
|
||||
|
||||
|
||||
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)
|
||||
case let .ready(content):
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
currentGroupId = message.groupingKey
|
||||
|
||||
case let .upload(uploadSignal):
|
||||
if strongSelf.canBeginUploadingMessage(id: message.id) {
|
||||
strongSelf.beginUploadingMessage(messageContext: messageContext, id: message.id, groupId: message.groupingKey, uploadSignal: uploadSignal)
|
||||
} else {
|
||||
messageContext.state = .waitingForUploadToStart(groupId: message.groupingKey, upload: uploadSignal)
|
||||
}
|
||||
|
||||
currentGroupId = message.groupingKey
|
||||
case let .upload(uploadSignal):
|
||||
if strongSelf.canBeginUploadingMessage(id: message.id) {
|
||||
strongSelf.beginUploadingMessage(messageContext: messageContext, id: message.id, groupId: message.groupingKey, uploadSignal: uploadSignal)
|
||||
} else {
|
||||
messageContext.state = .waitingForUploadToStart(groupId: message.groupingKey, upload: uploadSignal)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let currentGroupId = currentGroupId {
|
||||
strongSelf.beginSendingGroupIfPossible(groupId: currentGroupId)
|
||||
}
|
||||
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
@ -382,9 +382,6 @@ private func uploadedMediaFileContent(network: Network, postbox: Postbox, auxili
|
||||
if file.resource.headerSize != 0 {
|
||||
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)
|
||||
|> mapError { _ -> PendingMessageUploadError in return .generic }
|
||||
var alreadyTransformed = false
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user