fix sync message sending bug

pull/560/head
Ryan Zhao 4 years ago
parent 74ef42558b
commit 77e1f30bc9

@ -132,13 +132,13 @@ public final class MessageSender : NSObject {
guard message.isValid else { handleFailure(with: Error.invalidMessage, using: transaction); return promise } guard message.isValid else { handleFailure(with: Error.invalidMessage, using: transaction); return promise }
// Stop here if this is a self-send, unless it's: // Stop here if this is a self-send, unless it's:
// a configuration message // a configuration message
// a sync message // a sync message (visible message or expiration timer update message)
// a closed group control message of type `new` // a closed group control message of type `new`
// an unsend request // an unsend request
// a call message of type `answer` or `endCall` // a call message of type `answer` or `endCall`
guard !isSelfSend || isSyncMessage || shouldSyncMessage(message) else { guard !isSelfSend || shouldSyncMessage(message) else {
storage.write(with: { transaction in storage.write(with: { transaction in
MessageSender.handleSuccessfulMessageSend(message, to: destination, using: transaction) MessageSender.handleSuccessfulMessageSend(message, to: destination, isSyncMessage: isSyncMessage, using: transaction)
seal.fulfill(()) seal.fulfill(())
}, completion: { }) }, completion: { })
return promise return promise
@ -396,6 +396,6 @@ public final class MessageSender : NSObject {
} else { } else {
return false return false
} } ?? false } } ?? false
return isNewClosedGroupControlMessage || isCallControlMessage || message is ConfigurationMessage || message is UnsendRequest return isNewClosedGroupControlMessage || isCallControlMessage || message is ConfigurationMessage || message is UnsendRequest || message is VisibleMessage || message is ExpirationTimerUpdate
} }
} }

Loading…
Cancel
Save