mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
no message
This commit is contained in:
@@ -253,7 +253,7 @@ public final class PendingMessageManager {
|
||||
private func beginSendingMessages(_ ids: [MessageId]) {
|
||||
assert(self.queue.isCurrent())
|
||||
|
||||
for id in ids {
|
||||
for id in ids.sorted() {
|
||||
let messageContext: PendingMessageContext
|
||||
if let current = self.messageContexts[id] {
|
||||
messageContext = current
|
||||
@@ -284,8 +284,6 @@ public final class PendingMessageManager {
|
||||
if let strongSelf = self {
|
||||
assert(strongSelf.queue.isCurrent())
|
||||
|
||||
var currentGroupId: Int64? = nil
|
||||
|
||||
for message in messages.filter({ !$0.flags.contains(.Sending) }).sorted(by: { $0.id < $1.id }) {
|
||||
guard let messageContext = strongSelf.messageContexts[message.id] else {
|
||||
continue
|
||||
@@ -300,16 +298,6 @@ public final class PendingMessageManager {
|
||||
} else {
|
||||
messageContext.state = .waitingForUploadToStart(groupId: message.groupingKey, upload: contentUploadSignal)
|
||||
}
|
||||
|
||||
if let _ = currentGroupId, message.groupingKey != currentGroupId {
|
||||
currentGroupId = nil
|
||||
} else {
|
||||
currentGroupId = message.groupingKey
|
||||
}
|
||||
}
|
||||
|
||||
if let currentGroupId = currentGroupId {
|
||||
strongSelf.beginSendingGroupIfPossible(groupId: currentGroupId)
|
||||
}
|
||||
}
|
||||
}))
|
||||
@@ -439,8 +427,10 @@ public final class PendingMessageManager {
|
||||
}
|
||||
self.addContextActivityIfNeeded(messageContext, peerId: id.peerId)
|
||||
|
||||
let queue = self.queue
|
||||
|
||||
messageContext.uploadDisposable.set((uploadSignal
|
||||
|> deliverOn(self.queue)
|
||||
|> deliverOn(queue)
|
||||
|> `catch` { [weak self] _ -> Signal<PendingMessageUploadedContentResult, NoError> in
|
||||
if let strongSelf = self {
|
||||
let modify = strongSelf.postbox.transaction { transaction -> Void in
|
||||
@@ -458,6 +448,19 @@ public final class PendingMessageManager {
|
||||
}
|
||||
}
|
||||
return .complete()
|
||||
}
|
||||
|> mapToSignal { result -> Signal<PendingMessageUploadedContentResult, NoError> in
|
||||
if groupId != nil, case .content = result {
|
||||
return Signal { subscriber in
|
||||
queue.justDispatch {
|
||||
subscriber.putNext(result)
|
||||
subscriber.putCompletion()
|
||||
}
|
||||
return EmptyDisposable
|
||||
}
|
||||
} else {
|
||||
return .single(result)
|
||||
}
|
||||
}).start(next: { [weak self] next in
|
||||
if let strongSelf = self {
|
||||
assert(strongSelf.queue.isCurrent())
|
||||
@@ -475,9 +478,9 @@ public final class PendingMessageManager {
|
||||
if let current = strongSelf.messageContexts[id] {
|
||||
strongSelf.beginSendingMessage(messageContext: current, messageId: id, groupId: groupId, content: content)
|
||||
strongSelf.updateWaitingUploads(peerId: id.peerId)
|
||||
//if let groupId = groupId {
|
||||
// strongSelf.beginSendingGroupIfPossible(groupId: groupId)
|
||||
// }
|
||||
if let groupId = groupId {
|
||||
strongSelf.beginSendingGroupIfPossible(groupId: groupId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -522,10 +525,10 @@ public final class PendingMessageManager {
|
||||
case let .content(content):
|
||||
if let current = strongSelf.messageContexts[contextId] {
|
||||
strongSelf.beginSendingMessage(messageContext: current, messageId: contextId, groupId: groupId, content: content)
|
||||
strongSelf.updateWaitingUploads(peerId: peerId)
|
||||
if let groupId = groupId {
|
||||
strongSelf.beginSendingGroupIfPossible(groupId: groupId)
|
||||
}
|
||||
strongSelf.updateWaitingUploads(peerId: peerId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user