@etsoo/appscript 1.1.99 → 1.2.3
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/__tests__/app/CoreApp.ts +1 -1
- package/lib/cjs/app/CoreApp.d.ts +20 -0
- package/lib/cjs/app/CoreApp.js +55 -19
- package/lib/mjs/app/CoreApp.d.ts +20 -0
- package/lib/mjs/app/CoreApp.js +55 -19
- package/package.json +2 -2
- package/src/app/CoreApp.ts +73 -24
package/__tests__/app/CoreApp.ts
CHANGED
package/lib/cjs/app/CoreApp.d.ts
CHANGED
|
@@ -293,6 +293,10 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
293
293
|
* @returns Result
|
|
294
294
|
*/
|
|
295
295
|
orgList(items?: number, serviceId?: number): Promise<IdLabelDto[] | undefined>;
|
|
296
|
+
/**
|
|
297
|
+
* Persist settings to source when application exit
|
|
298
|
+
*/
|
|
299
|
+
persist(): void;
|
|
296
300
|
/**
|
|
297
301
|
* Switch organization
|
|
298
302
|
* @param id Organization id
|
|
@@ -427,6 +431,10 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
427
431
|
*/
|
|
428
432
|
protected passphrase: string;
|
|
429
433
|
private cachedRefreshToken?;
|
|
434
|
+
/**
|
|
435
|
+
* Get persisted fields
|
|
436
|
+
*/
|
|
437
|
+
protected get persistedFields(): string[];
|
|
430
438
|
/**
|
|
431
439
|
* Protected constructor
|
|
432
440
|
* @param settings Settings
|
|
@@ -436,6 +444,18 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
436
444
|
* @param name Application name
|
|
437
445
|
*/
|
|
438
446
|
protected constructor(settings: S, api: IApi, notifier: INotifier<N, C>, storage: IStorage, name: string);
|
|
447
|
+
/**
|
|
448
|
+
* Restore settings from persisted source
|
|
449
|
+
*/
|
|
450
|
+
protected restore(): boolean;
|
|
451
|
+
/**
|
|
452
|
+
* Persist settings to source when application exit
|
|
453
|
+
*/
|
|
454
|
+
persist(): void;
|
|
455
|
+
/**
|
|
456
|
+
* Setup Api
|
|
457
|
+
* @param api Api
|
|
458
|
+
*/
|
|
439
459
|
protected setApi(api: IApi): void;
|
|
440
460
|
/**
|
|
441
461
|
* Api init call
|
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -21,7 +21,6 @@ class CoreApp {
|
|
|
21
21
|
* @param name Application name
|
|
22
22
|
*/
|
|
23
23
|
constructor(settings, api, notifier, storage, name) {
|
|
24
|
-
var _a;
|
|
25
24
|
this._authorized = false;
|
|
26
25
|
this._isTryingLogin = false;
|
|
27
26
|
/**
|
|
@@ -39,14 +38,16 @@ class CoreApp {
|
|
|
39
38
|
/**
|
|
40
39
|
* Passphrase for encryption
|
|
41
40
|
*/
|
|
42
|
-
this.passphrase = '
|
|
41
|
+
this.passphrase = '';
|
|
43
42
|
this.settings = settings;
|
|
44
43
|
this.api = api;
|
|
45
44
|
this.notifier = notifier;
|
|
46
45
|
this.storage = storage;
|
|
47
46
|
this.name = name;
|
|
47
|
+
// Restore
|
|
48
|
+
this.restore();
|
|
48
49
|
// Device id
|
|
49
|
-
this._deviceId =
|
|
50
|
+
this._deviceId = storage.getData(CoreApp.deviceIdField, '');
|
|
50
51
|
this.setApi(api);
|
|
51
52
|
const { currentCulture, currentRegion } = settings;
|
|
52
53
|
this.changeCulture(currentCulture);
|
|
@@ -111,6 +112,49 @@ class CoreApp {
|
|
|
111
112
|
set authorized(value) {
|
|
112
113
|
this._authorized = value;
|
|
113
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Get persisted fields
|
|
117
|
+
*/
|
|
118
|
+
get persistedFields() {
|
|
119
|
+
return [
|
|
120
|
+
CoreApp.deviceIdField,
|
|
121
|
+
CoreApp.serversideDeviceIdField,
|
|
122
|
+
CoreApp.headerTokenField
|
|
123
|
+
];
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Restore settings from persisted source
|
|
127
|
+
*/
|
|
128
|
+
restore() {
|
|
129
|
+
const passphraseEncrypted = this.storage.getData(CoreApp.devicePassphraseField);
|
|
130
|
+
if (passphraseEncrypted) {
|
|
131
|
+
const passphraseDecrypted = this.decrypt(passphraseEncrypted, this.name);
|
|
132
|
+
if (passphraseDecrypted != null) {
|
|
133
|
+
this.passphrase = passphraseDecrypted;
|
|
134
|
+
// Same device
|
|
135
|
+
if (this.deviceId ===
|
|
136
|
+
this.storage.getPersistedData(CoreApp.deviceIdField)) {
|
|
137
|
+
this.storage.clear(this.persistedFields, true);
|
|
138
|
+
}
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// Restore
|
|
143
|
+
this.storage.copyFrom(this.persistedFields, true);
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Persist settings to source when application exit
|
|
148
|
+
*/
|
|
149
|
+
persist() {
|
|
150
|
+
if (!this.authorized)
|
|
151
|
+
return;
|
|
152
|
+
this.storage.copyTo(this.persistedFields);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Setup Api
|
|
156
|
+
* @param api Api
|
|
157
|
+
*/
|
|
114
158
|
setApi(api) {
|
|
115
159
|
// onRequest, show loading or not, rewrite the property to override default action
|
|
116
160
|
api.onRequest = (data) => {
|
|
@@ -157,16 +201,10 @@ class CoreApp {
|
|
|
157
201
|
async initCall(callback) {
|
|
158
202
|
var _a;
|
|
159
203
|
// Passphrase exists?
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (passphraseDecrypted != null) {
|
|
165
|
-
this.passphrase = passphraseDecrypted;
|
|
166
|
-
if (callback)
|
|
167
|
-
callback(true);
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
204
|
+
if (this.passphrase) {
|
|
205
|
+
if (callback)
|
|
206
|
+
callback(true);
|
|
207
|
+
return;
|
|
170
208
|
}
|
|
171
209
|
// Serverside encrypted device id
|
|
172
210
|
const identifier = this.storage.getData(CoreApp.serversideDeviceIdField);
|
|
@@ -322,7 +360,7 @@ class CoreApp {
|
|
|
322
360
|
if (regionItem == null || !this.settings.regions.includes(regionId))
|
|
323
361
|
return;
|
|
324
362
|
// Save the id to local storage
|
|
325
|
-
this.storage.
|
|
363
|
+
this.storage.setPersistedData(shared_1.DomUtils.CountryField, regionId);
|
|
326
364
|
// Set the currency and culture
|
|
327
365
|
this._currency = regionItem.currency;
|
|
328
366
|
this._region = regionId;
|
|
@@ -340,7 +378,7 @@ class CoreApp {
|
|
|
340
378
|
if (this._culture === name)
|
|
341
379
|
return;
|
|
342
380
|
// Save the cultrue to local storage
|
|
343
|
-
this.storage.
|
|
381
|
+
this.storage.setPersistedData(shared_1.DomUtils.CultureField, name);
|
|
344
382
|
// Change the API's Content-Language header
|
|
345
383
|
// .net 5 API, UseRequestLocalization, RequestCultureProviders, ContentLanguageHeaderRequestCultureProvider
|
|
346
384
|
this.api.setContentLanguage(name);
|
|
@@ -359,17 +397,15 @@ class CoreApp {
|
|
|
359
397
|
* Clear cache data
|
|
360
398
|
*/
|
|
361
399
|
clearCacheData() {
|
|
362
|
-
this.
|
|
363
|
-
this.storage.setData(CoreApp.deviceIdField, undefined);
|
|
400
|
+
this.clearCacheToken();
|
|
364
401
|
this.storage.setData(CoreApp.devicePassphraseField, undefined);
|
|
365
|
-
this.storage.setData(CoreApp.headerTokenField, undefined);
|
|
366
402
|
}
|
|
367
403
|
/**
|
|
368
404
|
* Clear cached token
|
|
369
405
|
*/
|
|
370
406
|
clearCacheToken() {
|
|
371
407
|
this.cachedRefreshToken = undefined;
|
|
372
|
-
this.storage.
|
|
408
|
+
this.storage.setPersistedData(CoreApp.headerTokenField, undefined);
|
|
373
409
|
}
|
|
374
410
|
/**
|
|
375
411
|
* Decrypt message
|
package/lib/mjs/app/CoreApp.d.ts
CHANGED
|
@@ -293,6 +293,10 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
293
293
|
* @returns Result
|
|
294
294
|
*/
|
|
295
295
|
orgList(items?: number, serviceId?: number): Promise<IdLabelDto[] | undefined>;
|
|
296
|
+
/**
|
|
297
|
+
* Persist settings to source when application exit
|
|
298
|
+
*/
|
|
299
|
+
persist(): void;
|
|
296
300
|
/**
|
|
297
301
|
* Switch organization
|
|
298
302
|
* @param id Organization id
|
|
@@ -427,6 +431,10 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
427
431
|
*/
|
|
428
432
|
protected passphrase: string;
|
|
429
433
|
private cachedRefreshToken?;
|
|
434
|
+
/**
|
|
435
|
+
* Get persisted fields
|
|
436
|
+
*/
|
|
437
|
+
protected get persistedFields(): string[];
|
|
430
438
|
/**
|
|
431
439
|
* Protected constructor
|
|
432
440
|
* @param settings Settings
|
|
@@ -436,6 +444,18 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
436
444
|
* @param name Application name
|
|
437
445
|
*/
|
|
438
446
|
protected constructor(settings: S, api: IApi, notifier: INotifier<N, C>, storage: IStorage, name: string);
|
|
447
|
+
/**
|
|
448
|
+
* Restore settings from persisted source
|
|
449
|
+
*/
|
|
450
|
+
protected restore(): boolean;
|
|
451
|
+
/**
|
|
452
|
+
* Persist settings to source when application exit
|
|
453
|
+
*/
|
|
454
|
+
persist(): void;
|
|
455
|
+
/**
|
|
456
|
+
* Setup Api
|
|
457
|
+
* @param api Api
|
|
458
|
+
*/
|
|
439
459
|
protected setApi(api: IApi): void;
|
|
440
460
|
/**
|
|
441
461
|
* Api init call
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -18,7 +18,6 @@ export class CoreApp {
|
|
|
18
18
|
* @param name Application name
|
|
19
19
|
*/
|
|
20
20
|
constructor(settings, api, notifier, storage, name) {
|
|
21
|
-
var _a;
|
|
22
21
|
this._authorized = false;
|
|
23
22
|
this._isTryingLogin = false;
|
|
24
23
|
/**
|
|
@@ -36,14 +35,16 @@ export class CoreApp {
|
|
|
36
35
|
/**
|
|
37
36
|
* Passphrase for encryption
|
|
38
37
|
*/
|
|
39
|
-
this.passphrase = '
|
|
38
|
+
this.passphrase = '';
|
|
40
39
|
this.settings = settings;
|
|
41
40
|
this.api = api;
|
|
42
41
|
this.notifier = notifier;
|
|
43
42
|
this.storage = storage;
|
|
44
43
|
this.name = name;
|
|
44
|
+
// Restore
|
|
45
|
+
this.restore();
|
|
45
46
|
// Device id
|
|
46
|
-
this._deviceId =
|
|
47
|
+
this._deviceId = storage.getData(CoreApp.deviceIdField, '');
|
|
47
48
|
this.setApi(api);
|
|
48
49
|
const { currentCulture, currentRegion } = settings;
|
|
49
50
|
this.changeCulture(currentCulture);
|
|
@@ -108,6 +109,49 @@ export class CoreApp {
|
|
|
108
109
|
set authorized(value) {
|
|
109
110
|
this._authorized = value;
|
|
110
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Get persisted fields
|
|
114
|
+
*/
|
|
115
|
+
get persistedFields() {
|
|
116
|
+
return [
|
|
117
|
+
CoreApp.deviceIdField,
|
|
118
|
+
CoreApp.serversideDeviceIdField,
|
|
119
|
+
CoreApp.headerTokenField
|
|
120
|
+
];
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Restore settings from persisted source
|
|
124
|
+
*/
|
|
125
|
+
restore() {
|
|
126
|
+
const passphraseEncrypted = this.storage.getData(CoreApp.devicePassphraseField);
|
|
127
|
+
if (passphraseEncrypted) {
|
|
128
|
+
const passphraseDecrypted = this.decrypt(passphraseEncrypted, this.name);
|
|
129
|
+
if (passphraseDecrypted != null) {
|
|
130
|
+
this.passphrase = passphraseDecrypted;
|
|
131
|
+
// Same device
|
|
132
|
+
if (this.deviceId ===
|
|
133
|
+
this.storage.getPersistedData(CoreApp.deviceIdField)) {
|
|
134
|
+
this.storage.clear(this.persistedFields, true);
|
|
135
|
+
}
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// Restore
|
|
140
|
+
this.storage.copyFrom(this.persistedFields, true);
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Persist settings to source when application exit
|
|
145
|
+
*/
|
|
146
|
+
persist() {
|
|
147
|
+
if (!this.authorized)
|
|
148
|
+
return;
|
|
149
|
+
this.storage.copyTo(this.persistedFields);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Setup Api
|
|
153
|
+
* @param api Api
|
|
154
|
+
*/
|
|
111
155
|
setApi(api) {
|
|
112
156
|
// onRequest, show loading or not, rewrite the property to override default action
|
|
113
157
|
api.onRequest = (data) => {
|
|
@@ -154,16 +198,10 @@ export class CoreApp {
|
|
|
154
198
|
async initCall(callback) {
|
|
155
199
|
var _a;
|
|
156
200
|
// Passphrase exists?
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
if (passphraseDecrypted != null) {
|
|
162
|
-
this.passphrase = passphraseDecrypted;
|
|
163
|
-
if (callback)
|
|
164
|
-
callback(true);
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
201
|
+
if (this.passphrase) {
|
|
202
|
+
if (callback)
|
|
203
|
+
callback(true);
|
|
204
|
+
return;
|
|
167
205
|
}
|
|
168
206
|
// Serverside encrypted device id
|
|
169
207
|
const identifier = this.storage.getData(CoreApp.serversideDeviceIdField);
|
|
@@ -319,7 +357,7 @@ export class CoreApp {
|
|
|
319
357
|
if (regionItem == null || !this.settings.regions.includes(regionId))
|
|
320
358
|
return;
|
|
321
359
|
// Save the id to local storage
|
|
322
|
-
this.storage.
|
|
360
|
+
this.storage.setPersistedData(DomUtils.CountryField, regionId);
|
|
323
361
|
// Set the currency and culture
|
|
324
362
|
this._currency = regionItem.currency;
|
|
325
363
|
this._region = regionId;
|
|
@@ -337,7 +375,7 @@ export class CoreApp {
|
|
|
337
375
|
if (this._culture === name)
|
|
338
376
|
return;
|
|
339
377
|
// Save the cultrue to local storage
|
|
340
|
-
this.storage.
|
|
378
|
+
this.storage.setPersistedData(DomUtils.CultureField, name);
|
|
341
379
|
// Change the API's Content-Language header
|
|
342
380
|
// .net 5 API, UseRequestLocalization, RequestCultureProviders, ContentLanguageHeaderRequestCultureProvider
|
|
343
381
|
this.api.setContentLanguage(name);
|
|
@@ -356,17 +394,15 @@ export class CoreApp {
|
|
|
356
394
|
* Clear cache data
|
|
357
395
|
*/
|
|
358
396
|
clearCacheData() {
|
|
359
|
-
this.
|
|
360
|
-
this.storage.setData(CoreApp.deviceIdField, undefined);
|
|
397
|
+
this.clearCacheToken();
|
|
361
398
|
this.storage.setData(CoreApp.devicePassphraseField, undefined);
|
|
362
|
-
this.storage.setData(CoreApp.headerTokenField, undefined);
|
|
363
399
|
}
|
|
364
400
|
/**
|
|
365
401
|
* Clear cached token
|
|
366
402
|
*/
|
|
367
403
|
clearCacheToken() {
|
|
368
404
|
this.cachedRefreshToken = undefined;
|
|
369
|
-
this.storage.
|
|
405
|
+
this.storage.setPersistedData(CoreApp.headerTokenField, undefined);
|
|
370
406
|
}
|
|
371
407
|
/**
|
|
372
408
|
* Decrypt message
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/appscript",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Applications shared TypeScript framework",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@etsoo/notificationbase": "^1.0.95",
|
|
56
56
|
"@etsoo/restclient": "^1.0.63",
|
|
57
|
-
"@etsoo/shared": "^1.0.
|
|
57
|
+
"@etsoo/shared": "^1.0.94",
|
|
58
58
|
"@types/crypto-js": "^4.0.2",
|
|
59
59
|
"crypto-js": "^4.1.1"
|
|
60
60
|
},
|
package/src/app/CoreApp.ts
CHANGED
|
@@ -403,6 +403,11 @@ export interface ICoreApp<
|
|
|
403
403
|
serviceId?: number
|
|
404
404
|
): Promise<IdLabelDto[] | undefined>;
|
|
405
405
|
|
|
406
|
+
/**
|
|
407
|
+
* Persist settings to source when application exit
|
|
408
|
+
*/
|
|
409
|
+
persist(): void;
|
|
410
|
+
|
|
406
411
|
/**
|
|
407
412
|
* Switch organization
|
|
408
413
|
* @param id Organization id
|
|
@@ -591,10 +596,21 @@ export abstract class CoreApp<
|
|
|
591
596
|
/**
|
|
592
597
|
* Passphrase for encryption
|
|
593
598
|
*/
|
|
594
|
-
protected passphrase: string = '
|
|
599
|
+
protected passphrase: string = '';
|
|
595
600
|
|
|
596
601
|
private cachedRefreshToken?: string;
|
|
597
602
|
|
|
603
|
+
/**
|
|
604
|
+
* Get persisted fields
|
|
605
|
+
*/
|
|
606
|
+
protected get persistedFields() {
|
|
607
|
+
return [
|
|
608
|
+
CoreApp.deviceIdField,
|
|
609
|
+
CoreApp.serversideDeviceIdField,
|
|
610
|
+
CoreApp.headerTokenField
|
|
611
|
+
];
|
|
612
|
+
}
|
|
613
|
+
|
|
598
614
|
/**
|
|
599
615
|
* Protected constructor
|
|
600
616
|
* @param settings Settings
|
|
@@ -616,8 +632,11 @@ export abstract class CoreApp<
|
|
|
616
632
|
this.storage = storage;
|
|
617
633
|
this.name = name;
|
|
618
634
|
|
|
635
|
+
// Restore
|
|
636
|
+
this.restore();
|
|
637
|
+
|
|
619
638
|
// Device id
|
|
620
|
-
this._deviceId = storage.getData
|
|
639
|
+
this._deviceId = storage.getData(CoreApp.deviceIdField, '');
|
|
621
640
|
|
|
622
641
|
this.setApi(api);
|
|
623
642
|
|
|
@@ -630,6 +649,51 @@ export abstract class CoreApp<
|
|
|
630
649
|
this.setup();
|
|
631
650
|
}
|
|
632
651
|
|
|
652
|
+
/**
|
|
653
|
+
* Restore settings from persisted source
|
|
654
|
+
*/
|
|
655
|
+
protected restore() {
|
|
656
|
+
const passphraseEncrypted = this.storage.getData<string>(
|
|
657
|
+
CoreApp.devicePassphraseField
|
|
658
|
+
);
|
|
659
|
+
if (passphraseEncrypted) {
|
|
660
|
+
const passphraseDecrypted = this.decrypt(
|
|
661
|
+
passphraseEncrypted,
|
|
662
|
+
this.name
|
|
663
|
+
);
|
|
664
|
+
if (passphraseDecrypted != null) {
|
|
665
|
+
this.passphrase = passphraseDecrypted;
|
|
666
|
+
|
|
667
|
+
// Same device
|
|
668
|
+
if (
|
|
669
|
+
this.deviceId ===
|
|
670
|
+
this.storage.getPersistedData<string>(CoreApp.deviceIdField)
|
|
671
|
+
) {
|
|
672
|
+
this.storage.clear(this.persistedFields, true);
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
return false;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// Restore
|
|
680
|
+
this.storage.copyFrom(this.persistedFields, true);
|
|
681
|
+
|
|
682
|
+
return true;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* Persist settings to source when application exit
|
|
687
|
+
*/
|
|
688
|
+
persist() {
|
|
689
|
+
if (!this.authorized) return;
|
|
690
|
+
this.storage.copyTo(this.persistedFields);
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* Setup Api
|
|
695
|
+
* @param api Api
|
|
696
|
+
*/
|
|
633
697
|
protected setApi(api: IApi) {
|
|
634
698
|
// onRequest, show loading or not, rewrite the property to override default action
|
|
635
699
|
api.onRequest = (data) => {
|
|
@@ -679,20 +743,9 @@ export abstract class CoreApp<
|
|
|
679
743
|
*/
|
|
680
744
|
async initCall(callback?: (result: boolean) => void) {
|
|
681
745
|
// Passphrase exists?
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
);
|
|
686
|
-
if (passphraseEncrypted) {
|
|
687
|
-
const passphraseDecrypted = this.decrypt(
|
|
688
|
-
passphraseEncrypted,
|
|
689
|
-
this.name
|
|
690
|
-
);
|
|
691
|
-
if (passphraseDecrypted != null) {
|
|
692
|
-
this.passphrase = passphraseDecrypted;
|
|
693
|
-
if (callback) callback(true);
|
|
694
|
-
return;
|
|
695
|
-
}
|
|
746
|
+
if (this.passphrase) {
|
|
747
|
+
if (callback) callback(true);
|
|
748
|
+
return;
|
|
696
749
|
}
|
|
697
750
|
|
|
698
751
|
// Serverside encrypted device id
|
|
@@ -884,7 +937,7 @@ export abstract class CoreApp<
|
|
|
884
937
|
return;
|
|
885
938
|
|
|
886
939
|
// Save the id to local storage
|
|
887
|
-
this.storage.
|
|
940
|
+
this.storage.setPersistedData(DomUtils.CountryField, regionId);
|
|
888
941
|
|
|
889
942
|
// Set the currency and culture
|
|
890
943
|
this._currency = regionItem.currency;
|
|
@@ -906,7 +959,7 @@ export abstract class CoreApp<
|
|
|
906
959
|
if (this._culture === name) return;
|
|
907
960
|
|
|
908
961
|
// Save the cultrue to local storage
|
|
909
|
-
this.storage.
|
|
962
|
+
this.storage.setPersistedData(DomUtils.CultureField, name);
|
|
910
963
|
|
|
911
964
|
// Change the API's Content-Language header
|
|
912
965
|
// .net 5 API, UseRequestLocalization, RequestCultureProviders, ContentLanguageHeaderRequestCultureProvider
|
|
@@ -933,12 +986,8 @@ export abstract class CoreApp<
|
|
|
933
986
|
* Clear cache data
|
|
934
987
|
*/
|
|
935
988
|
clearCacheData() {
|
|
936
|
-
this.
|
|
937
|
-
|
|
938
|
-
this.storage.setData(CoreApp.deviceIdField, undefined);
|
|
989
|
+
this.clearCacheToken();
|
|
939
990
|
this.storage.setData(CoreApp.devicePassphraseField, undefined);
|
|
940
|
-
|
|
941
|
-
this.storage.setData(CoreApp.headerTokenField, undefined);
|
|
942
991
|
}
|
|
943
992
|
|
|
944
993
|
/**
|
|
@@ -946,7 +995,7 @@ export abstract class CoreApp<
|
|
|
946
995
|
*/
|
|
947
996
|
clearCacheToken() {
|
|
948
997
|
this.cachedRefreshToken = undefined;
|
|
949
|
-
this.storage.
|
|
998
|
+
this.storage.setPersistedData(CoreApp.headerTokenField, undefined);
|
|
950
999
|
}
|
|
951
1000
|
|
|
952
1001
|
/**
|