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 ca65401f..fb0551b0 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 @@ -12,7 +12,7 @@ import { Subscription } from 'rxjs'; import { ChatMessage } from '../../../models/chat.model'; import { MenuType } from '../../../models/menu.model'; import { ChatService } from '../../../services/chat/chat.service'; -import { SidenavMenuService } from '../../../services/sidenav-menu/sidenav-menu.service'; +import { PanelService } from '../../../services/panel/panel.service'; /** * @@ -65,14 +65,14 @@ export class ChatPanelComponent implements OnInit, AfterViewInit { /** * @ignore */ - constructor(private chatService: ChatService, private menuService: SidenavMenuService, private cd: ChangeDetectorRef) {} + constructor(private chatService: ChatService, private PanelService: PanelService, private cd: ChangeDetectorRef) {} /** * @ignore */ @HostListener('document:keydown.escape', ['$event']) onKeydownHandler(event: KeyboardEvent) { - if (this.menuService.isMenuOpened()) { + if (this.PanelService.isMenuOpened()) { this.close(); } } @@ -119,13 +119,13 @@ export class ChatPanelComponent implements OnInit, AfterViewInit { } close() { - this.menuService.toggleMenu(MenuType.CHAT); + this.PanelService.toggleMenu(MenuType.CHAT); } private subscribeToMessages() { this.chatMessageSubscription = this.chatService.messagesObs.subscribe((messages: ChatMessage[]) => { this.messageList = messages; - if (this.menuService.isMenuOpened()) { + if (this.PanelService.isMenuOpened()) { 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 a2884e4a..3a9dec5b 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 @@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, On import { skip, Subscription } from 'rxjs'; import { ChatPanelDirective, ParticipantsPanelDirective } from '../../directives/template/openvidu-angular.directive'; import { MenuType } from '../../models/menu.model'; -import { SidenavMenuService } from '../../services/sidenav-menu/sidenav-menu.service'; +import { PanelService } from '../../services/panel/panel.service'; /** * @@ -82,7 +82,7 @@ export class PanelComponent implements OnInit { /** * @ignore */ - constructor(protected menuService: SidenavMenuService, private cd: ChangeDetectorRef) {} + constructor(protected panelService: PanelService, private cd: ChangeDetectorRef) {} ngOnInit(): void { this.subscribeToPanelToggling(); @@ -95,7 +95,7 @@ export class PanelComponent implements OnInit { } private subscribeToPanelToggling() { - this.menuSubscription = this.menuService.menuOpenedObs.pipe(skip(1)).subscribe((ev: { opened: boolean; type?: MenuType }) => { + this.menuSubscription = this.panelService.menuOpenedObs.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/panel/participants-panel/participants-panel/participants-panel.component.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/participants-panel/participants-panel/participants-panel.component.ts index d14eb151..18400103 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/participants-panel/participants-panel/participants-panel.component.ts +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/participants-panel/participants-panel/participants-panel.component.ts @@ -1,7 +1,7 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, OnDestroy, OnInit, TemplateRef } from '@angular/core'; import { ParticipantAbstractModel } from '../../../../models/participant.model'; import { ParticipantService } from '../../../../services/participant/participant.service'; -import { SidenavMenuService } from '../../../..//services/sidenav-menu/sidenav-menu.service'; +import { PanelService } from '../../../..//services/panel/panel.service'; import { ParticipantPanelItemDirective } from '../../../../directives/template/openvidu-angular.directive'; import { Subscription } from 'rxjs'; @@ -70,7 +70,7 @@ export class ParticipantsPanelComponent implements OnInit, OnDestroy { */ constructor( protected participantService: ParticipantService, - protected menuService: SidenavMenuService, + protected PanelService: PanelService, private cd: ChangeDetectorRef ) {} @@ -100,6 +100,6 @@ export class ParticipantsPanelComponent implements OnInit, OnDestroy { } close() { - this.menuService.closeMenu(); + this.PanelService.closeMenu(); } } 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 4487c09d..900069f8 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 @@ -26,7 +26,7 @@ import { SidenavMode } from '../../models/layout.model'; import { LayoutService } from '../../services/layout/layout.service'; import { Subscription, skip } from 'rxjs'; import { MenuType } from '../../models/menu.model'; -import { SidenavMenuService } from '../../services/sidenav-menu/sidenav-menu.service'; +import { PanelService } from '../../services/panel/panel.service'; import { PlatformService } from '../../services/platform/platform.service'; /** @@ -73,7 +73,7 @@ export class SessionComponent implements OnInit { protected chatService: ChatService, protected tokenService: TokenService, protected layoutService: LayoutService, - protected menuService: SidenavMenuService, + protected panelService: PanelService, private platformService: PlatformService ) { this.log = this.loggerSrv.get('SessionComponent'); @@ -153,7 +153,7 @@ export class SessionComponent implements OnInit { this.updateLayoutInterval = setInterval(() => this.layoutService.update(), 50); }); - this.menuSubscription = this.menuService.menuOpenedObs.pipe(skip(1)).subscribe((ev: { opened: boolean; type?: MenuType }) => { + this.menuSubscription = this.panelService.menuOpenedObs.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 5e13ba40..1c20adaa 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 @@ -13,7 +13,7 @@ import { import { skip, Subscription } from 'rxjs'; import { TokenService } from '../../services/token/token.service'; import { ChatService } from '../../services/chat/chat.service'; -import { SidenavMenuService } from '../../services/sidenav-menu/sidenav-menu.service'; +import { PanelService } from '../../services/panel/panel.service'; import { DocumentService } from '../../services/document/document.service'; import { OpenViduService } from '../../services/openvidu/openvidu.service'; @@ -217,7 +217,7 @@ export class ToolbarComponent implements OnInit, OnDestroy { constructor( protected documentService: DocumentService, protected chatService: ChatService, - protected menuService: SidenavMenuService, + protected panelService: PanelService, protected tokenService: TokenService, protected participantService: ParticipantService, protected openviduService: OpenViduService, @@ -302,7 +302,7 @@ export class ToolbarComponent implements OnInit, OnDestroy { this.onCameraButtonClicked.emit(); try { - const publishVideo = !this.participantService.hasCameraVideoActive(); + const publishVideo = !this.participantService.isMyVideoActive(); await this.openviduService.publishVideo(publishVideo); } catch (error) { this.log.e('There was an error toggling camera:', error.code, error.message); @@ -340,7 +340,7 @@ export class ToolbarComponent implements OnInit, OnDestroy { */ toggleParticipantsPanel() { this.onParticipantsPanelButtonClicked.emit(); - this.menuService.toggleMenu(MenuType.PARTICIPANTS); + this.panelService.toggleMenu(MenuType.PARTICIPANTS); } /** @@ -348,7 +348,7 @@ export class ToolbarComponent implements OnInit, OnDestroy { */ toggleChatPanel() { this.onChatPanelButtonClicked.emit(); - this.menuService.toggleMenu(MenuType.CHAT); + this.panelService.toggleMenu(MenuType.CHAT); } /** @@ -362,8 +362,8 @@ export class ToolbarComponent implements OnInit, OnDestroy { protected subscribeToReconnection() { this.session.on('reconnecting', () => { - if (this.menuService.isMenuOpened()) { - this.menuService.closeMenu(); + if (this.panelService.isMenuOpened()) { + this.panelService.closeMenu(); } this.isConnectionLost = true; }); @@ -372,7 +372,7 @@ export class ToolbarComponent implements OnInit, OnDestroy { }); } protected subscribeToMenuToggling() { - this.menuTogglingSubscription = this.menuService.menuOpenedObs.subscribe((ev: { opened: boolean; type?: MenuType }) => { + this.menuTogglingSubscription = this.panelService.menuOpenedObs.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.menuService.isMenuOpened()) { + if (!this.panelService.isMenuOpened()) { this.unreadMessages++; } this.messageList = messages; diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/openvidu-angular.module.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/openvidu-angular.module.ts index f3cac73c..a48d9b8a 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/openvidu-angular.module.ts +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/openvidu-angular.module.ts @@ -51,7 +51,7 @@ import { ActionService } from './services/action/action.service'; import { ChatService } from './services/chat/chat.service'; import { DocumentService } from './services/document/document.service'; import { LayoutService } from './services/layout/layout.service'; -import { SidenavMenuService } from './services/sidenav-menu/sidenav-menu.service'; +import { PanelService } from './services/panel/panel.service'; import { ParticipantService } from './services/participant/participant.service'; import { ParticipantPanelItemComponent } from './components/panel/participants-panel/participant-panel-item/participant-panel-item.component'; import { ParticipantsPanelComponent } from './components/panel/participants-panel/participants-panel/participants-panel.component'; @@ -119,7 +119,7 @@ import { ApiDirectiveModule } from './directives/api/api.directive.module'; CdkOverlayContainer, { provide: OverlayContainer, useClass: CdkOverlayContainer }, ChatService, - SidenavMenuService, + PanelService, DeviceService, DocumentService, LayoutService, 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 45dd1c23..5e40cca1 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 @@ -10,7 +10,7 @@ import { ActionService } from '../action/action.service'; import { OpenViduService } from '../openvidu/openvidu.service'; import { LoggerService } from '../logger/logger.service'; import { Signal } from '../../models/signal.model'; -import { SidenavMenuService } from '../sidenav-menu/sidenav-menu.service'; +import { PanelService } from '../panel/panel.service'; import { ParticipantService } from '../participant/participant.service'; import { MenuType } from '../../models/menu.model'; @@ -30,7 +30,7 @@ export class ChatService { protected loggerSrv: LoggerService, protected openviduService: OpenViduService, protected participantService: ParticipantService, - protected menuService: SidenavMenuService, + protected panelService: PanelService, protected actionService: ActionService ) { this.log = this.loggerSrv.get('ChatService'); @@ -50,7 +50,7 @@ export class ChatService { nickname: data.nickname, message: data.message }); - if (!this.menuService.isMenuOpened()) { + if (!this.panelService.isMenuOpened()) { 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.menuService.toggleMenu.bind(this.menuService, MenuType.CHAT)); + this.actionService.launchNotification(options, this.panelService.toggleMenu.bind(this.panelService, MenuType.CHAT)); } } diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/services/panel/panel.service.spec.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/services/panel/panel.service.spec.ts new file mode 100644 index 00000000..86aa96d1 --- /dev/null +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/services/panel/panel.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { PanelService } from './panel.service'; + +describe('SidenavMenuService', () => { + let service: PanelService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(PanelService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/services/sidenav-menu/sidenav-menu.service.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/services/panel/panel.service.ts similarity index 95% rename from openvidu-components-angular/projects/openvidu-angular/src/lib/services/sidenav-menu/sidenav-menu.service.ts rename to openvidu-components-angular/projects/openvidu-angular/src/lib/services/panel/panel.service.ts index 012cff40..57c6e3e4 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/services/sidenav-menu/sidenav-menu.service.ts +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/services/panel/panel.service.ts @@ -10,7 +10,7 @@ import { LoggerService } from '../logger/logger.service'; @Injectable({ providedIn: 'root' }) -export class SidenavMenuService { +export class PanelService { menuOpenedObs: Observable<{ opened: boolean; type?: MenuType }>; protected log: ILogger; protected isChatMenuOpened: boolean = false; @@ -18,7 +18,7 @@ export class SidenavMenuService { protected _menuOpened = >new BehaviorSubject({ opened: false }); constructor(protected loggerSrv: LoggerService) { - this.log = this.loggerSrv.get('SidenavMenuService'); + this.log = this.loggerSrv.get('PanelService'); this.menuOpenedObs = this._menuOpened.asObservable(); } diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/services/sidenav-menu/sidenav-menu.service.spec.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/services/sidenav-menu/sidenav-menu.service.spec.ts deleted file mode 100644 index 6dbbd22b..00000000 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/services/sidenav-menu/sidenav-menu.service.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TestBed } from '@angular/core/testing'; - -import { SidenavMenuService } from './sidenav-menu.service'; - -describe('SidenavMenuService', () => { - let service: SidenavMenuService; - - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(SidenavMenuService); - }); - - it('should be created', () => { - expect(service).toBeTruthy(); - }); -}); diff --git a/openvidu-components-angular/projects/openvidu-angular/src/public-api.ts b/openvidu-components-angular/projects/openvidu-angular/src/public-api.ts index df76a2f0..cf54962e 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/public-api.ts +++ b/openvidu-components-angular/projects/openvidu-angular/src/public-api.ts @@ -16,7 +16,7 @@ export * from './lib/services/token/token.service'; export * from './lib/services/device/device.service'; export * from './lib/services/action/action.service'; export * from './lib/services/layout/layout.service'; -export * from './lib/services/sidenav-menu/sidenav-menu.service'; +export * from './lib/services/panel/panel.service'; export * from './lib/services/cdk-overlay/cdk-overlay.service'; export * from './lib/services/storage/storage.service';