适配settingsData去常驻

Signed-off-by: tangzhigang1 <tangzhigang7@huawei.com>
This commit is contained in:
tangzhigang1
2022-11-04 16:34:58 +08:00
parent f4b100a2a5
commit 0c876e8c98
4 changed files with 5 additions and 3 deletions
+2 -1
View File
@@ -78,7 +78,8 @@ class TimeManager {
private async initTimeFormat(context: any): Promise<void> {
Log.showDebug(TAG, "initTimeFormat");
this.mSettingsHelper = await dataShare.createDataShareHelper(context, Constants.URI_VAR);
settings.getValueSync(context, TIME_FORMAT_KEY, "24");
this.mSettingsHelper = await dataShare.createDataShareHelper(context, Constants.getUriSync(Constants.KEY_TIME_FORMAT));
const handleTimeFormatChange = () => {
if (!this.mSettingsHelper) {
@@ -74,6 +74,7 @@ export class brightnessManager {
let value = parseInt(callback.value);
Log.showInfo(TAG, `setValue ${value}`);
mBrightnessValue.set(value);
settings.setValueSync(this.context, Constants.KEY_BRIGHTNESS_STATUS, JSON.stringify(value));
Log.showInfo(TAG, `setValue ${this.context}`);
Brightness.setValue(callback.value);
}
@@ -62,7 +62,7 @@ export default class NavigationBarViewModel {
private async initHelper(callback: () => void): Promise<void> {
this.urivar = Constants.getUriSync(Constants.KEY_NAVIGATIONBAR_STATUS);
this.helper = await dataShare.createDataShareHelper(AbilityManager.getContext(AbilityManager.ABILITY_NAME_NAVIGATION_BAR), Constants.URI_VAR);
this.helper = await dataShare.createDataShareHelper(AbilityManager.getContext(AbilityManager.ABILITY_NAME_NAVIGATION_BAR), this.urivar);
Log.showInfo(TAG, 'initHelper, helper: ' + this.helper + ', uri: ' + this.urivar);
this.helper.on('dataChange', this.urivar, () => {
Log.showInfo(TAG, 'onDataChange.');
@@ -132,8 +132,8 @@ struct Index {
}
private async initHelper(dropdownRect, navigationBarRect): Promise<void> {
this.helper = await dataShare.createDataShareHelper(AbilityManager.getContext(AbilityManager.ABILITY_NAME_DROPDOWN_PANEL), Constants.URI_VAR);
this.urivar = Constants.getUriSync(Constants.KEY_NAVIGATIONBAR_STATUS);
this.helper = await dataShare.createDataShareHelper(AbilityManager.getContext(AbilityManager.ABILITY_NAME_DROPDOWN_PANEL), this.urivar);
Log.showDebug(TAG, `initHelper ${this.helper}, uri: ${JSON.stringify(this.urivar)}`);
this.helper?.on("dataChange", this.urivar, () => {
this.resizeDropdownPanelAndNavigationBar(dropdownRect, navigationBarRect);