zhangbo1_wd

切环境,清除首页缓存

... ... @@ -89,6 +89,15 @@ export class KVStoreHelper {
}
}
deleteAll() {
this.kvManager?.deleteKVStore(AppUtils.getPackageName(getContext()), KVStoreHelper._default_store_id)
.then(() => {
Logger.error(TAG, 'deleteAll success')
}).catch((e: object) => {
Logger.error(TAG, 'deleteAll error: ' + JSON.stringify(e))
})
}
private checkStoreCreated() {
if (!this.kvManager) {
this.createKVManager()
... ...
import { SPHelper } from 'wdKit/Index';
import { KVStoreHelper, SPHelper } from 'wdKit/Index';
import { HostEnum, HostManager, HttpUrlUtils } from 'wdNetwork/Index';
@CustomDialog
... ... @@ -86,10 +86,15 @@ export struct EnvironmentCustomDialog {
Button('确认')
.margin({ top: 20 })
.onClick(() => {
// HttpUrlUtils.hostUrl = this.currentEnvironment
SPHelper.default.saveSync('hostUrl', this.currentEnvironment);
this.controller.close()
this.confirm()
new Promise<void>(() => {
// HttpUrlUtils.hostUrl = this.currentEnvironment
SPHelper.default.saveSync('hostUrl', this.currentEnvironment);
// 清首页缓存
KVStoreHelper.default.deleteAll()
// TODO 清sp相关
this.controller.close()
this.confirm()
})
})
}.height(261).backgroundColor(Color.White).borderRadius(6).width('74%')
... ...