diff --git a/common/utils/src/main/ets/default/baseUtil/ConfigData.ts b/common/utils/src/main/ets/default/baseUtil/ConfigData.ts index 140ad54a..42500875 100644 --- a/common/utils/src/main/ets/default/baseUtil/ConfigData.ts +++ b/common/utils/src/main/ets/default/baseUtil/ConfigData.ts @@ -73,7 +73,6 @@ export class ConfigData { TIME_FORMAT_24 = "24"; TIME_FORMAT_12 = "12"; - TIME_FORMAT_URI = "dataability:///com.ohos.settingsdata.DataAbility"; TIME_FORMAT_KEY = settings.date.TIME_FORMAT; SETTINGSDATA_DEVICE_NAME = settings.general.DEVICE_NAME; SETTINGSDATA_BRIGHTNESS = settings.display.SCREEN_BRIGHTNESS_STATUS; diff --git a/napi/settings/napi_settings.cpp b/napi/settings/napi_settings.cpp index f7a54094..13bdebdc 100644 --- a/napi/settings/napi_settings.cpp +++ b/napi/settings/napi_settings.cpp @@ -452,7 +452,6 @@ napi_value napi_get_value_sync(napi_env env, napi_callback_info info) // Check the value type of the arguments napi_valuetype valueType; NAPI_CALL(env, napi_typeof(env, args[PARAM0], &valueType)); - NAPI_ASSERT(env, valueType == napi_object, "Wrong argument[0] type. Object expected."); NAPI_CALL(env, napi_typeof(env, args[PARAM1], &valueType)); NAPI_ASSERT(env, valueType == napi_string, "Wrong argument[1] type. String expected."); NAPI_CALL(env, napi_typeof(env, args[PARAM2], &valueType)); @@ -560,7 +559,6 @@ napi_value napi_get_value(napi_env env, napi_callback_info info) return napi_get_value_ext(env, info, stageMode); } - NAPI_ASSERT(env, valueType == napi_object, "Wrong argument[0], type. Object expected"); NAPI_CALL(env, napi_typeof(env, args[PARAM1], &valueType)); NAPI_ASSERT(env, valueType == napi_string, "Wrong argument[1], type. String expected"); @@ -816,7 +814,6 @@ napi_value napi_set_value_sync(napi_env env, napi_callback_info info) // Check the value type of the arguments napi_valuetype valueType; NAPI_CALL(env, napi_typeof(env, args[PARAM0], &valueType)); - NAPI_ASSERT(env, valueType == napi_object, "Wrong argument[0] type. Object expected."); NAPI_CALL(env, napi_typeof(env, args[PARAM1], &valueType)); NAPI_ASSERT(env, valueType == napi_string, "Wrong argument[1] type. String expected."); NAPI_CALL(env, napi_typeof(env, args[PARAM2], &valueType)); @@ -1081,7 +1078,6 @@ napi_value napi_set_value(napi_env env, napi_callback_info info) return napi_set_value_ext(env, info, stageMode); } - NAPI_ASSERT(env, valueType == napi_object, "Wrong argument[0], type. Object expected"); NAPI_CALL(env, napi_typeof(env, args[PARAM1], &valueType)); NAPI_ASSERT(env, valueType == napi_string, "Wrong argument[1], type. String expected"); NAPI_CALL(env, napi_typeof(env, args[PARAM2], &valueType)); diff --git a/product/phone/src/main/ets/model/dateAndTimeImpl/DateAndTimeModel.ts b/product/phone/src/main/ets/model/dateAndTimeImpl/DateAndTimeModel.ts index b80a69f4..3ea232eb 100644 --- a/product/phone/src/main/ets/model/dateAndTimeImpl/DateAndTimeModel.ts +++ b/product/phone/src/main/ets/model/dateAndTimeImpl/DateAndTimeModel.ts @@ -29,12 +29,11 @@ import i18n from '@ohos.i18n'; export class DateAndTimeModel extends BaseModel { private timeFormat = ''; private dataShareHelper; - private readonly uriShare: string = 'datashare:///com.ohos.settingsdata.DataAbility'; private readonly listenUri = 'datashare:///com.ohos.settingsdata/entry/settingsdata/SETTINGSDATA?Proxy=true&key=' + ConfigData.TIME_FORMAT_KEY; constructor() { super(); - data_dataShare.createDataShareHelper(globalThis.settingsAbilityContext, this.uriShare) + data_dataShare.createDataShareHelper(globalThis.settingsAbilityContext, this.listenUri) .then((dataHelper) => { this.dataShareHelper = dataHelper; LogUtil.info("createDataShareHelper success"); diff --git a/product/phone/src/main/ets/model/displayAndBrightnessImpl/brightness/BrightnessSettingModel.ts b/product/phone/src/main/ets/model/displayAndBrightnessImpl/brightness/BrightnessSettingModel.ts index 9ca87b1f..cfc80a21 100644 --- a/product/phone/src/main/ets/model/displayAndBrightnessImpl/brightness/BrightnessSettingModel.ts +++ b/product/phone/src/main/ets/model/displayAndBrightnessImpl/brightness/BrightnessSettingModel.ts @@ -34,12 +34,11 @@ export class BrightnessSettingModel extends BaseModel{ private brightness:number = 5; private defaultBrightnessStr = this.getDefaultBrightness().toString(); private TAG = `${ConfigData.TAG} BrightnessSettingModel `; - private readonly uriShare: string = 'datashare:///com.ohos.settingsdata.DataAbility'; private readonly listenUri = 'datashare:///com.ohos.settingsdata/entry/settingsdata/SETTINGSDATA?Proxy=true&key=' + ConfigData.SETTINGSDATA_BRIGHTNESS; constructor() { super(); - data_dataShare.createDataShareHelper(globalThis.settingsAbilityContext, this.uriShare) + data_dataShare.createDataShareHelper(globalThis.settingsAbilityContext, this.listenUri) .then((dataHelper) => { this.dataShareHelper = dataHelper; LogUtil.info("createDataShareHelper success"); @@ -118,6 +117,7 @@ export class BrightnessSettingModel extends BaseModel{ this.brightness = brightness; mBrightnessValue.set(brightness); Brightness.setValue(brightness); + this.setSettingsData(brightness); return; }