mirror of https://github.com/OpenVidu/openvidu.git
openvidu-components: Renamed libConfig to openviduAngularConfig
parent
8f4ff06723
commit
cfef092457
|
@ -14,7 +14,6 @@ import { ActionService } from '../../services/action/action.service';
|
||||||
import { DeviceService } from '../../services/device/device.service';
|
import { DeviceService } from '../../services/device/device.service';
|
||||||
import { ChatMessage } from '../../models/chat.model';
|
import { ChatMessage } from '../../models/chat.model';
|
||||||
import { ParticipantService } from '../../services/participant/participant.service';
|
import { ParticipantService } from '../../services/participant/participant.service';
|
||||||
import { LibraryConfigService } from '../../services/library-config/library-config.service';
|
|
||||||
import { MenuType } from '../../models/menu.model';
|
import { MenuType } from '../../models/menu.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -53,7 +52,6 @@ export class ToolbarComponent implements OnInit, OnDestroy {
|
||||||
protected webcamAudioStateSubscription: Subscription;
|
protected webcamAudioStateSubscription: Subscription;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected libraryConfigSrv: LibraryConfigService,
|
|
||||||
protected documentService: DocumentService,
|
protected documentService: DocumentService,
|
||||||
protected chatService: ChatService,
|
protected chatService: ChatService,
|
||||||
protected menuService: SidenavMenuService,
|
protected menuService: SidenavMenuService,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export interface LibConfig {
|
export interface OpenViduAngularConfig {
|
||||||
production?: boolean,
|
production?: boolean,
|
||||||
participantFactory?: ParticipantFactoryFunction,
|
participantFactory?: ParticipantFactoryFunction,
|
||||||
|
|
|
@ -39,14 +39,14 @@ import { LinkifyPipe } from './pipes/linkify.pipe';
|
||||||
import { TooltipListPipe } from './pipes/tooltip-list.pipe';
|
import { TooltipListPipe } from './pipes/tooltip-list.pipe';
|
||||||
import { StreamsEnabledPipe, NicknamePipe, ParticipantStreamsPipe } from './pipes/participant.pipe';
|
import { StreamsEnabledPipe, NicknamePipe, ParticipantStreamsPipe } from './pipes/participant.pipe';
|
||||||
|
|
||||||
import { LibConfig } from './config/lib.config';
|
import { OpenViduAngularConfig } from './config/openvidu-angular.config';
|
||||||
import { CdkOverlayContainer } from './config/custom-cdk-overlay';
|
import { CdkOverlayContainer } from './config/custom-cdk-overlay';
|
||||||
import { DeviceService } from './services/device/device.service';
|
import { DeviceService } from './services/device/device.service';
|
||||||
import { LoggerService } from './services/logger/logger.service';
|
import { LoggerService } from './services/logger/logger.service';
|
||||||
import { PlatformService } from './services/platform/platform.service';
|
import { PlatformService } from './services/platform/platform.service';
|
||||||
import { StorageService } from './services/storage/storage.service';
|
import { StorageService } from './services/storage/storage.service';
|
||||||
import { TokenService } from './services/token/token.service';
|
import { TokenService } from './services/token/token.service';
|
||||||
import { LibraryConfigService } from './services/library-config/library-config.service';
|
import { OpenViduAngularConfigService } from './services/config/openvidu-angular.config.service';
|
||||||
import { OpenViduService } from './services/openvidu/openvidu.service';
|
import { OpenViduService } from './services/openvidu/openvidu.service';
|
||||||
import { ActionService } from './services/action/action.service';
|
import { ActionService } from './services/action/action.service';
|
||||||
import { ChatService } from './services/chat/chat.service';
|
import { ChatService } from './services/chat/chat.service';
|
||||||
|
@ -142,13 +142,13 @@ import { AudioWaveComponent } from './components/audio-wave/audio-wave.component
|
||||||
],
|
],
|
||||||
entryComponents: [DialogTemplateComponent]
|
entryComponents: [DialogTemplateComponent]
|
||||||
})
|
})
|
||||||
export class OpenviduAngularModule {
|
export class OpenViduAngularModule {
|
||||||
static forRoot(config): ModuleWithProviders<OpenviduAngularModule> {
|
static forRoot(config): ModuleWithProviders<OpenViduAngularModule> {
|
||||||
// console.log(`${library.name} config: ${environment}`);
|
// console.log(`${library.name} config: ${environment}`);
|
||||||
const libConfig: LibConfig = config;
|
const libConfig: OpenViduAngularConfig = config;
|
||||||
return {
|
return {
|
||||||
ngModule: OpenviduAngularModule,
|
ngModule: OpenViduAngularModule,
|
||||||
providers: [LibraryConfigService, { provide: 'LIB_CONFIG', useValue: libConfig }]
|
providers: [OpenViduAngularConfigService, { provide: 'OPENVIDU_ANGULAR_CONFIG', useValue: libConfig }]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { OpenViduAngularConfig } from '../../config/openvidu-angular.config';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class OpenViduAngularConfigServiceMock {
|
||||||
|
|
||||||
|
private configuration: OpenViduAngularConfig;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.configuration = {production: false};
|
||||||
|
}
|
||||||
|
|
||||||
|
getConfig(): OpenViduAngularConfig {
|
||||||
|
return this.configuration;
|
||||||
|
}
|
||||||
|
isProduction(): boolean {
|
||||||
|
return this.configuration?.production;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
import { OpenViduAngularConfig } from '../../config/openvidu-angular.config';
|
||||||
|
|
||||||
|
import { OpenViduAngularConfigService } from './openvidu-angular.config.service';
|
||||||
|
|
||||||
|
describe('OpenViduAngularConfigService', () => {
|
||||||
|
let service: OpenViduAngularConfigService;
|
||||||
|
const config: OpenViduAngularConfig = { production: false };
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
providers: [
|
||||||
|
OpenViduAngularConfigService,
|
||||||
|
{provide: 'LIB_CONFIG', useValue: config}]
|
||||||
|
});
|
||||||
|
service = TestBed.inject(OpenViduAngularConfigService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,20 +1,20 @@
|
||||||
import { Inject, Injectable } from '@angular/core';
|
import { Inject, Injectable } from '@angular/core';
|
||||||
import { LibConfig, ParticipantFactoryFunction } from '../../config/lib.config';
|
import { OpenViduAngularConfig, ParticipantFactoryFunction } from '../../config/openvidu-angular.config';
|
||||||
|
|
||||||
// import { version } from '../../../../package.json';
|
// import { version } from '../../../../package.json';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class LibraryConfigService {
|
export class OpenViduAngularConfigService {
|
||||||
private configuration: LibConfig;
|
private configuration: OpenViduAngularConfig;
|
||||||
|
|
||||||
constructor(@Inject('LIB_CONFIG') config: LibConfig) {
|
constructor(@Inject('OPENVIDU_ANGULAR_CONFIG') config: OpenViduAngularConfig) {
|
||||||
this.configuration = config;
|
this.configuration = config;
|
||||||
console.log(this.configuration);
|
console.log(this.configuration);
|
||||||
if(this.isProduction()) console.log('OpenVidu Angular Production Mode');
|
if(this.isProduction()) console.log('OpenVidu Angular Production Mode');
|
||||||
// console.log(version)
|
// console.log(version)
|
||||||
}
|
}
|
||||||
|
|
||||||
getConfig(): LibConfig {
|
getConfig(): OpenViduAngularConfig {
|
||||||
return this.configuration;
|
return this.configuration;
|
||||||
}
|
}
|
||||||
isProduction(): boolean {
|
isProduction(): boolean {
|
|
@ -1,19 +0,0 @@
|
||||||
import { Injectable } from '@angular/core';
|
|
||||||
import { LibConfig } from '../../config/lib.config';
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class LibraryConfigServiceMock {
|
|
||||||
|
|
||||||
private configuration: LibConfig;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.configuration = {environment: {production: false}};
|
|
||||||
}
|
|
||||||
|
|
||||||
getConfig(): LibConfig {
|
|
||||||
return this.configuration;
|
|
||||||
}
|
|
||||||
isProduction(): boolean {
|
|
||||||
return this.configuration?.environment?.production;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
import { TestBed } from '@angular/core/testing';
|
|
||||||
import { LibConfig } from '../../config/lib.config';
|
|
||||||
|
|
||||||
import { LibraryConfigService } from './library-config.service';
|
|
||||||
|
|
||||||
describe('LibraryConfigService', () => {
|
|
||||||
let service: LibraryConfigService;
|
|
||||||
const libConfig: LibConfig = { environment: {production: false} };
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
providers: [
|
|
||||||
LibraryConfigService,
|
|
||||||
{provide: 'LIB_CONFIG', useValue: libConfig}]
|
|
||||||
});
|
|
||||||
service = TestBed.inject(LibraryConfigService);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be created', () => {
|
|
||||||
expect(service).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ILogService } from '../../models/logger.model';
|
import { ILogService } from '../../models/logger.model';
|
||||||
|
|
||||||
import { LibraryConfigService } from '../library-config/library-config.service';
|
import { OpenViduAngularConfigService } from '../config/openvidu-angular.config.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
|
@ -15,7 +15,7 @@ export class LoggerService implements ILogService {
|
||||||
['[', '] ERROR: ']
|
['[', '] ERROR: ']
|
||||||
];
|
];
|
||||||
|
|
||||||
constructor(private libraryConfigSrv: LibraryConfigService) {
|
constructor(private openviduAngularConfigSrv: OpenViduAngularConfigService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private getLoggerFns(prefix: string) {
|
private getLoggerFns(prefix: string) {
|
||||||
|
@ -28,7 +28,7 @@ export class LoggerService implements ILogService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public get(prefix: string) {
|
public get(prefix: string) {
|
||||||
const prodMode = this.libraryConfigSrv.isProduction();
|
const prodMode = this.openviduAngularConfigSrv.isProduction();
|
||||||
const loggerService = this;
|
const loggerService = this;
|
||||||
return {
|
return {
|
||||||
d: function(...args: any[]) {
|
d: function(...args: any[]) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { LoggerService } from '../logger/logger.service';
|
||||||
|
|
||||||
import { ILogger } from '../../models/logger.model';
|
import { ILogger } from '../../models/logger.model';
|
||||||
import { Signal } from '../../models/signal.model';
|
import { Signal } from '../../models/signal.model';
|
||||||
import { LibraryConfigService } from '../library-config/library-config.service';
|
import { OpenViduAngularConfigService } from '../config/openvidu-angular.config.service';
|
||||||
import { PlatformService } from '../platform/platform.service';
|
import { PlatformService } from '../platform/platform.service';
|
||||||
import { DeviceService } from '../device/device.service';
|
import { DeviceService } from '../device/device.service';
|
||||||
import { CameraType } from '../../models/device.model';
|
import { CameraType } from '../../models/device.model';
|
||||||
|
@ -27,7 +27,7 @@ export class OpenViduService {
|
||||||
protected log: ILogger;
|
protected log: ILogger;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected libraryConfigSrv: LibraryConfigService,
|
protected openviduAngularConfigSrv: OpenViduAngularConfigService,
|
||||||
protected platformService: PlatformService,
|
protected platformService: PlatformService,
|
||||||
protected loggerSrv: LoggerService,
|
protected loggerSrv: LoggerService,
|
||||||
private participantService: ParticipantService,
|
private participantService: ParticipantService,
|
||||||
|
@ -38,13 +38,13 @@ export class OpenViduService {
|
||||||
|
|
||||||
initialize() {
|
initialize() {
|
||||||
this.OV = new OpenVidu();
|
this.OV = new OpenVidu();
|
||||||
if (this.libraryConfigSrv.isProduction()) this.OV.enableProdMode();
|
if (this.openviduAngularConfigSrv.isProduction()) this.OV.enableProdMode();
|
||||||
this.webcamSession = this.OV.initSession();
|
this.webcamSession = this.OV.initSession();
|
||||||
|
|
||||||
// Initialize screen session only if it is not mobile platform
|
// Initialize screen session only if it is not mobile platform
|
||||||
if (!this.platformService.isMobile()) {
|
if (!this.platformService.isMobile()) {
|
||||||
this.OVScreen = new OpenVidu();
|
this.OVScreen = new OpenVidu();
|
||||||
if (this.libraryConfigSrv.isProduction()) this.OVScreen.enableProdMode();
|
if (this.openviduAngularConfigSrv.isProduction()) this.OVScreen.enableProdMode();
|
||||||
this.screenSession = this.OVScreen.initSession();
|
this.screenSession = this.OVScreen.initSession();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { BehaviorSubject, Observable } from 'rxjs';
|
||||||
import { ILogger } from '../../models/logger.model';
|
import { ILogger } from '../../models/logger.model';
|
||||||
import { StreamModel, ParticipantAbstractModel, ParticipantModel } from '../../models/participant.model';
|
import { StreamModel, ParticipantAbstractModel, ParticipantModel } from '../../models/participant.model';
|
||||||
import { VideoType } from '../../models/video-type.model';
|
import { VideoType } from '../../models/video-type.model';
|
||||||
import { LibraryConfigService } from '../library-config/library-config.service';
|
import { OpenViduAngularConfigService } from '../config/openvidu-angular.config.service';
|
||||||
import { LoggerService } from '../logger/logger.service';
|
import { LoggerService } from '../logger/logger.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
|
@ -30,7 +30,7 @@ export class ParticipantService {
|
||||||
|
|
||||||
protected log: ILogger;
|
protected log: ILogger;
|
||||||
|
|
||||||
constructor(protected libraryConfigSrv: LibraryConfigService, protected loggerSrv: LoggerService) {
|
constructor(protected openviduAngularConfigSrv: OpenViduAngularConfigService, protected loggerSrv: LoggerService) {
|
||||||
this.log = this.loggerSrv.get('ParticipantService');
|
this.log = this.loggerSrv.get('ParticipantService');
|
||||||
|
|
||||||
this.localParticipantObs = this._localParticipant.asObservable();
|
this.localParticipantObs = this._localParticipant.asObservable();
|
||||||
|
@ -305,8 +305,8 @@ export class ParticipantService {
|
||||||
}
|
}
|
||||||
protected newParticipant(streamModel?: StreamModel, participantId?: string) {
|
protected newParticipant(streamModel?: StreamModel, participantId?: string) {
|
||||||
|
|
||||||
if(this.libraryConfigSrv.hasParticipantFactory()){
|
if(this.openviduAngularConfigSrv.hasParticipantFactory()){
|
||||||
return this.libraryConfigSrv.getParticipantFactory().apply(this, [streamModel, participantId]);
|
return this.openviduAngularConfigSrv.getParticipantFactory().apply(this, [streamModel, participantId]);
|
||||||
}
|
}
|
||||||
return new ParticipantModel(streamModel, participantId);
|
return new ParticipantModel(streamModel, participantId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ export * from './lib/services/participant/participant.service';
|
||||||
export * from './lib/services/chat/chat.service';
|
export * from './lib/services/chat/chat.service';
|
||||||
export * from './lib/services/platform/platform.service';
|
export * from './lib/services/platform/platform.service';
|
||||||
export * from './lib/services/logger/logger.service';
|
export * from './lib/services/logger/logger.service';
|
||||||
export * from './lib/services/library-config/library-config.service';
|
export * from './lib/services/config/openvidu-angular.config.service';
|
||||||
export * from './lib/services/document/document.service';
|
export * from './lib/services/document/document.service';
|
||||||
export * from './lib/services/token/token.service';
|
export * from './lib/services/token/token.service';
|
||||||
export * from './lib/services/device/device.service';
|
export * from './lib/services/device/device.service';
|
||||||
|
@ -34,7 +34,7 @@ export * from './lib/components/audio-wave/audio-wave.component';
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
export * from './lib/models/participant.model';
|
export * from './lib/models/participant.model';
|
||||||
export * from './lib/config/lib.config';
|
export * from './lib/config/openvidu-angular.config';
|
||||||
export * from './lib/models/logger.model';
|
export * from './lib/models/logger.model';
|
||||||
export * from './lib/models/video-type.model';
|
export * from './lib/models/video-type.model';
|
||||||
export * from './lib/models/notification-options.model';
|
export * from './lib/models/notification-options.model';
|
||||||
|
|
|
@ -17,7 +17,7 @@ import { LayoutTestComponent } from './components/layout-test/layout-test.compon
|
||||||
import { StreamTestComponent } from './components/stream-test/stream-test.component';
|
import { StreamTestComponent } from './components/stream-test/stream-test.component';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
OpenviduAngularModule,
|
OpenViduAngularModule,
|
||||||
UserSettingsComponent,
|
UserSettingsComponent,
|
||||||
ChatPanelComponent,
|
ChatPanelComponent,
|
||||||
ToolbarComponent,
|
ToolbarComponent,
|
||||||
|
@ -41,7 +41,7 @@ import { MatButtonModule } from '@angular/material/button';
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
MatButtonModule,
|
MatButtonModule,
|
||||||
BrowserAnimationsModule,
|
BrowserAnimationsModule,
|
||||||
OpenviduAngularModule.forRoot(environment),
|
OpenViduAngularModule.forRoot(environment),
|
||||||
AppRoutingModule // Order is important, AppRoutingModule must be the last import for useHash working
|
AppRoutingModule // Order is important, AppRoutingModule must be the last import for useHash working
|
||||||
],
|
],
|
||||||
providers: [VideoconferenceComponent, UserSettingsComponent, ToolbarComponent, ChatPanelComponent, SessionComponent, LayoutComponent],
|
providers: [VideoconferenceComponent, UserSettingsComponent, ToolbarComponent, ChatPanelComponent, SessionComponent, LayoutComponent],
|
||||||
|
|
Loading…
Reference in New Issue