Skip to content

Commit

Permalink
Merge branch 'release/16.0.0' of https://github.com/infra-geo-ouverte…
Browse files Browse the repository at this point in the history
…/igo2 into sort-import
  • Loading branch information
alecarn committed Oct 11, 2023
2 parents dfed3f2 + cd33a3a commit 810945e
Show file tree
Hide file tree
Showing 15 changed files with 157 additions and 288 deletions.
28 changes: 11 additions & 17 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { NavigationEnd, Router } from '@angular/router';

import { AuthOptions } from '@igo2/auth';
import { ConfigService, LanguageService, MessageService } from '@igo2/core';
import { AnalyticsListenerService } from '@igo2/integration';
import { AnalyticsListenerService, AppOptions } from '@igo2/integration';
import { DomUtils, userAgent } from '@igo2/utils';

import { delay, first } from 'rxjs';
Expand Down Expand Up @@ -34,7 +34,7 @@ export class AppComponent implements OnInit {
private pwaService: PwaService,
private router: Router
) {
this.authConfig = this.configService.getConfig('auth');
this.authConfig = this.configService.getConfig('auth', {});

this.readTitleConfig();
this.readDescriptionConfig();
Expand All @@ -43,15 +43,8 @@ export class AppComponent implements OnInit {

this.detectOldBrowser();

this.hasHeader =
this.configService.getConfig('header.hasHeader') === undefined
? false
: this.configService.getConfig('header.hasHeader');

this.hasFooter =
this.configService.getConfig('hasFooter') === undefined
? false
: this.configService.getConfig('hasFooter');
this.hasHeader = this.configService.getConfig('header.hasHeader', false);
this.hasFooter = this.configService.getConfig('hasFooter', false);

this.setManifest();
this.installPrompt();
Expand Down Expand Up @@ -91,7 +84,7 @@ export class AppComponent implements OnInit {

private readTitleConfig() {
this.languageService.translate
.get(this.configService.getConfig('title'))
.get(this.configService.getConfig('title', ''))
.subscribe((title) => {
if (title) {
this.titleService.setTitle(title);
Expand All @@ -101,18 +94,19 @@ export class AppComponent implements OnInit {
}

private setManifest() {
const appConfig = this.configService.getConfig('app');
if (appConfig?.install?.enabled) {
const manifestPath =
appConfig.install.manifestPath || 'manifest.webmanifest';
if (this.configService.getConfig('app.install.enabled')) {
const manifestPath = this.configService.getConfig(
'app.install.manifestPath',
'manifest.webmanifest'
);
document
.querySelector('#igoManifestByConfig')
.setAttribute('href', manifestPath);
}
}

private installPrompt() {
const appConfig = this.configService.getConfig('app');
const appConfig: AppOptions = this.configService.getConfig('app');
if (appConfig?.install?.enabled && appConfig?.install?.promote) {
if (userAgent.getOSName() !== 'iOS') {
window.addEventListener(
Expand Down
2 changes: 1 addition & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function appInitializerFactory(
languageService.translate.setTranslation(lang, translations);

const configService = injector.get(ConfigService);
const theme = configService.getConfig('theme') || DEFAULT_THEME;
const theme = configService.getConfig('theme', DEFAULT_THEME);
loadTheme(document, theme);

const titleKey = configService.getConfig('title');
Expand Down
9 changes: 9 additions & 0 deletions src/app/app.utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { ConfigService, version } from '@igo2/core';

export function getAppVersion(configService: ConfigService): string {
return (
configService.getConfig('version.app') ||
configService.getConfig('version.lib') ||
version.lib
);
}
6 changes: 3 additions & 3 deletions src/app/pages/portal/map-overlay/map-overlay.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ export class MapOverlayComponent implements AfterViewInit, OnDestroy {
}

private handleContextChange(context: Context) {
let mapOverlay = [];
let mapOverlay: MapOverlay[] = [];
if (context !== undefined) {
this.mapOverlay = [];

if (context['mapOverlay']) {
mapOverlay = context['mapOverlay'];
} else if (this.configService.getConfig('mapOverlay')) {
mapOverlay = this.configService.getConfig('mapOverlay');
} else {
mapOverlay = this.configService.getConfig('mapOverlay', []);
}
for (const overlay of mapOverlay) {
// If no media define use default to desktop, display only if current media is on context definition
Expand Down
18 changes: 10 additions & 8 deletions src/app/pages/portal/portal.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
[termSplitter]="termSplitter"
[minLength]="minSearchTermLength"
[searchSettings]="true"
[forceNA]="forceCoordsNA"
[forceNA]="appConfig.app?.forceCoordsNA"
[store]="searchStore"
(searchTermChange)="onSearchTermChange($event)"
[pointerSummaryEnabled]="igoSearchPointerSummaryEnabled"
Expand Down Expand Up @@ -89,13 +89,13 @@
></igo-swipe-control>
<igo-map-center class="mat-elevation-z2" [map]="map"></igo-map-center>
<igo-wake-lock-button
*ngIf="showWakeLockButton"
*ngIf="appConfig.wakeLockApiButton"
class="mat-elevation-z2"
></igo-wake-lock-button>
<igo-offline-button
[map]="map"
color="primary"
*ngIf="showOfflineButton"
*ngIf="appConfig.offlineButton"
class="mat-elevation-z2"
[@controlsOffsetY]="getControlsOffsetY()"
[@mobileOffsetY]="getToastPanelStatus()"
Expand All @@ -112,12 +112,12 @@
</igo-geolocate-button>
<igo-rotation-button
class="mat-elevation-z2"
[showIfNoRotation]="showRotationButtonIfNoRotation"
[showIfNoRotation]="appConfig.showRotationButtonIfNoRotation"
[map]="map"
color="primary"
></igo-rotation-button>
<igo-home-extent-button
*ngIf="hasHomeExtentButton"
*ngIf="appConfig.homeExtentButton"
class="mat-elevation-z2"
[map]="map"
[extentOverride]="homeExtent"
Expand All @@ -127,7 +127,7 @@
>
</igo-home-extent-button>
<igo-user-button
*ngIf="auth.url"
*ngIf="authService.hasAuthService"
class="mat-elevation-z2"
[map]="map"
color="primary"
Expand Down Expand Up @@ -157,7 +157,9 @@
</mat-sidenav-container>

<app-expansion-panel
*ngIf="hasExpansionPanel && (workspaceState.workspaceEnabled$ | async)"
*ngIf="
appConfig.hasExpansionPanel && (workspaceState.workspaceEnabled$ | async)
"
[backdropShown]="expansionPanelBackdropShown"
[(expanded)]="expansionPanelExpanded"
[maximized]="workspaceState.workspaceMaximize$ | async"
Expand Down Expand Up @@ -327,7 +329,7 @@
*ngIf="(queryStore.empty$ | async) !== true"
[map]="map"
[store]="queryStore"
[hasFeatureEmphasisOnSelection]="hasFeatureEmphasisOnSelection"
[hasFeatureEmphasisOnSelection]="appConfig.hasFeatureEmphasisOnSelection"
[@toastPanelOffsetX]="toastPanelOffsetX$ | async"
[@toastPanelOffsetY]="getToastPanelOffsetY()"
[@toastPanelMobileSidenav]="
Expand Down
Loading

0 comments on commit 810945e

Please sign in to comment.