Fixed new messages not showing when another message in the conversation is calculating its PoW

pull/43/head
Mikunj 7 years ago
parent 38d5b6e833
commit 676fe8b5c5

@ -909,6 +909,26 @@
return current; return current;
}, },
queueMessageSend(callback) {
const previous = this.pendingSend || Promise.resolve();
const taskWithTimeout = textsecure.createTaskWithTimeout(
callback,
`conversation ${this.idForLogging()}`
);
this.pendingSend = previous.then(taskWithTimeout, taskWithTimeout);
const current = this.pendingSend;
current.then(() => {
if (this.pendingSend === current) {
delete this.pendingSend;
}
});
return current;
},
getRecipients() { getRecipients() {
if (this.isPrivate()) { if (this.isPrivate()) {
return [this.id]; return [this.id];
@ -1078,20 +1098,26 @@
); );
const options = this.getSendOptions(); const options = this.getSendOptions();
return message.send(
this.wrapSend( // Add the message sending on another queue so that our UI doesn't get blocked
sendFunction( this.queueMessageSend(async () => {
destination, return message.send(
body, this.wrapSend(
attachmentsWithData, sendFunction(
quote, destination,
now, body,
expireTimer, attachmentsWithData,
profileKey, quote,
options now,
expireTimer,
profileKey,
options
)
) )
) );
); });
return true;
}); });
}, },
async updateTextInputState() { async updateTextInputState() {

Loading…
Cancel
Save