@rdlabo/ionic-angular-kit 21.5.20 → 21.5.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, ApplicationRef, Injectable, makeEnvironmentProviders, provideEnvironmentInitializer } from '@angular/core';
|
|
3
|
+
import { DOCUMENT } from '@angular/common';
|
|
4
|
+
import { SwUpdate } from '@angular/service-worker';
|
|
5
|
+
import { filter, first } from 'rxjs';
|
|
6
|
+
|
|
7
|
+
/** Checks for and activates a complete Angular service-worker update when the application starts. */
|
|
8
|
+
class KitAppUpdateService {
|
|
9
|
+
#applicationRef = inject(ApplicationRef);
|
|
10
|
+
#document = inject(DOCUMENT);
|
|
11
|
+
#updates = inject(SwUpdate);
|
|
12
|
+
#started = false;
|
|
13
|
+
/** Starts one non-blocking update check after Angular reports the application as stable. */
|
|
14
|
+
start() {
|
|
15
|
+
if (this.#started || !this.#updates.isEnabled) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
this.#started = true;
|
|
19
|
+
this.#applicationRef.isStable
|
|
20
|
+
.pipe(filter((stable) => stable), first())
|
|
21
|
+
.subscribe(() => void this.#activateUpdate());
|
|
22
|
+
}
|
|
23
|
+
async #activateUpdate() {
|
|
24
|
+
try {
|
|
25
|
+
if (!(await this.#updates.checkForUpdate())) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
await this.#updates.activateUpdate();
|
|
29
|
+
this.#document.location?.reload();
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
console.error('Angular service-worker update check failed', error);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: KitAppUpdateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
36
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: KitAppUpdateService, providedIn: 'root' }); }
|
|
37
|
+
}
|
|
38
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: KitAppUpdateService, decorators: [{
|
|
39
|
+
type: Injectable,
|
|
40
|
+
args: [{ providedIn: 'root' }]
|
|
41
|
+
}] });
|
|
42
|
+
/** Provides a startup check that activates and reloads into the latest complete web application version. */
|
|
43
|
+
function provideKitAppUpdate() {
|
|
44
|
+
return makeEnvironmentProviders([
|
|
45
|
+
provideEnvironmentInitializer(() => inject(KitAppUpdateService).start()),
|
|
46
|
+
]);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Automatic startup updates for Angular service-worker web applications. */
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Generated bundle index. Do not edit.
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
export { KitAppUpdateService, provideKitAppUpdate };
|
|
56
|
+
//# sourceMappingURL=rdlabo-ionic-angular-kit-app-update.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rdlabo-ionic-angular-kit-app-update.mjs","sources":["../../../projects/kit/app-update/src/lib/kit-app-update.provider.ts","../../../projects/kit/app-update/src/public-api.ts","../../../projects/kit/app-update/src/rdlabo-ionic-angular-kit-app-update.ts"],"sourcesContent":["import type { EnvironmentProviders } from '@angular/core';\nimport {\n ApplicationRef,\n Injectable,\n inject,\n makeEnvironmentProviders,\n provideEnvironmentInitializer,\n} from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport { SwUpdate } from '@angular/service-worker';\nimport { filter, first } from 'rxjs';\n\n/** Checks for and activates a complete Angular service-worker update when the application starts. */\n@Injectable({ providedIn: 'root' })\nexport class KitAppUpdateService {\n readonly #applicationRef = inject(ApplicationRef);\n readonly #document = inject(DOCUMENT);\n readonly #updates = inject(SwUpdate);\n #started = false;\n\n /** Starts one non-blocking update check after Angular reports the application as stable. */\n start(): void {\n if (this.#started || !this.#updates.isEnabled) {\n return;\n }\n this.#started = true;\n this.#applicationRef.isStable\n .pipe(\n filter((stable) => stable),\n first(),\n )\n .subscribe(() => void this.#activateUpdate());\n }\n\n async #activateUpdate(): Promise<void> {\n try {\n if (!(await this.#updates.checkForUpdate())) {\n return;\n }\n await this.#updates.activateUpdate();\n this.#document.location?.reload();\n } catch (error) {\n console.error('Angular service-worker update check failed', error);\n }\n }\n}\n\n/** Provides a startup check that activates and reloads into the latest complete web application version. */\nexport function provideKitAppUpdate(): EnvironmentProviders {\n return makeEnvironmentProviders([\n provideEnvironmentInitializer(() => inject(KitAppUpdateService).start()),\n ]);\n}\n","/** Automatic startup updates for Angular service-worker web applications. */\nexport * from './lib/kit-app-update.provider';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAYA;MAEa,mBAAmB,CAAA;AACrB,IAAA,eAAe,GAAG,MAAM,CAAC,cAAc,CAAC;AACxC,IAAA,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC5B,IAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IACpC,QAAQ,GAAG,KAAK;;IAGhB,KAAK,GAAA;QACH,IAAI,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE;YAC7C;QACF;AACA,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAI;QACpB,IAAI,CAAC,eAAe,CAAC;AAClB,aAAA,IAAI,CACH,MAAM,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,EAC1B,KAAK,EAAE;aAER,SAAS,CAAC,MAAM,KAAK,IAAI,CAAC,eAAe,EAAE,CAAC;IACjD;AAEA,IAAA,MAAM,eAAe,GAAA;AACnB,QAAA,IAAI;YACF,IAAI,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC,EAAE;gBAC3C;YACF;AACA,YAAA,MAAM,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE;AACpC,YAAA,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE;QACnC;QAAE,OAAO,KAAK,EAAE;AACd,YAAA,OAAO,CAAC,KAAK,CAAC,4CAA4C,EAAE,KAAK,CAAC;QACpE;IACF;+GA9BW,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAnB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,cADN,MAAM,EAAA,CAAA,CAAA;;4FACnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAD/B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;AAkClC;SACgB,mBAAmB,GAAA;AACjC,IAAA,OAAO,wBAAwB,CAAC;QAC9B,6BAA6B,CAAC,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC,KAAK,EAAE,CAAC;AACzE,KAAA,CAAC;AACJ;;ACpDA;;ACAA;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rdlabo/ionic-angular-kit",
|
|
3
|
-
"version": "21.5.
|
|
3
|
+
"version": "21.5.21",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/rdlabo-team/ionic-angular-library.git"
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"@angular/core": "^21.0.0",
|
|
11
11
|
"@angular/forms": "^21.0.0",
|
|
12
12
|
"@angular/router": "^21.0.0",
|
|
13
|
+
"@angular/service-worker": "^21.0.0",
|
|
13
14
|
"@ionic/angular": "^8.0.0",
|
|
14
15
|
"@ionic/storage-angular": "^4.0.0",
|
|
15
16
|
"@capacitor/core": ">=6.0.0 <9.0.0",
|
|
@@ -30,6 +31,9 @@
|
|
|
30
31
|
"rxjs": "^7.8.0"
|
|
31
32
|
},
|
|
32
33
|
"peerDependenciesMeta": {
|
|
34
|
+
"@angular/service-worker": {
|
|
35
|
+
"optional": true
|
|
36
|
+
},
|
|
33
37
|
"firebase": {
|
|
34
38
|
"optional": true
|
|
35
39
|
},
|
|
@@ -75,6 +79,10 @@
|
|
|
75
79
|
"types": "./types/rdlabo-ionic-angular-kit.d.ts",
|
|
76
80
|
"default": "./fesm2022/rdlabo-ionic-angular-kit.mjs"
|
|
77
81
|
},
|
|
82
|
+
"./app-update": {
|
|
83
|
+
"types": "./types/rdlabo-ionic-angular-kit-app-update.d.ts",
|
|
84
|
+
"default": "./fesm2022/rdlabo-ionic-angular-kit-app-update.mjs"
|
|
85
|
+
},
|
|
78
86
|
"./auth-firebase": {
|
|
79
87
|
"types": "./types/rdlabo-ionic-angular-kit-auth-firebase.d.ts",
|
|
80
88
|
"default": "./fesm2022/rdlabo-ionic-angular-kit-auth-firebase.mjs"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EnvironmentProviders } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/** Checks for and activates a complete Angular service-worker update when the application starts. */
|
|
5
|
+
declare class KitAppUpdateService {
|
|
6
|
+
#private;
|
|
7
|
+
/** Starts one non-blocking update check after Angular reports the application as stable. */
|
|
8
|
+
start(): void;
|
|
9
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<KitAppUpdateService, never>;
|
|
10
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<KitAppUpdateService>;
|
|
11
|
+
}
|
|
12
|
+
/** Provides a startup check that activates and reloads into the latest complete web application version. */
|
|
13
|
+
declare function provideKitAppUpdate(): EnvironmentProviders;
|
|
14
|
+
|
|
15
|
+
export { KitAppUpdateService, provideKitAppUpdate };
|