Only show notifications when done with sync (#1507)
This prevents the parade of notifications if a machine wakes up from sleep. Basically covers situations that the loading screen doesn't already. When disabled, notifications will be cached until they are subsequently re-enabled, at which time all the pending notifications will be summarized. From the background page, notifications are disabled during connection attempts until an empty event. This means we can always safely call conversation.notify to queue a notification for the next batch, dropping some options from message and conversation model methods. We've also moved the calls to check window focus and draw attention to the window, which were previously included in the conversation model, but are now performed by the Notification system, because the time that the notification is displayed might be some time after the message is added by the conversation, so decisions about focus and attention should be made in that moment and not before. // FREEBIE
This commit is contained in:
parent
3b4fd2d0e0
commit
10a38297b8
4 changed files with 52 additions and 36 deletions
|
@ -326,10 +326,7 @@
|
|||
this.send(promise);
|
||||
}
|
||||
},
|
||||
handleDataMessage: function(dataMessage, confirm, options) {
|
||||
options = options || {};
|
||||
_.defaults(options, {initialLoadComplete: true});
|
||||
|
||||
handleDataMessage: function(dataMessage, confirm) {
|
||||
// This function is called from the background script in a few scenarios:
|
||||
// 1. on an incoming message
|
||||
// 2. on a sent message sync'd from another device
|
||||
|
@ -496,7 +493,7 @@
|
|||
// because we need to start expiration timers, etc.
|
||||
message.markRead();
|
||||
}
|
||||
if (message.get('unread') && options.initialLoadComplete) {
|
||||
if (message.get('unread')) {
|
||||
conversation.notify(message);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue