Skip to content

Commit

Permalink
Ensure that loading screen progress includes all message types
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal committed Nov 4, 2019
1 parent a905b2c commit b85943b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,18 @@

function addQueuedEventListener(name, handler) {
messageReceiver.addEventListener(name, (...args) =>
eventHandlerQueue.add(() => handler(...args))
eventHandlerQueue.add(async () => {
try {
await handler(...args);
} finally {
// message/sent: Message.handleDataMessage has its own queue and will trigger
// this event itself when complete.
// error: Error processing (below) also has its own queue and self-trigger.
if (name !== 'message' && name !== 'sent' && name !== 'error') {
Whisper.events.trigger('incrementProgress');
}
}
})
);
}

Expand Down Expand Up @@ -1753,6 +1764,8 @@
conversation.trigger('newmessage', model);
conversation.notify(model);

Whisper.events.trigger('incrementProgress');

if (ev.confirm) {
ev.confirm();
}
Expand Down

0 comments on commit b85943b

Please sign in to comment.