enable notifications after 10seconds of start or reconnect

pull/924/head
Audric Ackermann 5 years ago
parent d6a9038198
commit f5b3eb394c
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -1470,8 +1470,10 @@
serverTrustRoot: window.getServerTrustRoot(),
};
// Whisper.Notifications.disable(); // avoid notification flood until empty
Whisper.Notifications.enable();
Whisper.Notifications.disable(); // avoid notification flood until empty
setTimeout(() => {
Whisper.Notifications.enable();
}, window.CONSTANTS.NOTIFICATION_ENABLE_TIMEOUT_SECONDS * 1000);
if (Whisper.Registration.ongoingSecondaryDeviceRegistration()) {
const ourKey = textsecure.storage.user.getNumber();
@ -1643,7 +1645,12 @@
// scenarios where we're coming back from sleep, we can get offline/online events
// very fast, and it looks like a network blip. But we need to suppress
// notifications in these scenarios too. So we listen for 'reconnect' events.
// Whisper.Notifications.disable();
Whisper.Notifications.disable();
// Enable back notifications once most messages have been fetched
setTimeout(() => {
Whisper.Notifications.enable();
}, window.CONSTANTS.NOTIFICATION_ENABLE_TIMEOUT_SECONDS * 1000);
}
function onProgress(ev) {
const { count } = ev;

@ -70,6 +70,7 @@ window.CONSTANTS = {
MAX_MESSAGE_BODY_LENGTH: 64 * 1024,
// Limited due to the proof-of-work requirement
SMALL_GROUP_SIZE_LIMIT: 10,
NOTIFICATION_ENABLE_TIMEOUT_SECONDS: 10, // number of seconds to turn on notifications after reconnect/start of app
};
window.versionInfo = {

Loading…
Cancel
Save