Showing
2 changed files
with
15 additions
and
1 deletions
| @@ -89,6 +89,15 @@ export class KVStoreHelper { | @@ -89,6 +89,15 @@ export class KVStoreHelper { | ||
| 89 | } | 89 | } |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | + deleteAll() { | ||
| 93 | + this.kvManager?.deleteKVStore(AppUtils.getPackageName(getContext()), KVStoreHelper._default_store_id) | ||
| 94 | + .then(() => { | ||
| 95 | + Logger.error(TAG, 'deleteAll success') | ||
| 96 | + }).catch((e: object) => { | ||
| 97 | + Logger.error(TAG, 'deleteAll error: ' + JSON.stringify(e)) | ||
| 98 | + }) | ||
| 99 | + } | ||
| 100 | + | ||
| 92 | private checkStoreCreated() { | 101 | private checkStoreCreated() { |
| 93 | if (!this.kvManager) { | 102 | if (!this.kvManager) { |
| 94 | this.createKVManager() | 103 | this.createKVManager() |
| 1 | -import { SPHelper } from 'wdKit/Index'; | 1 | +import { KVStoreHelper, SPHelper } from 'wdKit/Index'; |
| 2 | import { HostEnum, HostManager, HttpUrlUtils } from 'wdNetwork/Index'; | 2 | import { HostEnum, HostManager, HttpUrlUtils } from 'wdNetwork/Index'; |
| 3 | 3 | ||
| 4 | @CustomDialog | 4 | @CustomDialog |
| @@ -86,11 +86,16 @@ export struct EnvironmentCustomDialog { | @@ -86,11 +86,16 @@ export struct EnvironmentCustomDialog { | ||
| 86 | Button('确认') | 86 | Button('确认') |
| 87 | .margin({ top: 20 }) | 87 | .margin({ top: 20 }) |
| 88 | .onClick(() => { | 88 | .onClick(() => { |
| 89 | + new Promise<void>(() => { | ||
| 89 | // HttpUrlUtils.hostUrl = this.currentEnvironment | 90 | // HttpUrlUtils.hostUrl = this.currentEnvironment |
| 90 | SPHelper.default.saveSync('hostUrl', this.currentEnvironment); | 91 | SPHelper.default.saveSync('hostUrl', this.currentEnvironment); |
| 92 | + // 清首页缓存 | ||
| 93 | + KVStoreHelper.default.deleteAll() | ||
| 94 | + // TODO 清sp相关 | ||
| 91 | this.controller.close() | 95 | this.controller.close() |
| 92 | this.confirm() | 96 | this.confirm() |
| 93 | }) | 97 | }) |
| 98 | + }) | ||
| 94 | }.height(261).backgroundColor(Color.White).borderRadius(6).width('74%') | 99 | }.height(261).backgroundColor(Color.White).borderRadius(6).width('74%') |
| 95 | 100 | ||
| 96 | } | 101 | } |
-
Please register or login to post a comment