PMHandler now tracks unread messages and lights pm icon to notify user.
This commit is contained in:
parent
2feea72694
commit
64f9d713da
3 changed files with 92 additions and 15 deletions
|
|
@ -32,10 +32,23 @@ class pmPanel extends panelObj{
|
|||
*/
|
||||
this.activeSesh = "";
|
||||
|
||||
/**
|
||||
* Random UUID to identify the panel with the pmHandler
|
||||
*/
|
||||
this.uuid = crypto.randomUUID();
|
||||
|
||||
//Tell PMHandler to start tracking this panel
|
||||
this.client.pmHandler.panelList.set(this.uuid, null);
|
||||
|
||||
this.defineListeners();
|
||||
}
|
||||
|
||||
closer(){
|
||||
//Tell PMHandler to start tracking this panel
|
||||
this.client.pmHandler.panelList.delete(this.uuid);
|
||||
|
||||
//Run derived closer
|
||||
super.closer();
|
||||
}
|
||||
|
||||
docSwitch(){
|
||||
|
|
@ -146,6 +159,9 @@ class pmPanel extends panelObj{
|
|||
|
||||
//Set the first one as active
|
||||
this.activeSesh = seshList[0][1].id;
|
||||
|
||||
//Tell PMHandler what sesh we have open for notification reasons
|
||||
this.client.pmHandler.readSesh(this.uuid, this.activeSesh);
|
||||
}
|
||||
|
||||
//For each session tracked by the pmHandler
|
||||
|
|
@ -202,6 +218,9 @@ class pmPanel extends panelObj{
|
|||
//Set new sesh as active sesh
|
||||
event.target.classList.add('positive');
|
||||
|
||||
//Tell PMHandler what sesh we have open for notification reasons
|
||||
this.client.pmHandler.readSesh(this.uuid, this.activeSesh);
|
||||
|
||||
//Re-render message buffer
|
||||
this.renderMessages();
|
||||
}
|
||||
|
|
@ -296,18 +315,6 @@ class startSeshPopup{
|
|||
startSesh(event){
|
||||
//If we clicked or hit enter
|
||||
if(event.key == null || event.key == "Enter"){
|
||||
/*
|
||||
//Cook a new sesh from
|
||||
const newSesh = new pmSesh({
|
||||
//Split usernames by space
|
||||
sender: this.client.user.user,
|
||||
recipients: this.usernamePrompt.value.split(" ")
|
||||
});
|
||||
|
||||
//Pop new sesh into pmHandler
|
||||
this.client.pmHandler.seshList.set(newSesh.id, newSesh);
|
||||
*/
|
||||
|
||||
//Send message out to server
|
||||
this.client.pmSocket.emit("pm", {
|
||||
recipients: this.usernamePrompt.value.split(" "),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue