Add function to show when message received

This commit is contained in:
Gregoire Parant 2020-11-17 16:46:46 +01:00
parent b0bd4c5f40
commit 64d00bda56
2 changed files with 11 additions and 2 deletions

View File

@ -40,8 +40,7 @@ export class DiscussionManager {
this.buttonActiveDiscussion.classList.add('active-btn'); this.buttonActiveDiscussion.classList.add('active-btn');
this.buttonActiveDiscussion.innerHTML = `<img src="resources/logos/discussion.svg"/>`; this.buttonActiveDiscussion.innerHTML = `<img src="resources/logos/discussion.svg"/>`;
this.buttonActiveDiscussion.addEventListener('click', () => { this.buttonActiveDiscussion.addEventListener('click', () => {
this.showDiscussion(); this.showDiscussionPart();
this.hideButtonDiscussionBtn();
}); });
this.divDiscuss.appendChild(buttonCloseDiscussion); this.divDiscuss.appendChild(buttonCloseDiscussion);
this.divDiscuss.appendChild(this.buttonActiveDiscussion); this.divDiscuss.appendChild(this.buttonActiveDiscussion);
@ -224,4 +223,9 @@ export class DiscussionManager {
public setUserInputManager(userInputManager : UserInputManager){ public setUserInputManager(userInputManager : UserInputManager){
this.userInputManager = userInputManager; this.userInputManager = userInputManager;
} }
public showDiscussionPart(){
this.showDiscussion();
this.hideButtonDiscussionBtn();
}
} }

View File

@ -597,6 +597,11 @@ export class MediaManager {
public addNewMessage(name: string, message: string, isMe: boolean = false){ public addNewMessage(name: string, message: string, isMe: boolean = false){
this.discussionManager.addMessage(name, message, isMe); this.discussionManager.addMessage(name, message, isMe);
//when there are new message, show discussion
if(!this.discussionManager.activatedDiscussion) {
this.discussionManager.showDiscussionPart();
}
} }
public addSendMessageCallback(userId: string|number, callback: SendMessageCallback){ public addSendMessageCallback(userId: string|number, callback: SendMessageCallback){