-
Notifications
You must be signed in to change notification settings - Fork 463
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ov-components: Refactored config service
- Loading branch information
Showing
26 changed files
with
90 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...omponents-angular/src/lib/components/panel/activities-panel/activities-panel.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...du-components-angular/src/lib/components/panel/settings-panel/settings-panel.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...projects/openvidu-components-angular/src/lib/directives/api/activities-panel.directive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ts-angular/projects/openvidu-components-angular/src/lib/directives/api/admin.directive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ts/openvidu-components-angular/src/lib/directives/api/participant-panel-item.directive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s-angular/projects/openvidu-components-angular/src/lib/directives/api/stream.directive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...-angular/projects/openvidu-components-angular/src/lib/directives/api/toolbar.directive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../projects/openvidu-components-angular/src/lib/directives/api/videoconference.directive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...lar/projects/openvidu-components-angular/src/lib/services/config/global-config.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { DOCUMENT } from '@angular/common'; | ||
import { Inject, Injectable} from '@angular/core'; | ||
import { ParticipantFactoryFunction, OpenViduComponentsConfig } from '../../config/openvidu-components-angular.config'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class GlobalConfigService { | ||
private configuration: OpenViduComponentsConfig; | ||
|
||
constructor( | ||
@Inject('OPENVIDU_COMPONENTS_CONFIG') config: OpenViduComponentsConfig, | ||
@Inject(DOCUMENT) private document: Document | ||
) { | ||
this.configuration = config; | ||
console.log(this.configuration); | ||
if (this.isProduction()) console.log('OpenVidu Angular Production Mode'); | ||
} | ||
|
||
/** | ||
* Retrieves the base href of the application. | ||
* | ||
* @returns The base href of the application as a string. | ||
*/ | ||
getBaseHref(): string { | ||
const base = this.document.getElementsByTagName('base'); | ||
if (!base || base.length === 0) { | ||
return '/'; | ||
} | ||
|
||
const baseHref = base[0].href; | ||
if (baseHref) { | ||
return baseHref; | ||
} | ||
return '/'; | ||
} | ||
|
||
hasParticipantFactory(): boolean { | ||
return typeof this.getConfig().participantFactory === 'function'; | ||
} | ||
|
||
getParticipantFactory(): ParticipantFactoryFunction { | ||
return this.getConfig().participantFactory; | ||
} | ||
|
||
getConfig(): OpenViduComponentsConfig { | ||
return this.configuration; | ||
} | ||
isProduction(): boolean { | ||
return this.configuration?.production || false; | ||
} | ||
} |
18 changes: 0 additions & 18 deletions
18
...onents-angular/src/lib/services/config/openvidu-components-angular.config.service.mock.ts
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
...onents-angular/src/lib/services/config/openvidu-components-angular.config.service.spec.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.