From 9f0ab5d4c693bcacce2ebf6cd817474dcb3cda64 Mon Sep 17 00:00:00 2001 From: Pierre-Etienne Lord Date: Wed, 19 May 2021 22:59:41 -0400 Subject: [PATCH 1/5] wip --- angular.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/angular.json b/angular.json index d8381bf9f..d660505f4 100644 --- a/angular.json +++ b/angular.json @@ -115,7 +115,9 @@ "aot": true, "extractLicenses": true, "vendorChunk": true, - "buildOptimizer": false + "buildOptimizer": false, + "serviceWorker": true, + "ngswConfigPath": "ngsw-config.json" } } }, From a9fe760bad762a2885ac69407edf97f784ac958e Mon Sep 17 00:00:00 2001 From: Maxime Lamer <83651899+LAMM26@users.noreply.github.com> Date: Fri, 4 Jun 2021 12:59:30 -0400 Subject: [PATCH 2/5] docs(properties): add maxLayerZoomExtent property to map (#633) * doc layerExtent * doc layerExtent --- docs/properties.rst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/properties.rst b/docs/properties.rst index 6267302ee..0a8b75037 100644 --- a/docs/properties.rst +++ b/docs/properties.rst @@ -28,7 +28,8 @@ Exemples "center": [-73, 50.5], "zoom": 6, "geolocate": false, - "maxZoomOnExtent":15 + "maxZoomOnExtent":15, + "maxLayerZoomExtent": [-10000000, 5000000, 6000000, 9500000] } } } @@ -83,6 +84,13 @@ Propriétés de l'objet "view" de map - Number - Indique le niveau de zoom qu'aura l'application lors d'un clic sur un résultat de recherche qui n'est pas une couche. - + * - maxLayerZoomExtent + - Array [] + - .. line-block:: + Indique l'étendue maximale considérée comme étant valide pour un cadrage + lors du calcul de l'étendue d'une ou plusieurs couches. Les coordonnées + minimales et maximales doivent être compatibles avec la projection donnée. + - - From 270c34ab406dca9073bfd1ade517294228e0ec99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= <7397743+pelord@users.noreply.github.com> Date: Thu, 10 Jun 2021 14:52:51 -0400 Subject: [PATCH 3/5] chore(polyfills): Error catching by textdecoder() was undefined on IE (#638) * chore(polyfills): Error catching by textdecoder() was undefined on IE * lint --- package.json | 1 + src/polyfills.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/package.json b/package.json index c2dbf6a8f..e4025b1f3 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "bowser": "^2.9.0", "classlist.js": "^1.1.20150312", "core-js": "^3.6.5", + "fast-text-encoding": "^1.0.3", "file-saver": "^2.0.2", "hammerjs": "^2.0.8", "html2canvas": "^1.0.0-rc.5", diff --git a/src/polyfills.ts b/src/polyfills.ts index 53144dce5..80dab8420 100644 --- a/src/polyfills.ts +++ b/src/polyfills.ts @@ -27,6 +27,9 @@ import 'core-js/es/array/flat-map'; /** IE10 and IE11 requires the following for NgClass support on SVG elements */ import 'classlist.js'; // Run `npm install --save classlist.js`. +/** IE do not support TextDecoder() */ +import 'fast-text-encoding'; + /** IE10 and IE11 requires the following for string normalization */ import 'unorm/lib/unorm.js'; From a7b4c97536ae15b4f640b61f50f1f04a71ea8cad Mon Sep 17 00:00:00 2001 From: Pierre-Etienne Lord Date: Fri, 11 Jun 2021 14:26:05 -0400 Subject: [PATCH 4/5] wip --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 82e388590..7582eceec 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "scripts": { "ng": "ng", "start": "ng serve --host 0.0.0.0 --port 4201 --proxy-config proxy.conf.json", + "start-pwa": "ng build --prod && http-server -p 4201 -c-1 dist/igo2", "build": "ng build", "lint": "ng lint", "e2e": "ng e2e --port 4300", From 12e3bff7126e98e533982e246d12e2ed7a950efe Mon Sep 17 00:00:00 2001 From: Pierre-Etienne Lord Date: Mon, 14 Jun 2021 14:04:36 -0400 Subject: [PATCH 5/5] wip --- src/app/pages/portal/portal.component.ts | 11 +++++++++++ src/app/services/pwa.service.ts | 15 +++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/app/pages/portal/portal.component.ts b/src/app/pages/portal/portal.component.ts index 6e46d9e92..fedf714fe 100644 --- a/src/app/pages/portal/portal.component.ts +++ b/src/app/pages/portal/portal.component.ts @@ -375,6 +375,17 @@ export class PortalComponent implements OnInit, OnDestroy { }); this.map.ol.once('rendercomplete', () => { this.readQueryParams(); + if (this.storageService.get('pwaInstalled') === 'accepted') { + this.messageService.info('Ouvrir l\'app dans le bouton a droite de l\'url', 'Application déja installée') + } + + // event non reconnu ni declanche... + // window.addEventListener('appinstalled', () => { + // Hide the app-provided install promotion + // Clear the deferredPrompt so it can be garbage collected + // Optionally, send analytics event to indicate successful install + // console.log('PWA was installed'); + // }); }); this.onSettingsChange$.subscribe(() => { diff --git a/src/app/services/pwa.service.ts b/src/app/services/pwa.service.ts index e8afac595..715b2339c 100644 --- a/src/app/services/pwa.service.ts +++ b/src/app/services/pwa.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { Platform } from '@angular/cdk/platform'; -import { once } from 'process'; +import { AnalyticsService, StorageScope, StorageService } from '@igo2/core'; @Injectable({ providedIn: 'root' @@ -8,10 +8,13 @@ import { once } from 'process'; export class PwaService { promptEvent: any; constructor( - private platform: Platform + private platform: Platform, + private analyticsService: AnalyticsService, + private storageService: StorageService ) { } - public initPwaPrompt() { + + public async initPwaPrompt() { if (!this.platform.IOS) { window.addEventListener('beforeinstallprompt', (event: any) => { event.preventDefault(); @@ -25,7 +28,11 @@ export class PwaService { window.addEventListener('click', () => { this.showPrompt(); }, { once: true }); } - private showPrompt() { + private async showPrompt() { this.promptEvent.prompt(); + const outcome = await this.promptEvent.userChoice; + this.analyticsService.trackEvent('app', 'installPwa', outcome.outcome); + this.storageService.set('pwaInstalled', outcome.outcome, StorageScope.LOCAL) + this.promptEvent = undefined; } }