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,6 +1098,9 @@
); );
const options = this.getSendOptions(); const options = this.getSendOptions();
// Add the message sending on another queue so that our UI doesn't get blocked
this.queueMessageSend(async () => {
return message.send( return message.send(
this.wrapSend( this.wrapSend(
sendFunction( sendFunction(
@ -1093,6 +1116,9 @@
) )
); );
}); });
return true;
});
}, },
async updateTextInputState() { async updateTextInputState() {
// Check if we need to disable the text field // Check if we need to disable the text field

Loading…
Cancel
Save