diff --git a/entry/hvigorfile.ts b/entry/hvigorfile.ts index c6edcd9..5e6218b 100644 --- a/entry/hvigorfile.ts +++ b/entry/hvigorfile.ts @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import { hapTasks } from '@ohos/hvigor-ohos-plugin'; export default { diff --git a/entry/oh-package.json5 b/entry/oh-package.json5 index 225946c..961d4dd 100644 --- a/entry/oh-package.json5 +++ b/entry/oh-package.json5 @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + { "license": "", "devDependencies": {}, diff --git a/entry/src/main/ets/common/baseUtile/ConfigData.ets b/entry/src/main/ets/common/baseUtile/ConfigData.ets deleted file mode 100644 index 8e83fc3..0000000 --- a/entry/src/main/ets/common/baseUtile/ConfigData.ets +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import settings from '@ohos.settings'; - -export class ConfigData { - FILE_URI = '/data/accounts/account_0/applications/com.ohos.settings' - + '/com.ohos.settings/assets/phone/resources/rawfile/'; - PREFERENCES_PATH = '/data/accounts/account_0/appdata/com.ohos.settings/sharedPreference/SettingPreferences'; - BRIGHTNESS_SAVE_VALUE_KEY = 'BrightnessSaveValue'; - SENT_EVENT_BROADCAST_BRIGHTNESS_VALUE = 'BRIGHTNESS_VALUE'; - SENT_EVENT_BROADCAST_VOLUME_VALUE = 'VOLUME_VALUE'; - SENT_EVENT_WIFI_CONNECT_NAME = 'WIFI_CONNECT_NAME'; - SENT_EVENT_AUDIO_RINGER_MODE = 'AUDIO_RINGER_MODE'; - SENT_EVENT_AUDIO_VOLUME_VALUE = 'AUDIO_VOLUME_VALUE'; - BRIGHTNESS_DEFAULT_VALUE = 50; - DEFAULT_BUNDLE_NAME = 'com.ohos.settings'; - DATE_AND_TIME_YEAR = 'DATE_AND_TIME_YEAR'; - DATE_AND_TIME_MONTH = 'DATE_AND_TIME_MONTH'; - DATE_AND_TIME_DAY = 'DATE_AND_TIME_DAY'; - TAG = 'Settings '; - // page request - PAGE_REQUEST_CODE_KEY = 'pageRequestCode'; - PAGE_RESULT_KEY = 'pageResult'; - PAGE_RESULT_OK = -1; - PAGE_RESULT_NG = 0; - // password request code - PAGE_REQUEST_CODE_PASSWORD_CREATE = 20001; - PAGE_REQUEST_CODE_PASSWORD_CHANGE = 20003; - PAGE_REQUEST_CODE_PASSWORD_DISABLE = 20004; - WH_100_100 = '100%'; - WH_25_100 = '25%'; - WH_30_100 = '30%'; - WH_33_100 = '33%'; - WH_35_100 = '35%'; - WH_40_100 = '40%'; - WH_45_100 = '45%'; - WH_50_100 = '50%'; - WH_55_100 = '55%'; - WH_83_100 = '83%'; - WH_90_100 = '90%'; - GRID_CONTAINER_GUTTER_24 = 24; - GRID_CONTAINER_MARGIN_24 = 24; - LAYOUT_WEIGHT_1 = 1; - value_20 = 20; - font_20 = 20; - MAX_LINES_1 = 1; - MAX_LINES_2 = 2; - MAX_LINES_3 = 3; - DURATION_TIME = 200; - FUNCTION_TYPE_HDC = 4; - TIME_FORMAT_24 = "24"; - TIME_FORMAT_12 = "12"; - TIME_FORMAT_KEY = settings.date.TIME_FORMAT; - SETTINGSDATA_DEVICE_NAME = settings.general.DEVICE_NAME; - SETTINGSDATA_BRIGHTNESS = settings.display.SCREEN_BRIGHTNESS_STATUS; - SLIDER_CHANG_MODE_MOVING = 1; - SLIDER_CHANG_MODE_END = 2; - //Language And Region - ADDLANGUAGES = 'addedLanguages'; - CURRENTREGION = 'currentRegion'; - //Key of StoragePath - STORAGEPATHKEY = 'storagePath'; - //StartAbility - FACEAUTH_BUNDLE_NAME = 'com.ohos.settings.faceauth'; - FACEAUTH_ABILITY_NAME = 'com.ohos.settings.faceauth.enrollmentstartview'; - PERMISSION_MANAGER_BUNDLE_NAME = 'com.ohos.permissionmanager'; - PERMISSION_MANAGER_ABILITY_NAME = 'com.ohos.permissionmanager.MainAbility'; - MOBILE_DATA_BUNDLE_NAME = 'com.ohos.callui'; - MOBILE_DATA_ABILITY_NAME = 'com.ohos.mobiledatasettings.MainAbility'; - softWareUpDatesBundleName = 'com.ohos.updateapp'; - softWareUpDatesAbilityName = 'com.ohos.updateapp.MainAbility'; - SECURITY_BUNDLE_NAME = 'com.ohos.certmanager'; - SECURITY_ABILITY_NAME = 'MainAbility'; - DEVICE_NAME = 'OpenHarmony 2.0 Canary'; -} - -let configData = new ConfigData(); - -export default configData as ConfigData; \ No newline at end of file diff --git a/entry/src/main/ets/common/components/headComponent.ets b/entry/src/main/ets/common/components/headComponent.ets index 2fc80f7..dde9c1c 100644 --- a/entry/src/main/ets/common/components/headComponent.ets +++ b/entry/src/main/ets/common/components/headComponent.ets @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import Router from '@system.router'; import ComponentConfig from './ComponentConfig'; import router from '@ohos.router'; diff --git a/entry/src/main/ets/main/auto_menu/AutoMenuViewModel.ets b/entry/src/main/ets/main/auto_menu/AutoMenuViewModel.ets index a832031..3d60e12 100644 --- a/entry/src/main/ets/main/auto_menu/AutoMenuViewModel.ets +++ b/entry/src/main/ets/main/auto_menu/AutoMenuViewModel.ets @@ -57,7 +57,7 @@ export class AutoMenuViewModel extends BaseViewModel { @@ -28,49 +29,49 @@ export class LocationService { if (this.mIsStart) { return; } - Logger.info(ConfigData.TAG, 'start location service') + Logger.info(TAG, 'start location service') this.mIsStart = true; geolocation.on('locationEnabledChange', (isChanged: boolean) => { - Logger.info(ConfigData.TAG, `start location service isChanged: ${JSON.stringify(isChanged)}`) + Logger.info(TAG, `start location service isChanged: ${JSON.stringify(isChanged)}`) this.getServiceState(); }); } registerListener(listener: ListenerBean) { - Logger.info(ConfigData.TAG, `register locations listener : ${listener}`) + Logger.info(TAG, `register locations listener : ${listener}`) this.mListener = listener; } async getServiceState(): Promise { - Logger.info(ConfigData.TAG, 'get location state'); + Logger.info(TAG, 'get location state'); try { let state: boolean = await geolocation.isLocationEnabled(); - Logger.info(ConfigData.TAG, `get location state, data: ${JSON.stringify(state)}`); + Logger.info(TAG, `get location state, data: ${JSON.stringify(state)}`); this.mListener?.updateServiceState(state); } catch (error) { - Logger.info(ConfigData.TAG, `get location state, data: ${error}`); + Logger.info(TAG, `get location state, data: ${error}`); } } enableLocation() { - Logger.info(ConfigData.TAG, 'enable location'); + Logger.info(TAG, 'enable location'); try { geolocation.enableLocation() - .then((res): void => Logger.info(ConfigData.TAG, `enable location, result: ${JSON.stringify(res)}`)) - .catch((error: BusinessError): void => Logger.info(ConfigData.TAG, `enable location, result: ${error}`)); + .then((res): void => Logger.info(TAG, `enable location, result: ${JSON.stringify(res)}`)) + .catch((error: BusinessError): void => Logger.info(TAG, `enable location, result: ${error}`)); } catch (err) { - Logger.info(ConfigData.TAG, `enable location, result: ${err}`); + Logger.info(TAG, `enable location, result: ${err}`); } } disableLocation() { - Logger.info(ConfigData.TAG, 'disable location'); + Logger.info(TAG, 'disable location'); try { geolocation.disableLocation(); } catch (err) { - Logger.info(ConfigData.TAG, `disenable location, result: ${err}`); + Logger.info(TAG, `disenable location, result: ${err}`); } } } diff --git a/entry/src/main/ets/model/locationServicesImpl/LocationViewModel.ets b/entry/src/main/ets/model/locationServicesImpl/LocationViewModel.ets index 1107069..ce34a6d 100644 --- a/entry/src/main/ets/model/locationServicesImpl/LocationViewModel.ets +++ b/entry/src/main/ets/model/locationServicesImpl/LocationViewModel.ets @@ -15,7 +15,8 @@ import LocationService from './LocationService'; import Logger from '../../common/utils/Logger'; -import ConfigData from '../../common/baseUtile/ConfigData'; + +const TAG:string = 'LocationViewModel' export const LocationServiceOpenStatusKey = "LocationServiceStatus"; @@ -26,7 +27,7 @@ export class LocationVM { if (this.mIsStart) { return; } - Logger.info(ConfigData.TAG, 'init location view model') + Logger.info(TAG, 'init location view model') this.mIsStart = true; LocationService.registerListener(this); LocationService.startService(); @@ -34,17 +35,17 @@ export class LocationVM { } updateServiceState(state: boolean) { - Logger.info(ConfigData.TAG, `update location service state, state: ${state} `) + Logger.info(TAG, `update location service state, state: ${state} `) AppStorage.setOrCreate(LocationServiceOpenStatusKey, state); } enableLocation() { - Logger.info(ConfigData.TAG, 'enable location') + Logger.info(TAG, 'enable location') LocationService.enableLocation(); } disableLocation() { - Logger.info(ConfigData.TAG, 'disable location') + Logger.info(TAG, 'disable location') LocationService.disableLocation(); } } diff --git a/entry/src/main/ets/pages/locationServices.ets b/entry/src/main/ets/pages/locationServices.ets index e84ea73..912be1a 100644 --- a/entry/src/main/ets/pages/locationServices.ets +++ b/entry/src/main/ets/pages/locationServices.ets @@ -15,11 +15,12 @@ import ViewModel from '../model/locationServicesImpl/LocationViewModel'; import Logger from '../common/utils/Logger'; -import ConfigData from '../common/baseUtile/ConfigData'; import HeadComponent from '../common/components/headComponent'; import HiSysEventUtil from '../common/utils/HiSysEventUtil'; import HiSysEventConstant from '../common/constants/HiSysEventConstant'; +const TAG:string = 'LocationServicesPage' + /** * LocationServices */ @@ -30,7 +31,7 @@ struct LocationServices { build() { Column() { - GridContainer({ gutter: ConfigData.GRID_CONTAINER_GUTTER_24, margin: ConfigData.GRID_CONTAINER_MARGIN_24 }) { + GridContainer({ gutter: 24, margin: 24}) { Column() { HeadComponent({ headName: $r('app.string.locationServicesTab'), isActive: true }); @@ -47,7 +48,7 @@ struct LocationServices { .height('20vp') .selectedColor('#007DFF') .onChange((isOn: boolean) => { - Logger.info(ConfigData.TAG, 'location service status is :' + this.locationServiceStatus); + Logger.info(TAG, 'location service status is :' + this.locationServiceStatus); if (isOn) { ViewModel.enableLocation(); HiSysEventUtil.reportLocationClick(HiSysEventConstant.BUNDLE_NAME, 1) @@ -70,20 +71,20 @@ struct LocationServices { lg: { span: 8, offset: 2 } }) } - .width(ConfigData.WH_100_100) - .height(ConfigData.WH_100_100) + .width('100%') + .height('100%') } .backgroundColor($r("sys.color.ohos_id_color_sub_background")) - .width(ConfigData.WH_100_100) - .height(ConfigData.WH_100_100) + .width('100%') + .height('100%') } aboutToAppear(): void { - Logger.info(ConfigData.TAG, 'location service about to appear'); + Logger.info(TAG, 'location service about to appear'); ViewModel.initViewModel(); } aboutToDisappear(): void { - Logger.info(ConfigData.TAG, 'location service about to disappear'); + Logger.info(TAG, 'location service about to disappear'); } } \ No newline at end of file diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index 0e96159..da5ec01 100644 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -1,3 +1,17 @@ +/** + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ { "module": { "name": "entry", diff --git a/entry/src/ohosTest/ets/test/Model.test.ets b/entry/src/ohosTest/ets/test/Model.test.ets index bacbfb2..86fe7eb 100644 --- a/entry/src/ohosTest/ets/test/Model.test.ets +++ b/entry/src/ohosTest/ets/test/Model.test.ets @@ -50,7 +50,7 @@ export default function ModelTest() { }) it('BundleInfoModelTest_01', 0, async () => { - let bundleName: string = 'com.ohos.security_privacy_center' + let bundleName: string = 'com.ohos.certmanager' await bundleManager.getApplicationInfo(bundleName, bundleManager.ApplicationFlag.GET_APPLICATION_INFO_DEFAULT) .then((data) => { BundleInfoModel.getAllBundleLabelAndIcon([data]).then((value) => { @@ -65,7 +65,7 @@ export default function ModelTest() { }) }) it('BundleInfoModelTest_03', 0, async () => { - let bundleName: string = 'com.ohos.security_privacy_center' + let bundleName: string = 'com.ohos.certmanager' await bundleManager.getApplicationInfo(bundleName, bundleManager.ApplicationFlag.GET_APPLICATION_INFO_DEFAULT) .then((info) => { let bundleInfo: BundleInfoBean = { @@ -95,7 +95,7 @@ export default function ModelTest() { }) }) it('BundleInfoModelTest_05', 0, async () => { - let bundleName: string = 'com.ohos.security_privacy_center' + let bundleName: string = 'com.ohos.certmanager' await bundleManager.getApplicationInfo(bundleName, bundleManager.ApplicationFlag.GET_APPLICATION_INFO_DEFAULT) .then((info) => { let bundleInfo: BundleInfoBean = { diff --git a/entry/src/ohosTest/ets/test/bean/model/locationServicesImpl/LocationService.test.ets b/entry/src/ohosTest/ets/test/bean/model/locationServicesImpl/LocationService.test.ets index 39501d4..1b62c14 100644 --- a/entry/src/ohosTest/ets/test/bean/model/locationServicesImpl/LocationService.test.ets +++ b/entry/src/ohosTest/ets/test/bean/model/locationServicesImpl/LocationService.test.ets @@ -15,8 +15,6 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' import LocationService from '../../../../../../main/ets/model/locationServicesImpl/LocationService'; -import geolocation from '@ohos.geoLocationManager'; -import ConfigData from '../../../../../../main/ets/common/baseUtile/ConfigData'; import { ListenerBean } from '../../../../../../main/ets/model/locationServicesImpl/ListenerBean'; export default function LocationServiceTest() { diff --git a/entry/src/ohosTest/ets/test/bean/model/locationServicesImpl/LocationViewModel.test.ets b/entry/src/ohosTest/ets/test/bean/model/locationServicesImpl/LocationViewModel.test.ets index 5141741..e39833e 100644 --- a/entry/src/ohosTest/ets/test/bean/model/locationServicesImpl/LocationViewModel.test.ets +++ b/entry/src/ohosTest/ets/test/bean/model/locationServicesImpl/LocationViewModel.test.ets @@ -16,7 +16,6 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' import LocationService from '../../../../../../main/ets/model/locationServicesImpl/LocationService'; import LocationViewModel from '../../../../../../main/ets/model/locationServicesImpl/LocationViewModel'; -import ConfigData from '../../../../../../main/ets/common/baseUtile/ConfigData'; export default function LocationViewModelTest() { describe('LocationViewModelTest', () => { diff --git a/oh-package-lock.json5 b/oh-package-lock.json5 index ddc8a54..00275fd 100644 --- a/oh-package-lock.json5 +++ b/oh-package-lock.json5 @@ -1,3 +1,17 @@ +/** + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ { "lockfileVersion": 1, "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", diff --git a/oh-package.json5 b/oh-package.json5 index c2f75b1..e45e3ae 100644 --- a/oh-package.json5 +++ b/oh-package.json5 @@ -1,3 +1,18 @@ +/** + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + { "license": "", "devDependencies": {