Add notification sound for incoming messages (#267)
This commit is contained in:
parent
01cec3ca91
commit
e56f7bc4c7
Binary file not shown.
|
|
@ -14,6 +14,11 @@ export const registerReactions = (stores: StoreMapping) => {
|
|||
stores.wsStore.listen((message) => {
|
||||
stores.messagesStore.publishSingleMessage(message);
|
||||
Notifications.notifyNewMessage(message);
|
||||
if (message.priority >= 4) {
|
||||
const src = 'static/notification.ogg';
|
||||
const audio = new Audio(src);
|
||||
audio.play();
|
||||
}
|
||||
});
|
||||
stores.appStore.refresh();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ export function notifyNewMessage(msg: IMessage) {
|
|||
const notify = new Notify(msg.title, {
|
||||
body: removeMarkdown(msg.message),
|
||||
icon: msg.image,
|
||||
silent: true,
|
||||
notifyClick: closeAndFocus,
|
||||
notifyShow: closeAfterTimeout,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1337,9 +1337,9 @@
|
|||
integrity sha512-p/sGgiPaathCfOtqu2fx5Mu1bcjuP8ALFg4xpGgNkcin7LwRyzUKniEHBKdcE1RPsenq5JVPIpMTJSygLboygQ==
|
||||
|
||||
"@types/notifyjs@^3.0.0":
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/notifyjs/-/notifyjs-3.0.0.tgz#a57126a90be2827d511d00a0615816cd5ca8a740"
|
||||
integrity sha512-ur3eot/3XOOYk9n/AEf904D2H7rT8FE6wWSDQVABErveLyGjBmboFAzPpThgooJ+F7mBPbTDhV+CM8sYa/TFgw==
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/notifyjs/-/notifyjs-3.0.1.tgz#eba3bec10e44309df4aba31a73bfd26a562bc755"
|
||||
integrity sha512-yTGCyGKVMUyL36usmerZbgC6bENPXBQC3OMqhdapzCsPzFcq1g8JFFAlbMjG3lHhkiT/0GKuG9H5IE+spkXZsA==
|
||||
|
||||
"@types/prop-types@*":
|
||||
version "15.7.3"
|
||||
|
|
|
|||
Loading…
Reference in New Issue