diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/chat-panel/chat-panel.component.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/chat-panel/chat-panel.component.ts index fb0551b0..be67b1c2 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/chat-panel/chat-panel.component.ts +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/chat-panel/chat-panel.component.ts @@ -72,7 +72,7 @@ export class ChatPanelComponent implements OnInit, AfterViewInit { */ @HostListener('document:keydown.escape', ['$event']) onKeydownHandler(event: KeyboardEvent) { - if (this.PanelService.isMenuOpened()) { + if (this.PanelService.isPanelOpened()) { this.close(); } } @@ -119,13 +119,13 @@ export class ChatPanelComponent implements OnInit, AfterViewInit { } close() { - this.PanelService.toggleMenu(MenuType.CHAT); + this.PanelService.togglePanel(MenuType.CHAT); } private subscribeToMessages() { this.chatMessageSubscription = this.chatService.messagesObs.subscribe((messages: ChatMessage[]) => { this.messageList = messages; - if (this.PanelService.isMenuOpened()) { + if (this.PanelService.isPanelOpened()) { this.scrollToBottom(); this.cd.markForCheck(); } diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/panel.component.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/panel.component.ts index 3a9dec5b..7032b348 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/panel.component.ts +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/panel.component.ts @@ -95,7 +95,7 @@ export class PanelComponent implements OnInit { } private subscribeToPanelToggling() { - this.menuSubscription = this.panelService.menuOpenedObs.pipe(skip(1)).subscribe((ev: { opened: boolean; type?: MenuType }) => { + this.menuSubscription = this.panelService.panelOpenedObs.pipe(skip(1)).subscribe((ev: { opened: boolean; type?: MenuType }) => { this.isChatPanelOpened = ev.opened && ev.type === MenuType.CHAT; this.isParticipantsPanelOpened = ev.opened && ev.type === MenuType.PARTICIPANTS; this.cd.markForCheck(); diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/session/session.component.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/session/session.component.ts index 900069f8..359bc8a4 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/session/session.component.ts +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/session/session.component.ts @@ -153,7 +153,7 @@ export class SessionComponent implements OnInit { this.updateLayoutInterval = setInterval(() => this.layoutService.update(), 50); }); - this.menuSubscription = this.panelService.menuOpenedObs.pipe(skip(1)).subscribe((ev: { opened: boolean; type?: MenuType }) => { + this.menuSubscription = this.panelService.panelOpenedObs.pipe(skip(1)).subscribe((ev: { opened: boolean; type?: MenuType }) => { if (this.sideMenu) { this.isChatPanelOpened = ev.opened && ev.type === MenuType.CHAT; this.isParticipantsPanelOpened = ev.opened && ev.type === MenuType.PARTICIPANTS; diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.ts index 1c20adaa..c4dc8b2b 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.ts +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.ts @@ -340,7 +340,7 @@ export class ToolbarComponent implements OnInit, OnDestroy { */ toggleParticipantsPanel() { this.onParticipantsPanelButtonClicked.emit(); - this.panelService.toggleMenu(MenuType.PARTICIPANTS); + this.panelService.togglePanel(MenuType.PARTICIPANTS); } /** @@ -348,7 +348,7 @@ export class ToolbarComponent implements OnInit, OnDestroy { */ toggleChatPanel() { this.onChatPanelButtonClicked.emit(); - this.panelService.toggleMenu(MenuType.CHAT); + this.panelService.togglePanel(MenuType.CHAT); } /** @@ -362,7 +362,7 @@ export class ToolbarComponent implements OnInit, OnDestroy { protected subscribeToReconnection() { this.session.on('reconnecting', () => { - if (this.panelService.isMenuOpened()) { + if (this.panelService.isPanelOpened()) { this.panelService.closeMenu(); } this.isConnectionLost = true; @@ -372,7 +372,7 @@ export class ToolbarComponent implements OnInit, OnDestroy { }); } protected subscribeToMenuToggling() { - this.menuTogglingSubscription = this.panelService.menuOpenedObs.subscribe((ev: { opened: boolean; type?: MenuType }) => { + this.menuTogglingSubscription = this.panelService.panelOpenedObs.subscribe((ev: { opened: boolean; type?: MenuType }) => { this.isChatOpened = ev.opened && ev.type === MenuType.CHAT; this.isParticipantsOpened = ev.opened && ev.type === MenuType.PARTICIPANTS; if (this.isChatOpened) { @@ -383,7 +383,7 @@ export class ToolbarComponent implements OnInit, OnDestroy { protected subscribeToChatMessages() { this.chatMessagesSubscription = this.chatService.messagesObs.pipe(skip(1)).subscribe((messages) => { - if (!this.panelService.isMenuOpened()) { + if (!this.panelService.isPanelOpened()) { this.unreadMessages++; } this.messageList = messages; diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/services/chat/chat.service.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/services/chat/chat.service.ts index 5e40cca1..fcfca5c2 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/services/chat/chat.service.ts +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/services/chat/chat.service.ts @@ -50,7 +50,7 @@ export class ChatService { nickname: data.nickname, message: data.message }); - if (!this.panelService.isMenuOpened()) { + if (!this.panelService.isPanelOpened()) { const notificationOptions: INotificationOptions = { message: `${data.nickname.toUpperCase()} sent a message`, cssClassName: 'messageSnackbar', @@ -77,6 +77,6 @@ export class ChatService { } protected launchNotification(options: INotificationOptions) { - this.actionService.launchNotification(options, this.panelService.toggleMenu.bind(this.panelService, MenuType.CHAT)); + this.actionService.launchNotification(options, this.panelService.togglePanel.bind(this.panelService, MenuType.CHAT)); } } diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/services/panel/panel.service.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/services/panel/panel.service.ts index 57c6e3e4..f5d5deb5 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/services/panel/panel.service.ts +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/services/panel/panel.service.ts @@ -11,59 +11,59 @@ import { LoggerService } from '../logger/logger.service'; providedIn: 'root' }) export class PanelService { - menuOpenedObs: Observable<{ opened: boolean; type?: MenuType }>; + panelOpenedObs: Observable<{ opened: boolean; type?: MenuType }>; protected log: ILogger; - protected isChatMenuOpened: boolean = false; - protected isParticipantsMenuOpened: boolean = false; - protected _menuOpened = >new BehaviorSubject({ opened: false }); + protected isChatPanelOpened: boolean = false; + protected isParticipantsPanelOpened: boolean = false; + protected _panelOpened = >new BehaviorSubject({ opened: false }); constructor(protected loggerSrv: LoggerService) { this.log = this.loggerSrv.get('PanelService'); - this.menuOpenedObs = this._menuOpened.asObservable(); + this.panelOpenedObs = this._panelOpened.asObservable(); } - isMenuOpened(): boolean { + isPanelOpened(): boolean { return this.isChatOpened() || this.isParticipantsOpened(); } - toggleMenu(type: MenuType) { + togglePanel(type: MenuType) { this.log.d(`Toggling ${type} menu`); if (type === MenuType.CHAT) { - if (this.isChatMenuOpened) { + if (this.isChatPanelOpened) { // Close chat and side menu - this.isChatMenuOpened = false; - this._menuOpened.next({ opened: false }); + this.isChatPanelOpened = false; + this._panelOpened.next({ opened: false }); } else { // Open chat - this.isChatMenuOpened = true; - this.isParticipantsMenuOpened = false; - this._menuOpened.next({ opened: true, type: MenuType.CHAT }); + this.isChatPanelOpened = true; + this.isParticipantsPanelOpened = false; + this._panelOpened.next({ opened: true, type: MenuType.CHAT }); } } else if (type === MenuType.PARTICIPANTS) { - if (this.isParticipantsMenuOpened) { + if (this.isParticipantsPanelOpened) { // Close participants menu and side menu - this.isParticipantsMenuOpened = false; - this._menuOpened.next({ opened: false }); + this.isParticipantsPanelOpened = false; + this._panelOpened.next({ opened: false }); } else { // Open participants menu - this.isParticipantsMenuOpened = true; - this.isChatMenuOpened = false; - this._menuOpened.next({ opened: true, type: MenuType.PARTICIPANTS }); + this.isParticipantsPanelOpened = true; + this.isChatPanelOpened = false; + this._panelOpened.next({ opened: true, type: MenuType.PARTICIPANTS }); } } } closeMenu() { - this.isParticipantsMenuOpened = false; - this.isChatMenuOpened = false; - this._menuOpened.next({ opened: false }); + this.isParticipantsPanelOpened = false; + this.isChatPanelOpened = false; + this._panelOpened.next({ opened: false }); } isChatOpened() { - return this.isChatMenuOpened; + return this.isChatPanelOpened; } isParticipantsOpened() { - return this.isParticipantsMenuOpened; + return this.isParticipantsPanelOpened; } }