@etsoo/appscript 1.1.98 → 1.2.2
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 +50 -19
- package/lib/mjs/app/CoreApp.d.ts +20 -0
- package/lib/mjs/app/CoreApp.js +50 -19
- package/package.json +2 -2
- package/src/app/CoreApp.ts +65 -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,44 @@ 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
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// Restore
|
|
138
|
+
this.storage.copy(this.persistedFields, true);
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Persist settings to source when application exit
|
|
143
|
+
*/
|
|
144
|
+
persist() {
|
|
145
|
+
this.persistedFields.forEach((field) => {
|
|
146
|
+
this.storage.setPersistedData(field, this.storage.getData(field));
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Setup Api
|
|
151
|
+
* @param api Api
|
|
152
|
+
*/
|
|
114
153
|
setApi(api) {
|
|
115
154
|
// onRequest, show loading or not, rewrite the property to override default action
|
|
116
155
|
api.onRequest = (data) => {
|
|
@@ -157,16 +196,10 @@ class CoreApp {
|
|
|
157
196
|
async initCall(callback) {
|
|
158
197
|
var _a;
|
|
159
198
|
// Passphrase exists?
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (passphraseDecrypted != null) {
|
|
165
|
-
this.passphrase = passphraseDecrypted;
|
|
166
|
-
if (callback)
|
|
167
|
-
callback(true);
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
199
|
+
if (this.passphrase) {
|
|
200
|
+
if (callback)
|
|
201
|
+
callback(true);
|
|
202
|
+
return;
|
|
170
203
|
}
|
|
171
204
|
// Serverside encrypted device id
|
|
172
205
|
const identifier = this.storage.getData(CoreApp.serversideDeviceIdField);
|
|
@@ -322,7 +355,7 @@ class CoreApp {
|
|
|
322
355
|
if (regionItem == null || !this.settings.regions.includes(regionId))
|
|
323
356
|
return;
|
|
324
357
|
// Save the id to local storage
|
|
325
|
-
this.storage.
|
|
358
|
+
this.storage.setPersistedData(shared_1.DomUtils.CountryField, regionId);
|
|
326
359
|
// Set the currency and culture
|
|
327
360
|
this._currency = regionItem.currency;
|
|
328
361
|
this._region = regionId;
|
|
@@ -340,7 +373,7 @@ class CoreApp {
|
|
|
340
373
|
if (this._culture === name)
|
|
341
374
|
return;
|
|
342
375
|
// Save the cultrue to local storage
|
|
343
|
-
this.storage.
|
|
376
|
+
this.storage.setPersistedData(shared_1.DomUtils.CultureField, name);
|
|
344
377
|
// Change the API's Content-Language header
|
|
345
378
|
// .net 5 API, UseRequestLocalization, RequestCultureProviders, ContentLanguageHeaderRequestCultureProvider
|
|
346
379
|
this.api.setContentLanguage(name);
|
|
@@ -359,17 +392,15 @@ class CoreApp {
|
|
|
359
392
|
* Clear cache data
|
|
360
393
|
*/
|
|
361
394
|
clearCacheData() {
|
|
362
|
-
this.
|
|
363
|
-
this.storage.setData(CoreApp.deviceIdField, undefined);
|
|
395
|
+
this.clearCacheToken();
|
|
364
396
|
this.storage.setData(CoreApp.devicePassphraseField, undefined);
|
|
365
|
-
this.storage.setData(CoreApp.headerTokenField, undefined);
|
|
366
397
|
}
|
|
367
398
|
/**
|
|
368
399
|
* Clear cached token
|
|
369
400
|
*/
|
|
370
401
|
clearCacheToken() {
|
|
371
402
|
this.cachedRefreshToken = undefined;
|
|
372
|
-
this.storage.
|
|
403
|
+
this.storage.setPersistedData(CoreApp.headerTokenField, undefined);
|
|
373
404
|
}
|
|
374
405
|
/**
|
|
375
406
|
* 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,44 @@ 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
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// Restore
|
|
135
|
+
this.storage.copy(this.persistedFields, true);
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Persist settings to source when application exit
|
|
140
|
+
*/
|
|
141
|
+
persist() {
|
|
142
|
+
this.persistedFields.forEach((field) => {
|
|
143
|
+
this.storage.setPersistedData(field, this.storage.getData(field));
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Setup Api
|
|
148
|
+
* @param api Api
|
|
149
|
+
*/
|
|
111
150
|
setApi(api) {
|
|
112
151
|
// onRequest, show loading or not, rewrite the property to override default action
|
|
113
152
|
api.onRequest = (data) => {
|
|
@@ -154,16 +193,10 @@ export class CoreApp {
|
|
|
154
193
|
async initCall(callback) {
|
|
155
194
|
var _a;
|
|
156
195
|
// Passphrase exists?
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
if (passphraseDecrypted != null) {
|
|
162
|
-
this.passphrase = passphraseDecrypted;
|
|
163
|
-
if (callback)
|
|
164
|
-
callback(true);
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
196
|
+
if (this.passphrase) {
|
|
197
|
+
if (callback)
|
|
198
|
+
callback(true);
|
|
199
|
+
return;
|
|
167
200
|
}
|
|
168
201
|
// Serverside encrypted device id
|
|
169
202
|
const identifier = this.storage.getData(CoreApp.serversideDeviceIdField);
|
|
@@ -319,7 +352,7 @@ export class CoreApp {
|
|
|
319
352
|
if (regionItem == null || !this.settings.regions.includes(regionId))
|
|
320
353
|
return;
|
|
321
354
|
// Save the id to local storage
|
|
322
|
-
this.storage.
|
|
355
|
+
this.storage.setPersistedData(DomUtils.CountryField, regionId);
|
|
323
356
|
// Set the currency and culture
|
|
324
357
|
this._currency = regionItem.currency;
|
|
325
358
|
this._region = regionId;
|
|
@@ -337,7 +370,7 @@ export class CoreApp {
|
|
|
337
370
|
if (this._culture === name)
|
|
338
371
|
return;
|
|
339
372
|
// Save the cultrue to local storage
|
|
340
|
-
this.storage.
|
|
373
|
+
this.storage.setPersistedData(DomUtils.CultureField, name);
|
|
341
374
|
// Change the API's Content-Language header
|
|
342
375
|
// .net 5 API, UseRequestLocalization, RequestCultureProviders, ContentLanguageHeaderRequestCultureProvider
|
|
343
376
|
this.api.setContentLanguage(name);
|
|
@@ -356,17 +389,15 @@ export class CoreApp {
|
|
|
356
389
|
* Clear cache data
|
|
357
390
|
*/
|
|
358
391
|
clearCacheData() {
|
|
359
|
-
this.
|
|
360
|
-
this.storage.setData(CoreApp.deviceIdField, undefined);
|
|
392
|
+
this.clearCacheToken();
|
|
361
393
|
this.storage.setData(CoreApp.devicePassphraseField, undefined);
|
|
362
|
-
this.storage.setData(CoreApp.headerTokenField, undefined);
|
|
363
394
|
}
|
|
364
395
|
/**
|
|
365
396
|
* Clear cached token
|
|
366
397
|
*/
|
|
367
398
|
clearCacheToken() {
|
|
368
399
|
this.cachedRefreshToken = undefined;
|
|
369
|
-
this.storage.
|
|
400
|
+
this.storage.setPersistedData(CoreApp.headerTokenField, undefined);
|
|
370
401
|
}
|
|
371
402
|
/**
|
|
372
403
|
* Decrypt message
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/appscript",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.2",
|
|
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.93",
|
|
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,43 @@ 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
|
+
return false;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
// Restore
|
|
671
|
+
this.storage.copy(this.persistedFields, true);
|
|
672
|
+
|
|
673
|
+
return true;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Persist settings to source when application exit
|
|
678
|
+
*/
|
|
679
|
+
persist() {
|
|
680
|
+
this.persistedFields.forEach((field) => {
|
|
681
|
+
this.storage.setPersistedData(field, this.storage.getData(field));
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* Setup Api
|
|
687
|
+
* @param api Api
|
|
688
|
+
*/
|
|
633
689
|
protected setApi(api: IApi) {
|
|
634
690
|
// onRequest, show loading or not, rewrite the property to override default action
|
|
635
691
|
api.onRequest = (data) => {
|
|
@@ -679,20 +735,9 @@ export abstract class CoreApp<
|
|
|
679
735
|
*/
|
|
680
736
|
async initCall(callback?: (result: boolean) => void) {
|
|
681
737
|
// 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
|
-
}
|
|
738
|
+
if (this.passphrase) {
|
|
739
|
+
if (callback) callback(true);
|
|
740
|
+
return;
|
|
696
741
|
}
|
|
697
742
|
|
|
698
743
|
// Serverside encrypted device id
|
|
@@ -884,7 +929,7 @@ export abstract class CoreApp<
|
|
|
884
929
|
return;
|
|
885
930
|
|
|
886
931
|
// Save the id to local storage
|
|
887
|
-
this.storage.
|
|
932
|
+
this.storage.setPersistedData(DomUtils.CountryField, regionId);
|
|
888
933
|
|
|
889
934
|
// Set the currency and culture
|
|
890
935
|
this._currency = regionItem.currency;
|
|
@@ -906,7 +951,7 @@ export abstract class CoreApp<
|
|
|
906
951
|
if (this._culture === name) return;
|
|
907
952
|
|
|
908
953
|
// Save the cultrue to local storage
|
|
909
|
-
this.storage.
|
|
954
|
+
this.storage.setPersistedData(DomUtils.CultureField, name);
|
|
910
955
|
|
|
911
956
|
// Change the API's Content-Language header
|
|
912
957
|
// .net 5 API, UseRequestLocalization, RequestCultureProviders, ContentLanguageHeaderRequestCultureProvider
|
|
@@ -933,12 +978,8 @@ export abstract class CoreApp<
|
|
|
933
978
|
* Clear cache data
|
|
934
979
|
*/
|
|
935
980
|
clearCacheData() {
|
|
936
|
-
this.
|
|
937
|
-
|
|
938
|
-
this.storage.setData(CoreApp.deviceIdField, undefined);
|
|
981
|
+
this.clearCacheToken();
|
|
939
982
|
this.storage.setData(CoreApp.devicePassphraseField, undefined);
|
|
940
|
-
|
|
941
|
-
this.storage.setData(CoreApp.headerTokenField, undefined);
|
|
942
983
|
}
|
|
943
984
|
|
|
944
985
|
/**
|
|
@@ -946,7 +987,7 @@ export abstract class CoreApp<
|
|
|
946
987
|
*/
|
|
947
988
|
clearCacheToken() {
|
|
948
989
|
this.cachedRefreshToken = undefined;
|
|
949
|
-
this.storage.
|
|
990
|
+
this.storage.setPersistedData(CoreApp.headerTokenField, undefined);
|
|
950
991
|
}
|
|
951
992
|
|
|
952
993
|
/**
|