Messages now play notification sounds.
This commit is contained in:
parent
976e157cf1
commit
e85fb18ce5
3 changed files with 51 additions and 2 deletions
|
|
@ -43,6 +43,21 @@ class pmHandler{
|
|||
*/
|
||||
this.panelList = new Map();
|
||||
|
||||
/**
|
||||
* PM RX Sound
|
||||
*/
|
||||
this.rxSound = '/nonfree/imrecv.ogg';
|
||||
|
||||
/**
|
||||
* Open Sesh Sound
|
||||
*/
|
||||
this.openSeshSound = '/nonfree/opensesh.ogg';
|
||||
|
||||
/**
|
||||
* End Sesh Sound
|
||||
*/
|
||||
this.endSeshSound = '/nonfree/closesesh.ogg';
|
||||
|
||||
this.defineListeners();
|
||||
this.setupInput();
|
||||
}
|
||||
|
|
@ -118,17 +133,30 @@ class pmHandler{
|
|||
//Generate a new sesh
|
||||
const sesh = new pmSesh(data, client);
|
||||
|
||||
|
||||
//Notify user of new message/sesh
|
||||
this.handlePing();
|
||||
this.handlePing((data.msg == '' || data.msg == null));
|
||||
|
||||
//Add it to the sesh list
|
||||
this.seshList.set(sesh.id, sesh);
|
||||
}
|
||||
|
||||
//If this isn't an empty message (sesh-starter), and PM's always make noise, and we didn't send the message
|
||||
if(data.msg != '' && data.msg != null && localStorage.getItem('rxPMSound') == 'all' && data.user != this.client.user.user){
|
||||
//make sum noize!
|
||||
utils.ux.playSound(this.rxSound);
|
||||
}
|
||||
}
|
||||
|
||||
handlePing(){
|
||||
handlePing(newSesh = false){
|
||||
//Light up the icon
|
||||
this.pmIcon.classList.add('positive-low');
|
||||
|
||||
if(newSesh && (localStorage.getItem('newSeshSound') == 'true')){
|
||||
utils.ux.playSound(this.openSeshSound);
|
||||
}else if(localStorage.getItem('rxPMSound') == 'unread'){
|
||||
utils.ux.playSound(this.rxSound);
|
||||
}
|
||||
}
|
||||
|
||||
//Handles UI updates after reading all messages
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue