@softpak/components 21.2.0-capwesome.1 → 21.2.0-capwesome.11
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.
- package/fesm2022/softpak-components-spx-app-expiry.mjs +5 -5
- package/fesm2022/softpak-components-spx-app-expiry.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-button.mjs +6 -38
- package/fesm2022/softpak-components-spx-button.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-channel-selection.mjs +95 -16
- package/fesm2022/softpak-components-spx-channel-selection.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-confirm.mjs +17 -25
- package/fesm2022/softpak-components-spx-confirm.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-haptics.mjs +54 -0
- package/fesm2022/softpak-components-spx-haptics.mjs.map +1 -0
- package/fesm2022/softpak-components-spx-helpers.mjs +9 -1
- package/fesm2022/softpak-components-spx-helpers.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-navigation.mjs +14 -21
- package/fesm2022/softpak-components-spx-navigation.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-spinner.mjs +12 -18
- package/fesm2022/softpak-components-spx-spinner.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-storage.mjs +1 -0
- package/fesm2022/softpak-components-spx-storage.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-suggestion.mjs +9 -23
- package/fesm2022/softpak-components-spx-suggestion.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-tabs.mjs +8 -11
- package/fesm2022/softpak-components-spx-tabs.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-toaster.mjs +22 -39
- package/fesm2022/softpak-components-spx-toaster.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-translate.mjs +65 -2
- package/fesm2022/softpak-components-spx-translate.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-update.mjs +282 -84
- package/fesm2022/softpak-components-spx-update.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-welcome.mjs +2 -2
- package/fesm2022/softpak-components-spx-welcome.mjs.map +1 -1
- package/package.json +5 -1
- package/tailwind.css +1 -1
- package/types/softpak-components-spx-button.d.ts +1 -4
- package/types/softpak-components-spx-channel-selection.d.ts +39 -7
- package/types/softpak-components-spx-confirm.d.ts +21 -33
- package/types/softpak-components-spx-haptics.d.ts +13 -0
- package/types/softpak-components-spx-helpers.d.ts +3 -1
- package/types/softpak-components-spx-navigation.d.ts +20 -36
- package/types/softpak-components-spx-spinner.d.ts +14 -27
- package/types/softpak-components-spx-storage.d.ts +2 -1
- package/types/softpak-components-spx-suggestion.d.ts +1 -1
- package/types/softpak-components-spx-tabs.d.ts +8 -17
- package/types/softpak-components-spx-toaster.d.ts +55 -91
- package/types/softpak-components-spx-translate.d.ts +43 -1
- package/types/softpak-components-spx-update.d.ts +88 -39
|
@@ -1,45 +1,66 @@
|
|
|
1
1
|
import * as i3 from '@ionic/angular/standalone';
|
|
2
2
|
import { IonContent, IonHeader, IonToolbar, IonTitle } from '@ionic/angular/standalone';
|
|
3
|
-
import { spxTextCheckingForUpdates, spxTextOneMomentPlease, spxTextUpdate, spxTextReadyToBeInstalled, spxTextPatchAvailable, spxTextUpdateAvailable, spxTextOpenAppStore } from '@softpak/components/spx-translate';
|
|
3
|
+
import { spxTextCheckingForUpdates, spxTextOneMomentPlease, spxTextUpdateErrorReason, spxTextUpdateAppVersion, spxTextUpdateBinaryVersionGroup, spxTextUpdateBuildVersion, spxTextUpdateLastCheck, spxTextUpdateLiveBundle, spxTextUpdateLiveChannel, spxTextUpdateStatus, spxTextUpdateVersionInfo, spxTextUpdateStatusCompleted, spxTextUpdateStatusWebNotAvailable, spxTextUpdateStatusFailed, spxTextUpdateStatusUpdateReady, spxTextUpdateStatusUpToDate, spxTextUpdateStatusReloading, spxTextUpdateStatusSyncing, spxTextUpdateStatusPreparing, spxTextUpdate, spxTextReadyToBeInstalled, spxTextPatchAvailable, spxTextUpdateAvailable, spxTextOpenAppStore, spxTextLiveUpdateCheckFailedWithReason, spxTextLiveUpdateCheckFailed } from '@softpak/components/spx-translate';
|
|
4
|
+
import { App } from '@capacitor/app';
|
|
4
5
|
import * as i0 from '@angular/core';
|
|
5
|
-
import {
|
|
6
|
+
import { signal, computed, effect, Component, HostBinding, ChangeDetectionStrategy, inject, Injectable } from '@angular/core';
|
|
7
|
+
import { SpxAppChannelTypeEnum } from '@softpak/components/spx-app-configuration';
|
|
6
8
|
import { SpxCapitalizePipe } from '@softpak/components/spx-capitalize';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
+
import { getBinaryVersionGroup, unsubscribeSubscriptions, SpxSeverityEnum } from '@softpak/components/spx-helpers';
|
|
10
|
+
import { SpxStorage, SpxStorageKeyEnum } from '@softpak/components/spx-storage';
|
|
11
|
+
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
|
9
12
|
import * as i1 from '@ngrx/store';
|
|
10
|
-
import { createActionGroup,
|
|
13
|
+
import { createActionGroup, emptyProps, props, createFeature, createReducer, on, Store } from '@ngrx/store';
|
|
11
14
|
import { DateTime } from 'luxon';
|
|
12
15
|
import * as i2 from '@angular/router';
|
|
13
16
|
import { SpxButtonComponent } from '@softpak/components/spx-button';
|
|
14
17
|
import * as i2$1 from '@angular/platform-browser';
|
|
15
|
-
import * as i1$1 from '@ngrx/effects';
|
|
16
18
|
import { Actions, createEffect, ofType } from '@ngrx/effects';
|
|
17
19
|
import { LiveUpdate } from '@capawesome/capacitor-live-update';
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { delay, mergeMap,
|
|
21
|
-
import { App } from '@capacitor/app';
|
|
20
|
+
import { spxToasterActions, SpxToasterAutoCloseSpeedEnum } from '@softpak/components/spx-toaster';
|
|
21
|
+
import { of, concat, from, timer } from 'rxjs';
|
|
22
|
+
import { delay, mergeMap, exhaustMap, map, catchError, tap } from 'rxjs/operators';
|
|
22
23
|
import { Capacitor } from '@capacitor/core';
|
|
23
|
-
import { SpxAppChannelTypeEnum } from '@softpak/components/spx-app-configuration';
|
|
24
24
|
import { captureMessage } from '@sentry/angular';
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const spxUpdateCheckActions = createActionGroup({
|
|
27
27
|
source: 'SpxUpdateCheck',
|
|
28
28
|
events: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
anUpdateIsReady: emptyProps(),
|
|
30
|
+
checkFailed: props(),
|
|
31
|
+
clearError: emptyProps(),
|
|
32
|
+
initialize: emptyProps(),
|
|
33
|
+
noUpdateWasFound: props(),
|
|
34
|
+
notAvailableOnWeb: emptyProps(),
|
|
35
|
+
reloadStarted: emptyProps(),
|
|
36
|
+
runCheck: props(),
|
|
37
|
+
syncStarted: emptyProps(),
|
|
36
38
|
},
|
|
37
39
|
});
|
|
38
40
|
|
|
41
|
+
var SpxUpdateCheckStatusEnum;
|
|
42
|
+
(function (SpxUpdateCheckStatusEnum) {
|
|
43
|
+
SpxUpdateCheckStatusEnum["failed"] = "failed";
|
|
44
|
+
SpxUpdateCheckStatusEnum["idle"] = "idle";
|
|
45
|
+
SpxUpdateCheckStatusEnum["notAvailableOnWeb"] = "notAvailableOnWeb";
|
|
46
|
+
SpxUpdateCheckStatusEnum["preparing"] = "preparing";
|
|
47
|
+
SpxUpdateCheckStatusEnum["reloading"] = "reloading";
|
|
48
|
+
SpxUpdateCheckStatusEnum["syncing"] = "syncing";
|
|
49
|
+
SpxUpdateCheckStatusEnum["upToDate"] = "upToDate";
|
|
50
|
+
SpxUpdateCheckStatusEnum["updateReady"] = "updateReady";
|
|
51
|
+
})(SpxUpdateCheckStatusEnum || (SpxUpdateCheckStatusEnum = {}));
|
|
52
|
+
|
|
53
|
+
var spxUpdateCheck_state = /*#__PURE__*/Object.freeze({
|
|
54
|
+
__proto__: null,
|
|
55
|
+
get SpxUpdateCheckStatusEnum () { return SpxUpdateCheckStatusEnum; }
|
|
56
|
+
});
|
|
57
|
+
|
|
39
58
|
const initialState$1 = {
|
|
40
59
|
forceWaitForUpdate: false,
|
|
60
|
+
lastErrorReason: null,
|
|
41
61
|
lastCheck: null,
|
|
42
62
|
showError: false,
|
|
63
|
+
status: SpxUpdateCheckStatusEnum.idle,
|
|
43
64
|
};
|
|
44
65
|
|
|
45
66
|
var spxUpdateCheck_initial = /*#__PURE__*/Object.freeze({
|
|
@@ -49,39 +70,60 @@ var spxUpdateCheck_initial = /*#__PURE__*/Object.freeze({
|
|
|
49
70
|
|
|
50
71
|
var updCheck = createFeature({
|
|
51
72
|
name: 'spxUpdateCheck',
|
|
52
|
-
reducer: createReducer(initialState$1, on(
|
|
73
|
+
reducer: createReducer(initialState$1, on(spxUpdateCheckActions.anUpdateIsReady, (state) => {
|
|
53
74
|
return {
|
|
54
75
|
...state,
|
|
55
76
|
lastCheck: DateTime.now().toISO(),
|
|
77
|
+
lastErrorReason: null,
|
|
56
78
|
showError: false,
|
|
79
|
+
status: SpxUpdateCheckStatusEnum.updateReady,
|
|
57
80
|
};
|
|
58
|
-
}), on(
|
|
81
|
+
}), on(spxUpdateCheckActions.clearError, (state) => {
|
|
59
82
|
return {
|
|
60
83
|
...state,
|
|
84
|
+
lastErrorReason: null,
|
|
61
85
|
showError: false,
|
|
62
86
|
};
|
|
63
|
-
}), on(
|
|
87
|
+
}), on(spxUpdateCheckActions.checkFailed, (state, { errorReason }) => {
|
|
64
88
|
return {
|
|
65
89
|
...state,
|
|
66
90
|
forceWaitForUpdate: false,
|
|
91
|
+
lastErrorReason: errorReason || null,
|
|
67
92
|
showError: true,
|
|
93
|
+
status: SpxUpdateCheckStatusEnum.failed,
|
|
68
94
|
};
|
|
69
|
-
}), on(
|
|
95
|
+
}), on(spxUpdateCheckActions.noUpdateWasFound, (state) => {
|
|
70
96
|
return {
|
|
71
97
|
...state,
|
|
72
98
|
forceWaitForUpdate: false,
|
|
73
99
|
lastCheck: DateTime.now().toISO(),
|
|
100
|
+
lastErrorReason: null,
|
|
101
|
+
showError: false,
|
|
102
|
+
status: SpxUpdateCheckStatusEnum.upToDate,
|
|
103
|
+
};
|
|
104
|
+
}), on(spxUpdateCheckActions.runCheck, (state, { forceWaitForUpdate }) => {
|
|
105
|
+
return {
|
|
106
|
+
...state,
|
|
107
|
+
forceWaitForUpdate: forceWaitForUpdate ? true : state.forceWaitForUpdate,
|
|
108
|
+
lastErrorReason: null,
|
|
74
109
|
showError: false,
|
|
110
|
+
status: SpxUpdateCheckStatusEnum.preparing,
|
|
75
111
|
};
|
|
76
|
-
}), on(
|
|
112
|
+
}), on(spxUpdateCheckActions.syncStarted, (state) => {
|
|
77
113
|
return {
|
|
78
114
|
...state,
|
|
79
|
-
|
|
115
|
+
status: SpxUpdateCheckStatusEnum.syncing,
|
|
80
116
|
};
|
|
81
|
-
}), on(
|
|
117
|
+
}), on(spxUpdateCheckActions.reloadStarted, (state) => {
|
|
82
118
|
return {
|
|
83
119
|
...state,
|
|
84
|
-
|
|
120
|
+
status: SpxUpdateCheckStatusEnum.reloading,
|
|
121
|
+
};
|
|
122
|
+
}), on(spxUpdateCheckActions.notAvailableOnWeb, (state) => {
|
|
123
|
+
return {
|
|
124
|
+
...state,
|
|
125
|
+
forceWaitForUpdate: false,
|
|
126
|
+
status: SpxUpdateCheckStatusEnum.notAvailableOnWeb,
|
|
85
127
|
};
|
|
86
128
|
})),
|
|
87
129
|
});
|
|
@@ -93,29 +135,105 @@ var spxUpdateCheck_reducer = /*#__PURE__*/Object.freeze({
|
|
|
93
135
|
|
|
94
136
|
class SpxUpdatePageComponent {
|
|
95
137
|
ngOnInit() {
|
|
96
|
-
this.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (this.activatedRoute.snapshot.data['url'] === undefined) {
|
|
100
|
-
console.error('configure data property \'url\' in route for update page');
|
|
101
|
-
}
|
|
102
|
-
this.navController.navigateRoot(this.activatedRoute.snapshot.data['url']);
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
ngOnDestroy() {
|
|
107
|
-
unsubscribeSubscriptions(this.subscriptions);
|
|
138
|
+
this.hasStarted.set(true);
|
|
139
|
+
void this.loadVersionInfo();
|
|
140
|
+
this.appStore.dispatch(spxUpdateCheckActions.runCheck({ forceWaitForUpdate: true }));
|
|
108
141
|
}
|
|
109
142
|
constructor(appStore, activatedRoute, navController) {
|
|
110
143
|
this.appStore = appStore;
|
|
111
144
|
this.activatedRoute = activatedRoute;
|
|
112
145
|
this.navController = navController;
|
|
146
|
+
this.appVersion = signal('-', ...(ngDevMode ? [{ debugName: "appVersion" }] : []));
|
|
147
|
+
this.binaryVersionGroup = signal('-', ...(ngDevMode ? [{ debugName: "binaryVersionGroup" }] : []));
|
|
148
|
+
this.buildVersion = signal('-', ...(ngDevMode ? [{ debugName: "buildVersion" }] : []));
|
|
149
|
+
this.lastCheck = this.appStore.selectSignal(updCheck.selectLastCheck);
|
|
150
|
+
this.lastErrorReason = this.appStore.selectSignal(updCheck.selectLastErrorReason);
|
|
151
|
+
this.forceWaitForUpdate = this.appStore.selectSignal(updCheck.selectForceWaitForUpdate);
|
|
152
|
+
this.hasStarted = signal(false, ...(ngDevMode ? [{ debugName: "hasStarted" }] : []));
|
|
153
|
+
this.liveBundle = signal('-', ...(ngDevMode ? [{ debugName: "liveBundle" }] : []));
|
|
154
|
+
this.liveUpdateChannel = signal('-', ...(ngDevMode ? [{ debugName: "liveUpdateChannel" }] : []));
|
|
155
|
+
this.status = this.appStore.selectSignal(updCheck.selectStatus);
|
|
113
156
|
this.spxTextCheckingForUpdates = spxTextCheckingForUpdates;
|
|
114
157
|
this.spxTextOneMomentPlease = spxTextOneMomentPlease;
|
|
115
|
-
this.
|
|
158
|
+
this.spxTextUpdateErrorReason = spxTextUpdateErrorReason;
|
|
159
|
+
this.spxTextUpdateAppVersion = spxTextUpdateAppVersion;
|
|
160
|
+
this.spxTextUpdateBinaryVersionGroup = spxTextUpdateBinaryVersionGroup;
|
|
161
|
+
this.spxTextUpdateBuildVersion = spxTextUpdateBuildVersion;
|
|
162
|
+
this.spxTextUpdateLastCheck = spxTextUpdateLastCheck;
|
|
163
|
+
this.spxTextUpdateLiveBundle = spxTextUpdateLiveBundle;
|
|
164
|
+
this.spxTextUpdateLiveChannel = spxTextUpdateLiveChannel;
|
|
165
|
+
this.spxTextUpdateStatus = spxTextUpdateStatus;
|
|
166
|
+
this.spxTextUpdateVersionInfo = spxTextUpdateVersionInfo;
|
|
167
|
+
this.statusText = computed(() => {
|
|
168
|
+
switch (this.status()) {
|
|
169
|
+
case SpxUpdateCheckStatusEnum.idle:
|
|
170
|
+
return spxTextUpdateStatusPreparing;
|
|
171
|
+
case SpxUpdateCheckStatusEnum.preparing:
|
|
172
|
+
return spxTextUpdateStatusPreparing;
|
|
173
|
+
case SpxUpdateCheckStatusEnum.syncing:
|
|
174
|
+
return spxTextUpdateStatusSyncing;
|
|
175
|
+
case SpxUpdateCheckStatusEnum.reloading:
|
|
176
|
+
return spxTextUpdateStatusReloading;
|
|
177
|
+
case SpxUpdateCheckStatusEnum.upToDate:
|
|
178
|
+
return spxTextUpdateStatusUpToDate;
|
|
179
|
+
case SpxUpdateCheckStatusEnum.updateReady:
|
|
180
|
+
return spxTextUpdateStatusUpdateReady;
|
|
181
|
+
case SpxUpdateCheckStatusEnum.failed:
|
|
182
|
+
return spxTextUpdateStatusFailed;
|
|
183
|
+
case SpxUpdateCheckStatusEnum.notAvailableOnWeb:
|
|
184
|
+
return spxTextUpdateStatusWebNotAvailable;
|
|
185
|
+
default:
|
|
186
|
+
return spxTextUpdateStatusCompleted;
|
|
187
|
+
}
|
|
188
|
+
}, ...(ngDevMode ? [{ debugName: "statusText" }] : []));
|
|
189
|
+
this.showError = this.appStore.selectSignal(updCheck.selectShowError);
|
|
190
|
+
effect(() => {
|
|
191
|
+
this.status();
|
|
192
|
+
this.refreshStorageVersionInfo();
|
|
193
|
+
});
|
|
194
|
+
effect(() => {
|
|
195
|
+
if (!this.hasStarted() || this.forceWaitForUpdate() || this.showError()) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (this.activatedRoute.snapshot.data['url'] === undefined) {
|
|
199
|
+
console.error('configure data property \'url\' in route for update page');
|
|
200
|
+
}
|
|
201
|
+
this.navController.navigateRoot(this.activatedRoute.snapshot.data['url']);
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
async loadVersionInfo() {
|
|
205
|
+
const appInfo = await App.getInfo();
|
|
206
|
+
const appVersion = appInfo.version || '-';
|
|
207
|
+
this.appVersion.set(appVersion);
|
|
208
|
+
this.buildVersion.set(appInfo.build || '-');
|
|
209
|
+
try {
|
|
210
|
+
const computedBinaryVersionGroup = `${getBinaryVersionGroup(appVersion)}.x`;
|
|
211
|
+
const storedBinaryVersionGroup = SpxStorage.getSetting(SpxStorageKeyEnum.binaryVersionGroup);
|
|
212
|
+
this.binaryVersionGroup.set(storedBinaryVersionGroup || computedBinaryVersionGroup);
|
|
213
|
+
const storedLiveUpdateChannel = SpxStorage.getSetting(SpxStorageKeyEnum.liveUpdateChannel);
|
|
214
|
+
const channelType = SpxStorage.getSetting(SpxStorageKeyEnum.channelType) || SpxAppChannelTypeEnum.production;
|
|
215
|
+
this.liveUpdateChannel.set(storedLiveUpdateChannel || `${channelType}-${computedBinaryVersionGroup}`);
|
|
216
|
+
}
|
|
217
|
+
catch {
|
|
218
|
+
this.binaryVersionGroup.set(SpxStorage.getSetting(SpxStorageKeyEnum.binaryVersionGroup) || '-');
|
|
219
|
+
this.liveUpdateChannel.set(SpxStorage.getSetting(SpxStorageKeyEnum.liveUpdateChannel) || '-');
|
|
220
|
+
}
|
|
221
|
+
this.refreshStorageVersionInfo();
|
|
222
|
+
}
|
|
223
|
+
refreshStorageVersionInfo() {
|
|
224
|
+
const storedBinaryVersionGroup = SpxStorage.getSetting(SpxStorageKeyEnum.binaryVersionGroup);
|
|
225
|
+
const storedLiveUpdateChannel = SpxStorage.getSetting(SpxStorageKeyEnum.liveUpdateChannel);
|
|
226
|
+
const storedLiveBundle = SpxStorage.getSetting(SpxStorageKeyEnum.liveUpdate);
|
|
227
|
+
if (storedBinaryVersionGroup) {
|
|
228
|
+
this.binaryVersionGroup.set(storedBinaryVersionGroup);
|
|
229
|
+
}
|
|
230
|
+
if (storedLiveUpdateChannel) {
|
|
231
|
+
this.liveUpdateChannel.set(storedLiveUpdateChannel);
|
|
232
|
+
}
|
|
233
|
+
this.liveBundle.set(storedLiveBundle || '-');
|
|
116
234
|
}
|
|
117
235
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: SpxUpdatePageComponent, deps: [{ token: i1.Store }, { token: i2.ActivatedRoute }, { token: i3.NavController }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
118
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
236
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.0", type: SpxUpdatePageComponent, isStandalone: true, selector: "spx-update-page", ngImport: i0, template: "<ion-header>\n <ion-toolbar>\n <ion-title>\n {{ spxTextCheckingForUpdates | translate | capitalize }}\n </ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class=\"ion-padding\">\n <p>{{ spxTextOneMomentPlease | translate | capitalize }}...</p>\n <p class=\"mt-2\">\n <strong>{{ spxTextUpdateStatus | translate | capitalize }}:</strong>\n {{ statusText() | translate | capitalize }}\n </p>\n @if (lastErrorReason()) {\n <p class=\"mt-2 text-red-700\">\n <strong>{{ spxTextUpdateErrorReason | translate | capitalize }}:</strong>\n {{ lastErrorReason() }}\n </p>\n }\n @if (lastCheck()) {\n <p class=\"mt-1 text-sm text-zinc-600\">\n <strong>{{ spxTextUpdateLastCheck | translate | capitalize }}:</strong>\n {{ lastCheck() }}\n </p>\n }\n\n <div class=\"mt-6 text-sm text-zinc-600\">\n <p><strong>{{ spxTextUpdateVersionInfo | translate | capitalize }}</strong></p>\n <p>{{ spxTextUpdateAppVersion | translate | capitalize }}: {{ appVersion() }}</p>\n <p>{{ spxTextUpdateBuildVersion | translate | capitalize }}: {{ buildVersion() }}</p>\n <p>{{ spxTextUpdateBinaryVersionGroup | translate | capitalize }}: {{ binaryVersionGroup() }}</p>\n <p>{{ spxTextUpdateLiveChannel | translate | capitalize }}: {{ liveUpdateChannel() }}</p>\n <p>{{ spxTextUpdateLiveBundle | translate | capitalize }}: {{ liveBundle() }}</p>\n </div>\n</ion-content>\n", dependencies: [{ kind: "component", type: IonContent, selector: "ion-content", inputs: ["color", "fixedSlotPlacement", "forceOverscroll", "fullscreen", "scrollEvents", "scrollX", "scrollY"] }, { kind: "component", type: IonHeader, selector: "ion-header", inputs: ["collapse", "mode", "translucent"] }, { kind: "component", type: IonToolbar, selector: "ion-toolbar", inputs: ["color", "mode"] }, { kind: "component", type: IonTitle, selector: "ion-title", inputs: ["color", "size"] }, { kind: "pipe", type: SpxCapitalizePipe, name: "capitalize" }, { kind: "pipe", type: TranslatePipe, name: "translate" }] }); }
|
|
119
237
|
}
|
|
120
238
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: SpxUpdatePageComponent, decorators: [{
|
|
121
239
|
type: Component,
|
|
@@ -126,7 +244,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
|
|
|
126
244
|
IonTitle,
|
|
127
245
|
SpxCapitalizePipe,
|
|
128
246
|
TranslatePipe,
|
|
129
|
-
], standalone: true, template: "<ion-header>\n <ion-toolbar>\n <ion-title>\n {{ spxTextCheckingForUpdates | translate | capitalize }}\n </ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class=\"ion-padding\">\n {{ spxTextOneMomentPlease | translate | capitalize }}
|
|
247
|
+
], standalone: true, template: "<ion-header>\n <ion-toolbar>\n <ion-title>\n {{ spxTextCheckingForUpdates | translate | capitalize }}\n </ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class=\"ion-padding\">\n <p>{{ spxTextOneMomentPlease | translate | capitalize }}...</p>\n <p class=\"mt-2\">\n <strong>{{ spxTextUpdateStatus | translate | capitalize }}:</strong>\n {{ statusText() | translate | capitalize }}\n </p>\n @if (lastErrorReason()) {\n <p class=\"mt-2 text-red-700\">\n <strong>{{ spxTextUpdateErrorReason | translate | capitalize }}:</strong>\n {{ lastErrorReason() }}\n </p>\n }\n @if (lastCheck()) {\n <p class=\"mt-1 text-sm text-zinc-600\">\n <strong>{{ spxTextUpdateLastCheck | translate | capitalize }}:</strong>\n {{ lastCheck() }}\n </p>\n }\n\n <div class=\"mt-6 text-sm text-zinc-600\">\n <p><strong>{{ spxTextUpdateVersionInfo | translate | capitalize }}</strong></p>\n <p>{{ spxTextUpdateAppVersion | translate | capitalize }}: {{ appVersion() }}</p>\n <p>{{ spxTextUpdateBuildVersion | translate | capitalize }}: {{ buildVersion() }}</p>\n <p>{{ spxTextUpdateBinaryVersionGroup | translate | capitalize }}: {{ binaryVersionGroup() }}</p>\n <p>{{ spxTextUpdateLiveChannel | translate | capitalize }}: {{ liveUpdateChannel() }}</p>\n <p>{{ spxTextUpdateLiveBundle | translate | capitalize }}: {{ liveBundle() }}</p>\n </div>\n</ion-content>\n" }]
|
|
130
248
|
}], ctorParameters: () => [{ type: i1.Store }, { type: i2.ActivatedRoute }, { type: i3.NavController }] });
|
|
131
249
|
|
|
132
250
|
const SpxUpdatePendingActions = createActionGroup({
|
|
@@ -234,49 +352,99 @@ const spxUpdateUrl = '';
|
|
|
234
352
|
let Effects$1 = class Effects {
|
|
235
353
|
constructor() {
|
|
236
354
|
this.actions$ = inject(Actions);
|
|
237
|
-
this.
|
|
238
|
-
|
|
355
|
+
this.translateService = inject(TranslateService);
|
|
356
|
+
this.afterInitialize$ = createEffect(() => this.actions$.pipe(ofType(spxUpdateCheckActions.initialize), delay(120000), mergeMap(() => [
|
|
357
|
+
spxUpdateCheckActions.runCheck({}),
|
|
239
358
|
])));
|
|
240
|
-
this.onRun$ = createEffect(() => this.actions$.pipe(ofType(
|
|
241
|
-
if (Capacitor.getPlatform()
|
|
359
|
+
this.onRun$ = createEffect(() => this.actions$.pipe(ofType(spxUpdateCheckActions.runCheck), exhaustMap((action) => {
|
|
360
|
+
if (Capacitor.getPlatform() === 'web') {
|
|
361
|
+
return of(spxUpdateCheckActions.notAvailableOnWeb());
|
|
362
|
+
}
|
|
363
|
+
return concat(of(spxUpdateCheckActions.syncStarted()), from(App.getInfo()).pipe(mergeMap((binaryInfo) => {
|
|
242
364
|
// Migrate from e.g. 1.2.x to 1.3.x
|
|
243
|
-
const
|
|
244
|
-
const
|
|
245
|
-
let channelType = SpxStorage.getSetting(SpxStorageKeyEnum.channelType);
|
|
365
|
+
const binaryVersionGroup = getBinaryVersionGroup(binaryInfo.version);
|
|
366
|
+
const channelType = SpxStorage.getSetting(SpxStorageKeyEnum.channelType);
|
|
246
367
|
if (SpxStorage.getSetting(SpxStorageKeyEnum.binaryVersionGroup)) {
|
|
247
368
|
SpxStorage.setSetting(SpxStorageKeyEnum.lastBinaryVersionGroup, SpxStorage.getSetting(SpxStorageKeyEnum.binaryVersionGroup));
|
|
248
369
|
}
|
|
249
370
|
SpxStorage.setSetting(SpxStorageKeyEnum.binaryVersionGroup, `${binaryVersionGroup}.x`);
|
|
250
371
|
SpxStorage.setSetting(SpxStorageKeyEnum.liveUpdateChannel, `${channelType ? channelType : SpxAppChannelTypeEnum.production}-${binaryVersionGroup}.x`);
|
|
251
372
|
// End migrate from e.g. 1.2.x to 1.3.x
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
373
|
+
return from(LiveUpdate.sync({ channel: SpxStorage.getSetting(SpxStorageKeyEnum.liveUpdateChannel) }));
|
|
374
|
+
}), mergeMap((syncResult) => {
|
|
375
|
+
if (syncResult.nextBundleId) {
|
|
376
|
+
SpxStorage.setSetting(SpxStorageKeyEnum.liveUpdate, syncResult.nextBundleId);
|
|
377
|
+
if (action.forceWaitForUpdate) {
|
|
378
|
+
return concat(of(spxUpdateCheckActions.reloadStarted()), from(LiveUpdate.reload()).pipe(map(() => spxUpdateCheckActions.anUpdateIsReady()), catchError((err) => {
|
|
379
|
+
const errorReason = this.getReadableErrorReason(err);
|
|
380
|
+
captureMessage(`[UPD] Reload failed: ${errorReason}`);
|
|
381
|
+
return of(spxUpdateCheckActions.checkFailed({
|
|
382
|
+
errorReason,
|
|
383
|
+
startUpdateAgainAfterTimeout: false,
|
|
384
|
+
}));
|
|
385
|
+
})));
|
|
386
|
+
}
|
|
387
|
+
return of(spxUpdateCheckActions.anUpdateIsReady());
|
|
258
388
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
389
|
+
else {
|
|
390
|
+
return of(spxUpdateCheckActions.noUpdateWasFound({ startUpdateAgainAfterTimeout: !action.forceWaitForUpdate }));
|
|
391
|
+
}
|
|
392
|
+
}), catchError((err) => {
|
|
393
|
+
const errorReason = this.getReadableErrorReason(err);
|
|
394
|
+
if (this.isSyncAlreadyInProgress(errorReason)) {
|
|
395
|
+
return timer(1500).pipe(map(() => spxUpdateCheckActions.runCheck({ forceWaitForUpdate: action.forceWaitForUpdate })));
|
|
396
|
+
}
|
|
397
|
+
captureMessage(`[UPD] Handled: ${errorReason}`);
|
|
398
|
+
return of(spxUpdateCheckActions.checkFailed({
|
|
399
|
+
errorReason,
|
|
400
|
+
startUpdateAgainAfterTimeout: false,
|
|
401
|
+
}));
|
|
402
|
+
})));
|
|
403
|
+
})));
|
|
404
|
+
this.whenAndUpdateIsReady$ = createEffect(() => this.actions$.pipe(ofType(spxUpdateCheckActions.anUpdateIsReady), mergeMap(() => [
|
|
271
405
|
SpxUpdatePendingActions.hasBeenDownloaded(),
|
|
272
406
|
])));
|
|
273
|
-
this.whenCheckHasFailed$ = createEffect(() => this.actions$.pipe(ofType(
|
|
274
|
-
|
|
407
|
+
this.whenCheckHasFailed$ = createEffect(() => this.actions$.pipe(ofType(spxUpdateCheckActions.checkFailed), delay(30000), mergeMap((action) => !action.startUpdateAgainAfterTimeout ? [] : [
|
|
408
|
+
spxUpdateCheckActions.runCheck({}),
|
|
275
409
|
])));
|
|
276
|
-
this.
|
|
277
|
-
|
|
410
|
+
this.whenCheckHasFailedShowError$ = createEffect(() => this.actions$.pipe(ofType(spxUpdateCheckActions.checkFailed), map((action) => spxToasterActions.createError({
|
|
411
|
+
autoClose: SpxToasterAutoCloseSpeedEnum.DEFAULT,
|
|
412
|
+
messageText: action.errorReason
|
|
413
|
+
? this.translateService.instant(spxTextLiveUpdateCheckFailedWithReason, { reason: action.errorReason })
|
|
414
|
+
: this.translateService.instant(spxTextLiveUpdateCheckFailed),
|
|
415
|
+
}))));
|
|
416
|
+
this.whenNoUpdateWasFound$ = createEffect(() => this.actions$.pipe(ofType(spxUpdateCheckActions.noUpdateWasFound), delay(120000), mergeMap((action) => !action.startUpdateAgainAfterTimeout ? [] : [
|
|
417
|
+
spxUpdateCheckActions.runCheck({}),
|
|
278
418
|
])));
|
|
279
419
|
}
|
|
420
|
+
getReadableErrorReason(err) {
|
|
421
|
+
if (err instanceof Error && err.message?.trim()) {
|
|
422
|
+
return err.message.trim();
|
|
423
|
+
}
|
|
424
|
+
if (typeof err === 'string' && err.trim()) {
|
|
425
|
+
return err.trim();
|
|
426
|
+
}
|
|
427
|
+
if (err && typeof err === 'object') {
|
|
428
|
+
const withMessage = err;
|
|
429
|
+
if (typeof withMessage.message === 'string' && withMessage.message.trim()) {
|
|
430
|
+
return withMessage.message.trim();
|
|
431
|
+
}
|
|
432
|
+
try {
|
|
433
|
+
const serialized = JSON.stringify(err);
|
|
434
|
+
if (serialized && serialized !== '{}') {
|
|
435
|
+
return serialized.length > 180 ? `${serialized.slice(0, 177)}...` : serialized;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
catch {
|
|
439
|
+
// ignore serialization errors
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
return '';
|
|
443
|
+
}
|
|
444
|
+
isSyncAlreadyInProgress(errorReason) {
|
|
445
|
+
const normalized = errorReason.toLowerCase();
|
|
446
|
+
return normalized.includes('sync is already in progress');
|
|
447
|
+
}
|
|
280
448
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: Effects, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
281
449
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: Effects }); }
|
|
282
450
|
};
|
|
@@ -289,24 +457,54 @@ var spxUpdateCheck_effects = /*#__PURE__*/Object.freeze({
|
|
|
289
457
|
Effects: Effects$1
|
|
290
458
|
});
|
|
291
459
|
|
|
292
|
-
var spxUpdateCheck_state = /*#__PURE__*/Object.freeze({
|
|
293
|
-
__proto__: null
|
|
294
|
-
});
|
|
295
|
-
|
|
296
460
|
class Effects {
|
|
297
|
-
constructor(
|
|
298
|
-
this.actions$ =
|
|
299
|
-
this.
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
461
|
+
constructor() {
|
|
462
|
+
this.actions$ = inject(Actions);
|
|
463
|
+
this.appStore = inject(Store);
|
|
464
|
+
this.translateService = inject(TranslateService);
|
|
465
|
+
this.whenAccepted$ = createEffect(() => this.actions$.pipe(ofType(SpxUpdatePendingActions.acceptUpdate), tap(() => {
|
|
466
|
+
void LiveUpdate.reload().catch((err) => {
|
|
467
|
+
const errorReason = this.getReadableErrorReason(err);
|
|
468
|
+
captureMessage(`[UPD] Accept reload failed: ${errorReason}`);
|
|
469
|
+
this.appStore.dispatch(spxToasterActions.createError({
|
|
470
|
+
autoClose: SpxToasterAutoCloseSpeedEnum.DEFAULT,
|
|
471
|
+
messageText: errorReason
|
|
472
|
+
? this.translateService.instant(spxTextLiveUpdateCheckFailedWithReason, { reason: errorReason })
|
|
473
|
+
: this.translateService.instant(spxTextLiveUpdateCheckFailed),
|
|
474
|
+
}));
|
|
475
|
+
});
|
|
476
|
+
})), { dispatch: false });
|
|
303
477
|
}
|
|
304
|
-
|
|
478
|
+
getReadableErrorReason(err) {
|
|
479
|
+
if (err instanceof Error && err.message?.trim()) {
|
|
480
|
+
return err.message.trim();
|
|
481
|
+
}
|
|
482
|
+
if (typeof err === 'string' && err.trim()) {
|
|
483
|
+
return err.trim();
|
|
484
|
+
}
|
|
485
|
+
if (err && typeof err === 'object') {
|
|
486
|
+
const withMessage = err;
|
|
487
|
+
if (typeof withMessage.message === 'string' && withMessage.message.trim()) {
|
|
488
|
+
return withMessage.message.trim();
|
|
489
|
+
}
|
|
490
|
+
try {
|
|
491
|
+
const serialized = JSON.stringify(err);
|
|
492
|
+
if (serialized && serialized !== '{}') {
|
|
493
|
+
return serialized.length > 180 ? `${serialized.slice(0, 177)}...` : serialized;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
catch {
|
|
497
|
+
// ignore serialization errors
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
return '';
|
|
501
|
+
}
|
|
502
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: Effects, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
305
503
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: Effects }); }
|
|
306
504
|
}
|
|
307
505
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: Effects, decorators: [{
|
|
308
506
|
type: Injectable
|
|
309
|
-
}]
|
|
507
|
+
}] });
|
|
310
508
|
|
|
311
509
|
var spxUpdatePending_effects = /*#__PURE__*/Object.freeze({
|
|
312
510
|
__proto__: null,
|
|
@@ -321,5 +519,5 @@ var spxUpdatePending_state = /*#__PURE__*/Object.freeze({
|
|
|
321
519
|
* Generated bundle index. Do not edit.
|
|
322
520
|
*/
|
|
323
521
|
|
|
324
|
-
export {
|
|
522
|
+
export { SpxUpdatePageComponent, SpxUpdatePendingActions, SpxUpdatePendingComponent, spxUpdateCheckActions, spxUpdateCheck_effects as spxUpdateCheckEffects, spxUpdateCheck_initial as spxUpdateCheckInitial, spxUpdateCheck_reducer as spxUpdateCheckReducer, spxUpdateCheck_state as spxUpdateCheckState, spxUpdatePending_effects as spxUpdatePendingEffects, spxUpdatePending_initial as spxUpdatePendingInitial, spxUpdatePending_reducer as spxUpdatePendingReducer, spxUpdatePending_state as spxUpdatePendingState, spxUpdateUrl };
|
|
325
523
|
//# sourceMappingURL=softpak-components-spx-update.mjs.map
|