mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-21 22:54:11 +08:00
[notification] Debounce new mail notification sound
Summary: We don't want to overwhelm a user with a bunch of bings and bongs when they open their laptop after a long weekend. This diff takes a relatively simple approach by debouncing the notification sounds every 5 seconds. Test Plan: Run locally, make sure we still get notified but not too much. Reviewers: juan, evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D3841
This commit is contained in:
parent
6e09be9b4b
commit
91f55cebf5
1 changed files with 2 additions and 1 deletions
|
@ -180,7 +180,8 @@ export class Notifier {
|
|||
}
|
||||
if (!this.hasScheduledNotify) {
|
||||
if (NylasEnv.config.get("core.notifications.sounds")) {
|
||||
SoundRegistry.playSound('new-mail');
|
||||
this._playNewMailSound = this._playNewMailSound || _.debounce(() => SoundRegistry.playSound('new-mail'), 5000, true);
|
||||
this._playNewMailSound();
|
||||
}
|
||||
this._notifyMessages();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue