From d004d2c966617cc93b00261ddac03d52e6fa1f4a Mon Sep 17 00:00:00 2001 From: weiyunxing Date: Wed, 13 Jul 2022 16:58:04 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E5=87=BA=E5=8E=82?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=8E=A5=E5=8F=A3=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: weiyunxing --- .../RestoreFactorySettingsModel.ts | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/product/phone/src/main/ets/model/restoreFactorySettingsImpl/RestoreFactorySettingsModel.ts b/product/phone/src/main/ets/model/restoreFactorySettingsImpl/RestoreFactorySettingsModel.ts index de628240..ca89a972 100644 --- a/product/phone/src/main/ets/model/restoreFactorySettingsImpl/RestoreFactorySettingsModel.ts +++ b/product/phone/src/main/ets/model/restoreFactorySettingsImpl/RestoreFactorySettingsModel.ts @@ -18,20 +18,34 @@ import LogUtil from '../../../../../../../common/utils/src/main/ets/default/base import ConfigData from '../../../../../../../common/utils/src/main/ets/default/baseUtil/ConfigData'; import {LogAll} from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogDecorator'; +const TAG = ConfigData.TAG + 'RestoreFactorySettingsModel'; + /** * Restore factorySettings model */ @LogAll export class RestoreFactorySettingsModel extends BaseModel { - /** * Reboot and clean userData */ rebootAndCleanUserData(callback?: (value) => void) { - Updater.getUpdater('/data/updater/updater.zip', 'OTA').rebootAndCleanUserData().then((value) => { - LogUtil.log(ConfigData.TAG + "rebootAndCleanUserData value:" + value) - }) + let restorer = Updater.getRestorer(); + if (!restorer) { + LogUtil.error(TAG + 'Updater getRestorer failed'); + return; + } + try { + restorer.factoryReset() + .then(() => { + LogUtil.info(TAG + 'factoryReset success'); + }) + .catch((err) => { + LogUtil.error(TAG + 'factoryReset failed: ' + JSON.stringify(err)); + }) + } catch(err) { + LogUtil.error(TAG + 'Updater factoryReset failed: ' + JSON.stringify(err)); + } } } -- Gitee From 0c66adc15971e069fa3ed17b7d1ffdb017bf2534 Mon Sep 17 00:00:00 2001 From: weiyunxing Date: Tue, 19 Jul 2022 11:52:40 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E8=93=9D=E7=89=99=E5=92=8Cwifi=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: weiyunxing --- .../bluetooth/BluetoothDeviceController.ts | 60 ++++++++++--------- .../model/abilityInfoImpl/AbilityInfoModel.ts | 2 +- .../RestoreFactorySettingsModel.ts | 1 - product/phone/src/main/ets/pages/wifiPsd.ets | 18 ++++-- 4 files changed, 45 insertions(+), 36 deletions(-) diff --git a/product/phone/src/main/ets/controller/bluetooth/BluetoothDeviceController.ts b/product/phone/src/main/ets/controller/bluetooth/BluetoothDeviceController.ts index 3ec1f101..aa61ee3e 100644 --- a/product/phone/src/main/ets/controller/bluetooth/BluetoothDeviceController.ts +++ b/product/phone/src/main/ets/controller/bluetooth/BluetoothDeviceController.ts @@ -91,7 +91,7 @@ export default class BluetoothDeviceController extends BaseSettingsController { BluetoothModel.unsubscribeBluetoothDeviceFind(); BluetoothModel.unsubscribeBondStateChange(); BluetoothModel.unsubscribeDeviceStateChange(); - + AppStorage.Delete('BluetoothFailedDialogFlag'); return this; } @@ -201,6 +201,7 @@ export default class BluetoothDeviceController extends BaseSettingsController { * @param deviceId device id */ unpair(deviceId: string): boolean { + AppStorage.SetOrCreate('BluetoothFailedDialogFlag', false); const result = BluetoothModel.unpairDevice(deviceId); LogUtil.log(this.TAG + 'bluetooth paired device unpair. result = ' + result) this.refreshPairedDevices() @@ -327,15 +328,18 @@ export default class BluetoothDeviceController extends BaseSettingsController { } this.forceRefresh(this.availableDevices); AppStorage.SetOrCreate('bluetoothAvailableDevices', this.availableDevices); - - this.showConnectFailedDialog(); - - } else if (data.bondState == BondState.BOND_STATE_BONDED) { - // case success - LogUtil.log(this.TAG + 'bluetooth bonded : remove device.'); - this.removeAvailableDevice(data.deviceId); - BluetoothModel.connectDevice(data.deviceId); - } + let showFlag = AppStorage.Get('BluetoothFailedDialogFlag'); + if (showFlag == false) { + AppStorage.SetOrCreate('BluetoothFailedDialogFlag', true); + return; + } + this.showConnectFailedDialog(this.getDevice(data.deviceId).deviceName); + } else if (data.bondState == BondState.BOND_STATE_BONDED) { + // case success + LogUtil.log(this.TAG + 'bluetooth bonded : remove device.'); + this.removeAvailableDevice(data.deviceId); + BluetoothModel.connectDevice(data.deviceId); + } }); } @@ -466,24 +470,24 @@ export default class BluetoothDeviceController extends BaseSettingsController { LogUtil.log(this.TAG + 'removeAvailableDevice : after : availableDevices length = ' + this.availableDevices.length); } - /** - * Connect Failed Dialog - */ - private showConnectFailedDialog() { - AlertDialog.show({ - title: $r("app.string.bluetooth_connect_failed"), - message: $r("app.string.bluetooth_connect_failed_msg"), - confirm: { - value: $r("app.string.bluetooth_know_button"), - action: () => { - LogUtil.info('Button-clicking callback') - } - }, - cancel: () => { - LogUtil.info('Closed callbacks') - }, - alignment: DialogAlignment.Bottom - }) + /** + * Connect Failed Dialog + */ + private showConnectFailedDialog(deviceName: string) { + AlertDialog.show({ + title: $r("app.string.bluetooth_connect_failed"), + message: $r("app.string.bluetooth_connect_failed_msg", deviceName), + confirm: { + value: $r("app.string.bluetooth_know_button"), + action: () => { + LogUtil.info('Button-clicking callback') + } + }, + cancel: () => { + LogUtil.info('Closed callbacks') + }, + alignment: DialogAlignment.Bottom + }) } } \ No newline at end of file diff --git a/product/phone/src/main/ets/model/abilityInfoImpl/AbilityInfoModel.ts b/product/phone/src/main/ets/model/abilityInfoImpl/AbilityInfoModel.ts index 7098094d..980c341c 100644 --- a/product/phone/src/main/ets/model/abilityInfoImpl/AbilityInfoModel.ts +++ b/product/phone/src/main/ets/model/abilityInfoImpl/AbilityInfoModel.ts @@ -88,7 +88,7 @@ export class AbilityInfoModel extends BaseModel { label = metaBase.labelName; } else { if (metaBase.labelId > 0) { - globalThis.settingsAbilityContext.resourceManager.getString(parseInt(metaBase.labelId), (error, value) => { + globalThis.settingsAbilityContext.resourceManager.getString(parseInt(metaBase.labelId), (error, value) => { if (error != null) { LogUtil.info('settings getAbilityInfoListener getString error:' + error); label = ''; diff --git a/product/phone/src/main/ets/model/restoreFactorySettingsImpl/RestoreFactorySettingsModel.ts b/product/phone/src/main/ets/model/restoreFactorySettingsImpl/RestoreFactorySettingsModel.ts index ca89a972..db2033df 100644 --- a/product/phone/src/main/ets/model/restoreFactorySettingsImpl/RestoreFactorySettingsModel.ts +++ b/product/phone/src/main/ets/model/restoreFactorySettingsImpl/RestoreFactorySettingsModel.ts @@ -25,7 +25,6 @@ const TAG = ConfigData.TAG + 'RestoreFactorySettingsModel'; */ @LogAll export class RestoreFactorySettingsModel extends BaseModel { - /** * Reboot and clean userData */ diff --git a/product/phone/src/main/ets/pages/wifiPsd.ets b/product/phone/src/main/ets/pages/wifiPsd.ets index dcdd9e6f..84aff61a 100644 --- a/product/phone/src/main/ets/pages/wifiPsd.ets +++ b/product/phone/src/main/ets/pages/wifiPsd.ets @@ -42,6 +42,7 @@ struct WifiPsd { private isConnectedBefore: boolean = false; private taskId: number = -1; @State isPhone: boolean = false + @State @Watch("controlFailedDialog") ControlFailedDialog : boolean = false; private connectDialog: CustomDialogController = new CustomDialogController({ builder: connectProgressDialog({ ssid: this.tobeConnectedSSID, @@ -52,13 +53,20 @@ struct WifiPsd { customStyle: true }); private failedDialog: CustomDialogController = new CustomDialogController({ - builder: connectFailedDialog({}), + builder: connectFailedDialog({ControlFailedDialog:$ControlFailedDialog}), alignment: this.isPhone?DialogAlignment.Bottom:DialogAlignment.Center, offset: ({ dx: 0, dy: this.isPhone?'-16dp':0 }), autoCancel: true, customStyle: true }); + controlFailedDialog() { + if(this.ControlFailedDialog){ + this.failedDialog.close() + this.ControlFailedDialog =false + } + } + build() { Column() { GridContainer({ columns: 12, sizeType: SizeType.Auto, @@ -368,8 +376,8 @@ struct connectProgressDialog { @CustomDialog struct connectFailedDialog { - controller: CustomDialogController; - + controller: CustomDialogController ; + @Link ControlFailedDialog : boolean ; build() { Column() { Row() { @@ -389,9 +397,7 @@ struct connectFailedDialog { .fontColor($r('sys.color.ohos_id_color_text_primary_activated')) .fontWeight(FontWeight.Medium) .onClick(() => { - router.back({ - uri: 'pages/wifi', - }); + this.ControlFailedDialog = true }) } .alignItems(VerticalAlign.Top) -- Gitee From a8d4ecf6ed42e6380a3f60802c07c8d88543f585 Mon Sep 17 00:00:00 2001 From: PaDaBoo Date: Thu, 21 Jul 2022 16:51:32 +0800 Subject: [PATCH 3/7] Rectify external dependencies of appdatamgr Signed-off-by: PaDaBoo --- napi/settings/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/napi/settings/BUILD.gn b/napi/settings/BUILD.gn index c25bd3d9..c395af5f 100644 --- a/napi/settings/BUILD.gn +++ b/napi/settings/BUILD.gn @@ -30,7 +30,6 @@ ohos_shared_library("settings") { "//foundation/ability/ability_runtime/frameworks/native/ability/native:data_ability_helper", "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:ability_manager", "//foundation/arkui/napi:ace_napi", - "//foundation/distributeddatamgr/appdatamgr/relational_store/interfaces/inner_api/rdb:native_rdb", ] external_deps = [ @@ -38,6 +37,7 @@ ohos_shared_library("settings") { "bundle_framework:appexecfwk_base", "hiviewdfx_hilog_native:libhilog", "relational_store:native_dataability", + "relational_store:native_rdb", "utils_base:utils", ] -- Gitee From 020acfd5bcca7f72f76acc0d0d7d4c95346e0bf0 Mon Sep 17 00:00:00 2001 From: weiyunxing Date: Mon, 25 Jul 2022 11:52:00 +0800 Subject: [PATCH 4/7] =?UTF-8?q?setting=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: weiyunxing --- .../main/ets/default/subEntryComponent.ets | 2 +- .../bluetooth/BluetoothDeviceController.ts | 1 - .../model/aboutDeviceImpl/AboutDeviceModel.ts | 1 + .../appManagementImpl/AppManagementModel.ts | 307 +++++++++--------- .../model/dateAndTimeImpl/DateAndTimeModel.ts | 1 + .../brightness/BrightnessSettingModel.ts | 1 + .../ets/model/moreConnectionsImpl/NfcModel.ts | 42 ++- .../src/main/ets/model/wifiImpl/WifiModel.ts | 20 +- .../src/main/ets/pages/moreConnections.ets | 74 +++-- .../src/main/ets/pages/multipleUsers.ets | 2 +- product/phone/src/main/ets/pages/nfc.ets | 51 ++- .../phone/src/main/ets/pages/settingList.ets | 6 +- product/phone/src/main/ets/pages/wifi.ets | 10 +- product/phone/src/main/ets/pages/wifiPsd.ets | 6 +- .../main/resources/base/element/color.json | 4 + .../main/resources/base/element/float.json | 12 - .../main/resources/en_US/element/string.json | 8 +- .../main/resources/phone/element/float.json | 4 + .../main/resources/phone/element/string.json | 12 + .../main/resources/zh_CN/element/string.json | 4 + 20 files changed, 336 insertions(+), 232 deletions(-) diff --git a/common/component/src/main/ets/default/subEntryComponent.ets b/common/component/src/main/ets/default/subEntryComponent.ets index 985188e2..dbd9dc30 100644 --- a/common/component/src/main/ets/default/subEntryComponent.ets +++ b/common/component/src/main/ets/default/subEntryComponent.ets @@ -78,7 +78,7 @@ export struct SubEntryComponent { @Component export struct SubEntryComponentWithEndText { @State isTouched: boolean = false; - @Prop endText: string; + private endText: string | Resource; private targetPage: string; private title: string | Resource; diff --git a/product/phone/src/main/ets/controller/bluetooth/BluetoothDeviceController.ts b/product/phone/src/main/ets/controller/bluetooth/BluetoothDeviceController.ts index aa61ee3e..07e9cd2b 100644 --- a/product/phone/src/main/ets/controller/bluetooth/BluetoothDeviceController.ts +++ b/product/phone/src/main/ets/controller/bluetooth/BluetoothDeviceController.ts @@ -87,7 +87,6 @@ export default class BluetoothDeviceController extends BaseSettingsController { clearTimeout(this.discoveryStopTimeoutId); } - BluetoothModel.unsubscribeStateChange(); BluetoothModel.unsubscribeBluetoothDeviceFind(); BluetoothModel.unsubscribeBondStateChange(); BluetoothModel.unsubscribeDeviceStateChange(); diff --git a/product/phone/src/main/ets/model/aboutDeviceImpl/AboutDeviceModel.ts b/product/phone/src/main/ets/model/aboutDeviceImpl/AboutDeviceModel.ts index cd8148f2..aef99d84 100644 --- a/product/phone/src/main/ets/model/aboutDeviceImpl/AboutDeviceModel.ts +++ b/product/phone/src/main/ets/model/aboutDeviceImpl/AboutDeviceModel.ts @@ -55,6 +55,7 @@ export class AboutDeviceModel extends BaseModel { constructor(){ super(); this.urivar = this.getUri(); + // @ts-ignore this.dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.settingsAbilityContext, this.uri); } diff --git a/product/phone/src/main/ets/model/appManagementImpl/AppManagementModel.ts b/product/phone/src/main/ets/model/appManagementImpl/AppManagementModel.ts index 7f21aa5b..c69109b8 100644 --- a/product/phone/src/main/ets/model/appManagementImpl/AppManagementModel.ts +++ b/product/phone/src/main/ets/model/appManagementImpl/AppManagementModel.ts @@ -15,80 +15,103 @@ import BaseModel from '../../../../../../../common/utils/src/main/ets/default/model/BaseModel'; import LogUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil'; import Bundle from '@ohos.bundle'; -//import ResMgr from '@ohos.resourceManager'; import appManager from '@ohos.application.appManager' import osAccount from '@ohos.account.osAccount'; import ConfigData from '../../../../../../../common/utils/src/main/ets/default/baseUtil/ConfigData'; -import {LogAll} from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogDecorator'; +import { LogAll } from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogDecorator'; const INDEX = 0; const IS_INCLUDE_ABILITY_INFO = 0; const URI_PAGE = 'pages/applicationInfo'; let icon_arrow = $r('app.media.ic_settings_arrow'); let icon_default = $r('app.media.icon_default'); +let icon_default_str = ""; const MODULE_TAG = ConfigData.TAG + 'application-> '; /** * app management service class */ -@LogAll export class AppManagementModel extends BaseModel { - private mBundleInfoList: any[]= []; - /** - * get application data - */ - setAppManagementListener() { - this.mBundleInfoList = []; - Bundle.getAllBundleInfo(IS_INCLUDE_ABILITY_INFO) - .then((data) => { - LogUtil.info('settings AppManagementModel setAppManagementListener getBundleInfos() start '); - LogUtil.info('settings AppManagementModel data.length: ' + data.length + ' data: ' + JSON.stringify(data)); - this.getResourceItem(INDEX, data.length, data); - }); - LogUtil.info('settings appManagement init AppManagementModel setAppManagementListener end'); - } + private mBundleInfoList: any[] = []; - /** - * get resource information according to resource id - * - * @param index - array position - * @param count - array length - * @param data - data - */ - getResourceItem(index, count, data) { - LogUtil.info('settings AppManagementModel getIconItem start data.length' + data.length); - let imageValue = ''; - let label = ''; - let that = this; - LogUtil.info('settings AppManagementModel data[index].name :' + data[index].name); - try { - let appInfo = data[index].appInfo; - LogUtil.info('settings AppManagementModel getResourceManager appInfo.labelId:' + JSON.stringify(appInfo)); - let bundleContext = globalThis.settingsAbilityContext.createBundleContext(data[index].name) - if (appInfo.labelId > 0) { - bundleContext.resourceManager.getString(appInfo.labelId, (error, value) => { - LogUtil.info('settings AppManagementModel getResourceManager value.length:' + value.length); - if (value != null) { - LogUtil.info('settings AppManagementModel getResourceManager getString() value:' + value); - label = value; - LogUtil.info('settings AppManagementModel getResourceManager getString() label:' + label); + constructor() { + super(); + globalThis.settingsAbilityContext.resourceManager.getMediaBase64(icon_default) + .then((res) => { + icon_default_str = res; + LogUtil.info('settings AppManagementModel getResourceManager init defaultIcon res:' + icon_default_str); + }) + .catch((err) => { + LogUtil.info('settings AppManagementModel getResourceManager init defaultIcon error:' + err); + }); + } + /** + * get application data + */ + setAppManagementListener() { + this.mBundleInfoList = []; + Bundle.getAllBundleInfo(IS_INCLUDE_ABILITY_INFO) + .then((data) => { + LogUtil.info('settings AppManagementModel setAppManagementListener getBundleInfos() start '); + LogUtil.info('settings AppManagementModel data.length: ' + data.length + ' data: ' + JSON.stringify(data)); + this.getResourceItem(INDEX, data.length, data); + }); + LogUtil.info('settings appManagement init AppManagementModel setAppManagementListener end'); + } + + /** + * get resource information according to resource id + * + * @param index - array position + * @param count - array length + * @param data - data + */ + async getResourceItem(index, count, data) { + LogUtil.info('settings AppManagementModel getIconItem start data.length' + data.length); + let imageValue = ''; + let label = ''; + let that = this; + LogUtil.info('settings AppManagementModel data[index].name :' + data[index].name); + try { + let context = globalThis.settingsAbilityContext; + let appInfo = data[index].appInfo; + LogUtil.info('settings AppManagementModel getResourceManager appInfo.labelId:' + JSON.stringify(appInfo.labelResource)); + if (appInfo.labelResource.id > 0) { + await context.resourceManager.getString(appInfo.labelResource) + .then((res) => { + label = res; + LogUtil.info('settings AppManagementModel getResourceManager getString() res:' + label); + }) + .catch((err) => { + LogUtil.info('settings AppManagementModel getResourceManager getString() error:' + err); + }); } else { - LogUtil.info('settings AppManagementModel getResourceManager getString() error:' + error); + label = appInfo.label; + if (label.length == 0) { + label = appInfo.labelResource.bundleName; + } + LogUtil.info('settings AppManagementModel getResourceManager getString() id=0:' + appInfo.label); } - }); - } else { - LogUtil.info('settings AppManagementModel getResourceManager getString() label:' + appInfo.label); - label = appInfo.label; - } - LogUtil.info('settings AppManagementModel getResourceManager getString() finish label:' + label); - if (appInfo.iconId > 0) { - bundleContext.resourceManager.getMediaBase64(appInfo.iconId, (error, value) => { - LogUtil.info('settings AppManagementModel getMediaBase64 error:' + error); - if (error != null) { - LogUtil.info('settings AppManagementModel getMediaBase64 error!=null:' + error); - this.mBundleInfoList.push({ - settingIcon: icon_default, + LogUtil.info('settings AppManagementModel getResourceManager getString() value:' + label); + LogUtil.info('settings AppManagementModel getResourceManager appInfo.iconResource:' + JSON.stringify(appInfo.iconResource)); + if (appInfo.iconResource.id > 0) { + await context.resourceManager.getMediaBase64(appInfo.iconResource) + .then((res) => { + imageValue = res; + LogUtil.info('settings AppManagementModel getResourceManager getMediaBase64() res:' + imageValue); + }) + .catch((err) => { + LogUtil.info('settings AppManagementModel getResourceManager getString() error:' + err); + imageValue = icon_default_str; + }); + } else { + imageValue = icon_default_str; + LogUtil.info('settings AppManagementModel getResourceManager getMediaBase64() id=0:' + icon_default_str); + } + LogUtil.info('settings AppManagementModel getResourceManager getMediaBase64() value:' + imageValue); + this.mBundleInfoList.push({ + settingIcon: imageValue, settingTitle: label, settingValue: '', settingArrow: icon_arrow, @@ -96,129 +119,91 @@ export class AppManagementModel extends BaseModel { settingBundleName: data[index].name, settingIconId: appInfo.iconId, settingUri: URI_PAGE - }); - if (count - 1 > index) { + }); + + + if (count - 1 > index) { LogUtil.info('settings AppManagementModel getMediaBase64() id=0:' + index + ' | count:' + count); index = index + 1; that.getResourceItem(index, count, data); - } else { + } else { LogUtil.info('settings AppManagementModel getMediaBase64() id=0:' + index + ' | count:' + count); LogUtil.info('settings AppManagementModel mBundleInfoList[i]: ' + JSON.stringify(this.mBundleInfoList)); AppStorage.SetOrCreate('appManagementList', this.mBundleInfoList); - } } - LogUtil.info('settings AppManagementModel getResourceManager getMediaBase64() :' + value.length); - if (value.length > 0) { - imageValue = value; - LogUtil.info('settings AppManagementModel getResourceManager getMediaBase64() imageValue:' + imageValue); - } - LogUtil.info('settings AppManagementModel getResourceManager getMediaBase64() end'); - this.mBundleInfoList.push({ - settingIcon: imageValue, - settingTitle: label, - settingValue: '', - settingArrow: icon_arrow, - settingSummary: data[index].versionName, - settingBundleName: data[index].name, - settingIconId: appInfo.iconId, - settingUri: URI_PAGE - }); - if (count - 1 > index) { - LogUtil.info('settings AppManagementModel getMediaBase64() if index:' + index + ' | count:' + count); - index = index + 1; - that.getResourceItem(index, count, data); - } else { - LogUtil.info('settings AppManagementModel getMediaBase64() else index:' + index + ' | count:' + count); - LogUtil.info('settings AppManagementModel mBundleInfoList[i]: ' + JSON.stringify(this.mBundleInfoList)); - AppStorage.SetOrCreate('appManagementList', this.mBundleInfoList); - } - }); - } else { - if (count - 1 > index) { - LogUtil.info('settings AppManagementModel getMediaBase64() id=0:' + index + ' | count:' + count); - index = index + 1; - that.getResourceItem(index, count, data); - } else { - LogUtil.info('settings AppManagementModel getMediaBase64() id=0:' + index + ' | count:' + count); - LogUtil.info('settings AppManagementModel mBundleInfoList[i]: ' + JSON.stringify(this.mBundleInfoList)); - AppStorage.SetOrCreate('appManagementList', this.mBundleInfoList); - } + } catch (error) { + LogUtil.error('settings AppManagementModel catch error:' + error); } - AppStorage.SetOrCreate('appManagementList', this.distinct(AppStorage.Get('appManagementList'))); - } catch (error) { - LogUtil.error('settings AppManagementModel catch error:' + error); + LogUtil.info('settings appManagement AppManagementModel getIconItem end'); } - LogUtil.info('settings appManagement AppManagementModel getIconItem end'); - } - /** - * Remove duplicate item - */ - public distinct(arr){ - for(let i = 0; i < arr.length; i++ ){ - for(let j=i+1; j < arr.length; j++ ){ - if(arr[i].settingBundleName === arr[j].settingBundleName){ - arr.splice(j,1); - j--; + /** + * Remove duplicate item + */ + public distinct(arr) { + for (let i = 0; i < arr.length; i++) { + for (let j = i + 1; j < arr.length; j++) { + if (arr[i].settingBundleName === arr[j].settingBundleName) { + arr.splice(j, 1); + j--; + } + } } - } + return arr; } - return arr; - } - /** - * Clear up application data by bundle name - * @param bundleName bundle name - */ - clearUpApplicationData(bundleName: string, callback) { - appManager.clearUpApplicationData(bundleName, callback); - } - - /** - * Clears cache data of a specified application. - * @param bundleName bundle name - */ - cleanBundleCacheFiles(bundleName: string, callback) { - Bundle.cleanBundleCacheFiles(bundleName, callback); - } + /** + * Clear up application data by bundle name + * @param bundleName bundle name + */ + clearUpApplicationData(bundleName: string, callback) { + appManager.clearUpApplicationData(bundleName, callback); + } - /** - * Uninstall an application. - * @param bundleName bundle name - */ - async uninstall(bundleName: string, callback) { - LogUtil.info(ConfigData.TAG + "start uninstall in model"); - const bundlerInstaller = await Bundle.getBundleInstaller(); - const accountManager = await osAccount.getAccountManager(); - const mUserID = await accountManager.getOsAccountLocalIdFromProcess(); - LogUtil.info(ConfigData.TAG + "get bundlerInstaller : " + typeof bundlerInstaller); - bundlerInstaller.uninstall(bundleName, - { - userId: mUserID, - installFlag: 0, - isKeepData: false - }, (err, result) => { - AppStorage.SetOrCreate('appManagementList', []); - this.setAppManagementListener(); - callback(err, result); - }); - LogUtil.info(ConfigData.TAG + "end uninstall in model"); - } + /** + * Clears cache data of a specified application. + * @param bundleName bundle name + */ + cleanBundleCacheFiles(bundleName: string, callback) { + Bundle.cleanBundleCacheFiles(bundleName, callback); + } - getBundleInfo(bundleName, callback) { - LogUtil.info(MODULE_TAG + 'start get bundle info'); - Bundle.getBundleInfo(bundleName, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, callback); - LogUtil.info(MODULE_TAG + 'end get bundle info'); - } + /** + * Uninstall an application. + * @param bundleName bundle name + */ + async uninstall(bundleName: string, callback) { + LogUtil.info(ConfigData.TAG + "start uninstall in model"); + const bundlerInstaller = await Bundle.getBundleInstaller(); + const accountManager = await osAccount.getAccountManager(); + const mUserID = await accountManager.getOsAccountLocalIdFromProcess(); + LogUtil.info(ConfigData.TAG + "get bundlerInstaller : " + typeof bundlerInstaller); + bundlerInstaller.uninstall(bundleName, + { + userId: mUserID, + installFlag: 0, + isKeepData: false + }, (err, result) => { + AppStorage.SetOrCreate('appManagementList', []); + this.setAppManagementListener(); + callback(err, result); + }); + LogUtil.info(ConfigData.TAG + "end uninstall in model"); + } - /** - * Kill processes by bundle name - * @param bundleName bundle name - */ - killProcessesByBundleName(bundleName: string, callback) { - appManager.killProcessesByBundleName(bundleName, callback); - } + getBundleInfo(bundleName, callback) { + LogUtil.info(MODULE_TAG + 'start get bundle info'); + Bundle.getBundleInfo(bundleName, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, callback); + LogUtil.info(MODULE_TAG + 'end get bundle info'); + } + /** + * Kill processes by bundle name + * @param bundleName bundle name + */ + killProcessesByBundleName(bundleName: string, callback) { + appManager.killProcessesByBundleName(bundleName, callback); + } } let appManagementModel = new AppManagementModel(); diff --git a/product/phone/src/main/ets/model/dateAndTimeImpl/DateAndTimeModel.ts b/product/phone/src/main/ets/model/dateAndTimeImpl/DateAndTimeModel.ts index 646589f9..7128a8eb 100644 --- a/product/phone/src/main/ets/model/dateAndTimeImpl/DateAndTimeModel.ts +++ b/product/phone/src/main/ets/model/dateAndTimeImpl/DateAndTimeModel.ts @@ -34,6 +34,7 @@ export class DateAndTimeModel extends BaseModel { constructor() { super(); this.urivar = this.getUri(); + // @ts-ignore this.dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.settingsAbilityContext, this.uri); } 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 77437ef1..98f9572a 100644 --- a/product/phone/src/main/ets/model/displayAndBrightnessImpl/brightness/BrightnessSettingModel.ts +++ b/product/phone/src/main/ets/model/displayAndBrightnessImpl/brightness/BrightnessSettingModel.ts @@ -39,6 +39,7 @@ export class BrightnessSettingModel extends BaseModel{ constructor() { super(); this.urivar = this.getUri(); + // @ts-ignore this.dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.settingsAbilityContext, this.uri); this.updateValue(); } diff --git a/product/phone/src/main/ets/model/moreConnectionsImpl/NfcModel.ts b/product/phone/src/main/ets/model/moreConnectionsImpl/NfcModel.ts index a98f0ee4..982fcb1e 100644 --- a/product/phone/src/main/ets/model/moreConnectionsImpl/NfcModel.ts +++ b/product/phone/src/main/ets/model/moreConnectionsImpl/NfcModel.ts @@ -12,23 +12,53 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import LogUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil'; import ConfigData from '../../../../../../../common/utils/src/main/ets/default/baseUtil/ConfigData'; import nfcController from '@ohos.nfc.controller'; +const TAG = ConfigData.TAG + 'NfcModel: '; + export class NfcModel { - private isNfcOpen: boolean; - private TAG = ConfigData.TAG + 'NfcModel '; + /** + * register Nfc Status change + * @param callback + */ + registerNfcStatusObserver(callback) { + LogUtil.info(TAG + 'start register nfc status observer' ); + nfcController.on('nfcStateChange', (code) => { + AppStorage.SetOrCreate('nfcStatus', nfcController.isNfcOpen()); + callback(code); + }) + } + + /** + * check whether NFC is open + * return boolean. true is mean of NFC open, false is mean of NFC close + */ + isNfcOpen(): boolean { + const isOpen: boolean = nfcController.isNfcOpen(); + LogUtil.info(TAG + 'check nfc is open: ' + isOpen); + return isOpen; + } + /** + * open NFC + * return boolean. true is mean of NFC open success, false is mean of NFC open failed + */ openNfc(): boolean { - let enableNfc = nfcController.openNfc() - LogUtil.info(this.TAG + enableNfc) + let enableNfc = nfcController.openNfc(); + LogUtil.info(TAG + 'open nfc: ' + enableNfc); return enableNfc; } + /** + * close NFC + * return boolean. true is mean of NFC close success, false is mean of NFC close failed + */ closeNfc(): boolean { - let disableNfc = nfcController.closeNfc() - LogUtil.info(this.TAG + disableNfc) + let disableNfc = nfcController.closeNfc(); + LogUtil.info(TAG + 'close nfc' + disableNfc); return disableNfc; } } diff --git a/product/phone/src/main/ets/model/wifiImpl/WifiModel.ts b/product/phone/src/main/ets/model/wifiImpl/WifiModel.ts index b014a482..1999e0c0 100644 --- a/product/phone/src/main/ets/model/wifiImpl/WifiModel.ts +++ b/product/phone/src/main/ets/model/wifiImpl/WifiModel.ts @@ -304,6 +304,7 @@ export class WifiModel extends BaseModel { connectWiFi(password: string) { let apInfo = this.userSelectedAp.getApInfo(); + let ret = false; let connectParam: any = { "ssid": apInfo.ssid, "bssid": apInfo.bssid, @@ -311,13 +312,20 @@ export class WifiModel extends BaseModel { "isHiddenSsid": false, // we don't support connect to hidden ap yet "securityType": apInfo.securityType }; - + LogUtil.info(MODULE_TAG + 'disconnect WiFi isConnected is ' + wifi.isConnected()); if (wifi.isConnected() === true) { - wifi.disconnect(); + ret = wifi.disconnect(); + LogUtil.info(MODULE_TAG + 'disconnect WiFi ret is ' + ret); + this.registerWiFiConnectionObserver((code: Number) => { + if (code === 0) { + ret = wifi.connectToDevice(connectParam); + this.unregisterWiFiConnectionObserver(); + } + }) + }else{ + ret = wifi.connectToDevice(connectParam); + LogUtil.info(MODULE_TAG + 'connect WiFi ret is ' + ret); } - - let ret = wifi.connectToDevice(connectParam); - LogUtil.info(MODULE_TAG + 'connect WiFi ret is ' + ret); return ret; } @@ -351,7 +359,7 @@ export class WifiModel extends BaseModel { return WiFiEncryptMethodMap.OPEN; } if (apInfo.securityType === 2) { - return WiFiEncryptMethodMap.WPA; + return WiFiEncryptMethodMap.WEP; } return WiFiEncryptMethodMap.WPA2; } diff --git a/product/phone/src/main/ets/pages/moreConnections.ets b/product/phone/src/main/ets/pages/moreConnections.ets index 55c9c40a..29fe89d1 100644 --- a/product/phone/src/main/ets/pages/moreConnections.ets +++ b/product/phone/src/main/ets/pages/moreConnections.ets @@ -17,7 +17,12 @@ import ConfigData from '../../../../../../common/utils/src/main/ets/default/base import HeadComponent from '../../../../../../common/component/src/main/ets/default/headComponent'; import {SubEntryComponentWithEndText} from '../../../../../../common/component/src/main/ets/default/subEntryComponent'; import ResourceUtil from '../../../../../../common/search/src/main/ets/default/common/ResourceUtil'; -import nfcController from '@ohos.nfc.controller'; +import NfcModel from '../model/moreConnectionsImpl/NfcModel'; +import display from '@ohos.display'; +import deviceInfo from '@ohos.deviceInfo'; + +const TAG = ConfigData.TAG + 'MoreConnections: '; +const deviceTypeInfo = deviceInfo.deviceType; /** * MoreConnections @@ -27,12 +32,17 @@ import nfcController from '@ohos.nfc.controller'; struct MoreConnections { @State columnMargin: string = '24vp'; @State nfcEnable: string = ''; - @State isNfcEnable: boolean = false; + @StorageLink('nfcStatus') nfcStatus: boolean = NfcModel.isNfcOpen(); + private maxScreenWidth; + private maxScreenHeight; + private nfcImageWidth; + private nfcImageHeight; build() { - Column(){ - GridContainer({columns:12, sizeType: SizeType.Auto, gutter: vp2px(1) === 2 ? '12vp' : '0vp', margin: vp2px(1) === 2 ? '24vp' : '0vp'}) { - Row({}) { + Column() { + GridContainer({columns: 12, sizeType: SizeType.Auto, + gutter: vp2px(1) === 2 ? '12vp' : '0vp', margin: vp2px(1) === 2 ? '24vp' : '0vp'}) { + Row() { Column() { } .width(ConfigData.WH_100_100) @@ -45,12 +55,12 @@ struct MoreConnections { Column() { HeadComponent({ headName: $r('app.string.moreConnectionsTab'), isActive: true }) Column({space: this.columnMargin}){ - SubEntryComponentWithEndText({targetPage:'pages/nfc', title: $r('app.string.NFC'), endText: this.nfcEnable}) + SubEntryComponentWithEndText({targetPage:'pages/nfc', title: $r('app.string.NFC'), endText: this.nfcStatus ? $r("app.string.enabled") : $r("app.string.disabled")}) } .margin({ top: $r("app.float.distance_8") }) .width(ConfigData.WH_100_100) } - .padding({ left: $r('app.float.distance_24'), right: $r('app.float.distance_24') }) + .margin({ left: $r('sys.float.ohos_id_card_margin_start'), right: $r('sys.float.ohos_id_card_margin_end') }) .width(ConfigData.WH_100_100) .height(ConfigData.WH_100_100) .useSizeType({ @@ -79,19 +89,45 @@ struct MoreConnections { } aboutToAppear(){ - LogUtil.info('settings moreConnections aboutToAppear in'); + LogUtil.info(TAG + 'aboutToAppear in'); ResourceUtil.getString($r('app.float.distance_24')).then(value => this.columnMargin = value); - let nfcState = nfcController.getNfcState(); - if (nfcState === ConfigData.STATE_ON) { - this.isNfcEnable = true; - this.nfcEnable = ConfigData.NFC_OPEN; - } - if (nfcState === ConfigData.STATE_OFF) { - this.isNfcEnable = false; - this.nfcEnable = ConfigData.NFC_CLOSE; - } - AppStorage.SetOrCreate('isNfcEnable', this.isNfcEnable) - LogUtil.info('settings moreConnections aboutToAppear out'); + // get screen max width and max height to show nfc image width and height + display.getDefaultDisplay((err, data) => { + if (err.code) { + LogUtil.error(TAG + 'Failed to obtain the default display object. Code: ' + JSON.stringify(err)); + return; + } + LogUtil.info(TAG + 'Succeeded in obtaining the default display object. Data:' + JSON.stringify(data)); + + // screen max width + this.maxScreenWidth = data.width; + // screen max height + this.maxScreenHeight = data.height; + + if (deviceTypeInfo === 'phone') { + if (this.maxScreenWidth < this.maxScreenHeight / 2) { + this.nfcImageWidth = this.maxScreenWidth * 0.8; + this.nfcImageHeight = this.maxScreenWidth * 0.8; + } else { + this.nfcImageWidth = (this.maxScreenHeight / 2) * 0.8; + this.nfcImageHeight = (this.maxScreenHeight / 2) * 0.8; + } + } + else { + if (this.maxScreenHeight > this.maxScreenWidth / 2) { + this.nfcImageWidth = (this.maxScreenWidth / 2) * 0.7; + this.nfcImageHeight = (this.maxScreenWidth / 2) * 0.7; + } else { + this.nfcImageWidth = this.maxScreenHeight * 0.7; + this.nfcImageHeight = this.maxScreenHeight * 0.7; + } + } + AppStorage.SetOrCreate('nfcImageWidth', this.nfcImageWidth); + AppStorage.SetOrCreate('nfcImageHeight', this.nfcImageHeight); + LogUtil.info('cq=====' + this.nfcImageWidth + typeof(this.maxScreenHeight)); + }) + + LogUtil.info(TAG + 'aboutToAppear out'); } } \ No newline at end of file diff --git a/product/phone/src/main/ets/pages/multipleUsers.ets b/product/phone/src/main/ets/pages/multipleUsers.ets index 4a49dee3..83f45270 100644 --- a/product/phone/src/main/ets/pages/multipleUsers.ets +++ b/product/phone/src/main/ets/pages/multipleUsers.ets @@ -381,7 +381,7 @@ struct CurrentDialogBuilder { .onClick((event) => { LogUtil.info("Click to modify user image.") let chooseImageDialog = new CustomDialogController({ - builder: ChooseImageDialog({ controller: this.controller }), + builder: ChooseImageDialog(), alignment: DialogAlignment.Bottom, offset: ({ dx: 0, dy: '-24dp' }), }); diff --git a/product/phone/src/main/ets/pages/nfc.ets b/product/phone/src/main/ets/pages/nfc.ets index 4ff590c3..c7eae4f6 100644 --- a/product/phone/src/main/ets/pages/nfc.ets +++ b/product/phone/src/main/ets/pages/nfc.ets @@ -6,22 +6,26 @@ * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or - { - "name": "bluetoothTab", agreed to in writing, software + * 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 LogUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil'; import HeadComponent from '../../../../../../common/component/src/main/ets/default/headComponent'; import ConfigData from '../../../../../../common/utils/src/main/ets/default/baseUtil/ConfigData'; import NfcModel from '../model/moreConnectionsImpl/NfcModel'; +const TAG = ConfigData.TAG + 'Nfc: '; + @Entry @Component struct Nfc { - @StorageLink('isNfcEnable') isNfcEnable: boolean = false; + @State isNfcEnable: boolean = false; + @StorageLink('nfcImageWidth') nfcImageWidth: number = null; + @StorageLink('nfcImageWidth') nfcImageHeight: number = null; build() { Column() { @@ -46,19 +50,19 @@ struct Nfc { } Image($r("app.media.ic_nfc")) - .height($r("app.float.wh_value_298")) - .width($r("app.float.wh_value_208")) + .width(this.nfcImageWidth + "px") + .height(this.nfcImageHeight + "px") .margin({ top: $r("app.float.distance_19") }) Text($r("app.string.nfcTips")) .fontFamily('HarmonyHeiTi') .fontWeight(FontWeight.Regular) .fontSize($r("app.float.font_14")) - .height($r("app.float.wh_value_19")) .lineHeight($r("app.float.lineHeight_19")) .fontColor($r("app.color.font_color_182431")) - .margin({ bottom: $r("app.float.distance_36"), top: $r("app.float.distance_27_5") }) + .margin({ bottom: $r("app.float.distance_36"), top: $r("app.float.distance_24") }) .opacity($r("app.float.opacity_100_60")) + .textAlign(TextAlign.Center) Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { Row() { @@ -75,15 +79,20 @@ struct Nfc { left: $r("app.float.wh_value_12") }) Toggle({ type: ToggleType.Switch, isOn: this.isNfcEnable }) - .width('36vp') - .height('20vp') - .selectedColor('#007DFF') + .width($r("app.float.switch_toggle_width")) + .height($r("app.float.switch_toggle_height")) + .selectedColor($r("app.color.toggle_selected_color_007DFF")) .margin({ right: $r('app.float.wh_value_6') }) .onChange((isOn: boolean) => { - if (isOn) { + this.isNfcEnable = !this.isNfcEnable; + if (this.isNfcEnable) { + // open NFC NfcModel.openNfc() + LogUtil.info(TAG + 'enable nfc: ' + NfcModel.openNfc()); } else { + // close NFC NfcModel.closeNfc() + LogUtil.info(TAG + 'disable nfc: ' + NfcModel.openNfc()); } }); } @@ -93,11 +102,7 @@ struct Nfc { .borderRadius($r('app.float.radius_24')) } .backgroundColor($r("sys.color.ohos_id_color_sub_background")) - .padding({ - left: $r('app.float.wh_24'), - right: $r('app.float.wh_24'), - bottom: $r('app.float.distance_32') - }) + .margin({ left: $r('sys.float.ohos_id_card_margin_start'), right: $r('sys.float.ohos_id_card_margin_end') }) .width(ConfigData.WH_100_100) .height(ConfigData.WH_100_100) .useSizeType({ @@ -125,4 +130,16 @@ struct Nfc { .width(ConfigData.WH_100_100) .height(ConfigData.WH_100_100); } + + aboutToAppear() { + LogUtil.info(TAG + 'aboutToAppear in'); + NfcModel.registerNfcStatusObserver((code) => { + LogUtil.info(TAG + 'aboutToAppear status code: ' + code); + this.isNfcEnable = NfcModel.isNfcOpen(); + LogUtil.info(TAG + 'aboutToAppear nfc open status: ' + this.isNfcEnable); + }) + // init nfc active status + this.isNfcEnable = NfcModel.isNfcOpen(); + LogUtil.info(TAG + 'aboutToAppear out'); + } } \ No newline at end of file diff --git a/product/phone/src/main/ets/pages/settingList.ets b/product/phone/src/main/ets/pages/settingList.ets index f3a14a2b..3de96a5d 100644 --- a/product/phone/src/main/ets/pages/settingList.ets +++ b/product/phone/src/main/ets/pages/settingList.ets @@ -23,7 +23,7 @@ import Router from '@system.router'; import FeatureAbility from '@ohos.ability.featureAbility'; import { BaseData } from '../../../../../../common/utils/src/main/ets/default/bean/BaseData'; import deviceInfo from '@ohos.deviceInfo'; -import parameter from '@ohos.systemParameter'; +import parameter from '@ohos.systemparameter'; const PAGE_SEARCH = 'pages/searchPage'; // for search const deviceTypeInfo = deviceInfo.deviceType @@ -652,10 +652,12 @@ struct bluetoothItemComponent { aboutToAppear() { LogUtil.info('settings SettingList bluetoothItem aboutToAppear in'); this.bluetoothIsOn = BluetoothModel.isStateOn(); + LogUtil.info('settings SettingList bluetoothItem aboutToAppear end'); + } + onPageShow(){ BluetoothModel.subscribeStateChange((isOn: boolean) => { AppStorage.SetOrCreate('bluetoothIsOn', isOn); }); - LogUtil.info('settings SettingList bluetoothItem aboutToAppear end'); } aboutToDisappear() { diff --git a/product/phone/src/main/ets/pages/wifi.ets b/product/phone/src/main/ets/pages/wifi.ets index 9c5b5355..45a2c05a 100644 --- a/product/phone/src/main/ets/pages/wifi.ets +++ b/product/phone/src/main/ets/pages/wifi.ets @@ -319,10 +319,12 @@ struct Index { } // as the ConnectionStateChange event is diff with the getLinkInfo callback, // we always get the diff status between them - if (this.connectedWiFi.settingTitle === '') { - return false + let titleSign: boolean = (!!this.connectedWiFi.settingTitle) && (this.connectedWiFi.settingTitle.length > 0); + let arrowSign: boolean = (!!this.connectedWiFi.settingArrow) && (this.connectedWiFi.settingArrow.length > 0); + if(titleSign && arrowSign){ + return true; } - return true; + return false; } jumpToConnectApPage(apInfo: WifiScanInfo) { @@ -379,6 +381,8 @@ struct Index { } else { this.isPhone = false } + + AppStorage.SetOrCreate('slConnectedWifi', (new ApScanResult()).renderToListModel()); } aboutToDisappear(): void { diff --git a/product/phone/src/main/ets/pages/wifiPsd.ets b/product/phone/src/main/ets/pages/wifiPsd.ets index 84aff61a..6fdf617c 100644 --- a/product/phone/src/main/ets/pages/wifiPsd.ets +++ b/product/phone/src/main/ets/pages/wifiPsd.ets @@ -41,6 +41,7 @@ struct WifiPsd { private tobeConnectedAp: WifiScanInfo = null; private isConnectedBefore: boolean = false; private taskId: number = -1; + private toConnected: boolean = false; @State isPhone: boolean = false @State @Watch("controlFailedDialog") ControlFailedDialog : boolean = false; private connectDialog: CustomDialogController = new CustomDialogController({ @@ -172,6 +173,7 @@ struct WifiPsd { () => { WifiModel.setUserSelectedAp(this.tobeConnectedAp); WifiModel.connectWiFi(this.userInputs); + this.toConnected = true; this.connectDialog.open(); }); } @@ -229,6 +231,7 @@ struct WifiPsd { } this.initTextInputHint(); this.isConnectedBefore = wifi.isConnected(); + if (this.isConnectedBefore) { LogUtil.info(MODULE_TAG + 'start task'); this.startLinkedInfoTask(); @@ -315,7 +318,8 @@ struct WifiPsd { }); WifiModel.refreshApScanResults(); } - if (result.connState === 6) { + if (result.connState === 6 && this.toConnected) { + this.toConnected = false; this.connectDialog.close() this.failedDialog.open() WifiModel.removeDeviceConfig(this.tobeConnectedAp); diff --git a/product/phone/src/main/resources/base/element/color.json b/product/phone/src/main/resources/base/element/color.json index 875842df..6fc2ac4f 100644 --- a/product/phone/src/main/resources/base/element/color.json +++ b/product/phone/src/main/resources/base/element/color.json @@ -44,6 +44,10 @@ "name": "font_color_007DFF", "value": "#007DFF" }, + { + "name": "toggle_selected_color_007DFF", + "value": "#007DFF" + }, { "name": "search_no_result_text_color", "value": "$color:font_color_182431" diff --git a/product/phone/src/main/resources/base/element/float.json b/product/phone/src/main/resources/base/element/float.json index f716b37b..1c64da3f 100644 --- a/product/phone/src/main/resources/base/element/float.json +++ b/product/phone/src/main/resources/base/element/float.json @@ -188,10 +188,6 @@ "name": "wh_value_200", "value": "200vp" }, - { - "name": "wh_value_208", - "value": "208vp" - }, { "name": "wh_value_210", "value": "210vp" @@ -220,10 +216,6 @@ "name": "wh_value_280", "value": "280vp" }, - { - "name": "wh_value_298", - "value": "298vp" - }, { "name": "wh_value_336", "value": "336vp" @@ -416,10 +408,6 @@ "name": "distance_26", "value": "26vp" }, - { - "name": "distance_27_5", - "value": "27.5vp" - }, { "name": "distance_30", "value": "30vp" diff --git a/product/phone/src/main/resources/en_US/element/string.json b/product/phone/src/main/resources/en_US/element/string.json index 4c629f3e..913797e0 100644 --- a/product/phone/src/main/resources/en_US/element/string.json +++ b/product/phone/src/main/resources/en_US/element/string.json @@ -462,7 +462,7 @@ }, { "name": "isCreatingUser", - "value": "正在创建..." + "value": "Is Creating User..." }, { "name": "isRemoving", @@ -817,7 +817,7 @@ "value": "Brightness" }, { - "name": "Screen", + "name": "screen", "value": "Screen" }, { @@ -1032,6 +1032,10 @@ "name": "softwareUpdateFailed", "value": "Software update startup failed, please make sure the function is available." }, + { + "name": "add", + "value": "Add" + }, { "name": "MANAGE_LOCAL_ACCOUNTS", "value": "MANAGE LOCAL ACCOUNTS" diff --git a/product/phone/src/main/resources/phone/element/float.json b/product/phone/src/main/resources/phone/element/float.json index 75ce60c4..3530e889 100644 --- a/product/phone/src/main/resources/phone/element/float.json +++ b/product/phone/src/main/resources/phone/element/float.json @@ -995,6 +995,10 @@ { "name": "head_font_24", "value": "20vp" + }, + { + "name": "opacity_100_60", + "value": "0.6" } ] } \ No newline at end of file diff --git a/product/phone/src/main/resources/phone/element/string.json b/product/phone/src/main/resources/phone/element/string.json index 62426932..83a6f244 100644 --- a/product/phone/src/main/resources/phone/element/string.json +++ b/product/phone/src/main/resources/phone/element/string.json @@ -8,6 +8,18 @@ "name": "mainability_description", "value": "ETS_Empty Feature Ability" }, + { + "name": "moreConnectionsTab", + "value": "更多连接" + }, + { + "name": "NFC", + "value": "NFC" + }, + { + "name": "nfcTips", + "value": "若要进行移动支付、钥匙验证、碰一碰等操作,可将本设备背部触碰其他终端 NFC 感应区。" + }, { "name": "enabled", "value": "已开启" diff --git a/product/phone/src/main/resources/zh_CN/element/string.json b/product/phone/src/main/resources/zh_CN/element/string.json index c261a43f..33ad43ea 100644 --- a/product/phone/src/main/resources/zh_CN/element/string.json +++ b/product/phone/src/main/resources/zh_CN/element/string.json @@ -1036,6 +1036,10 @@ "name": "softwareUpdateFailed", "value": "软件更新启动失败,请确定该功能是否可用" }, + { + "name": "add", + "value": "添加" + }, { "name": "MANAGE_LOCAL_ACCOUNTS", "value": "管理本地帐户" -- Gitee From fcceaa9d0d46a31e90c21b825ed861aaba13bd1d Mon Sep 17 00:00:00 2001 From: weiyunxing Date: Mon, 25 Jul 2022 14:40:12 +0800 Subject: [PATCH 5/7] =?UTF-8?q?setting=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: weiyunxing --- product/phone/src/main/ets/pages/settingList.ets | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/product/phone/src/main/ets/pages/settingList.ets b/product/phone/src/main/ets/pages/settingList.ets index 3de96a5d..639b67b1 100644 --- a/product/phone/src/main/ets/pages/settingList.ets +++ b/product/phone/src/main/ets/pages/settingList.ets @@ -652,12 +652,10 @@ struct bluetoothItemComponent { aboutToAppear() { LogUtil.info('settings SettingList bluetoothItem aboutToAppear in'); this.bluetoothIsOn = BluetoothModel.isStateOn(); - LogUtil.info('settings SettingList bluetoothItem aboutToAppear end'); - } - onPageShow(){ BluetoothModel.subscribeStateChange((isOn: boolean) => { AppStorage.SetOrCreate('bluetoothIsOn', isOn); }); + LogUtil.info('settings SettingList bluetoothItem aboutToAppear end'); } aboutToDisappear() { -- Gitee From a5fea82ea09471a48d5f167d479a283ee17e1d24 Mon Sep 17 00:00:00 2001 From: weiyunxing Date: Tue, 26 Jul 2022 12:54:55 +0800 Subject: [PATCH 6/7] =?UTF-8?q?setting=20=E5=A4=9A=E5=B7=A5=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: weiyunxing --- .../main/ets/default/doubleLineComponent.ets | 1 - .../appManagementImpl/AppManagementModel.ts | 23 ++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/common/component/src/main/ets/default/doubleLineComponent.ets b/common/component/src/main/ets/default/doubleLineComponent.ets index 95cf0fb9..c83d67f8 100644 --- a/common/component/src/main/ets/default/doubleLineComponent.ets +++ b/common/component/src/main/ets/default/doubleLineComponent.ets @@ -42,7 +42,6 @@ export default struct DoubleLineComponent { .width(this.image_wh) .height(this.image_wh) .margin({ right: $r('app.float.wh_value_16') }) - .visibility('' === this.settingIcon ? Visibility.None : Visibility.Visible) .objectFit(ImageFit.Contain); Column() { diff --git a/product/phone/src/main/ets/model/appManagementImpl/AppManagementModel.ts b/product/phone/src/main/ets/model/appManagementImpl/AppManagementModel.ts index c69109b8..efffda74 100644 --- a/product/phone/src/main/ets/model/appManagementImpl/AppManagementModel.ts +++ b/product/phone/src/main/ets/model/appManagementImpl/AppManagementModel.ts @@ -37,14 +37,21 @@ export class AppManagementModel extends BaseModel { constructor() { super(); - globalThis.settingsAbilityContext.resourceManager.getMediaBase64(icon_default) - .then((res) => { - icon_default_str = res; - LogUtil.info('settings AppManagementModel getResourceManager init defaultIcon res:' + icon_default_str); - }) - .catch((err) => { - LogUtil.info('settings AppManagementModel getResourceManager init defaultIcon error:' + err); - }); + try { + globalThis.settingsAbilityContext.resourceManager.getMediaBase64(icon_default) + .then((res) => { + icon_default_str = res; + LogUtil.info('settings AppManagementModel getResourceManager init defaultIcon res:' + icon_default_str); + }) + .catch((err) => { + icon_default_str = ""; + LogUtil.info('settings AppManagementModel getResourceManager init defaultIcon error:' + err); + }); + } catch (err) { + icon_default_str = ""; + LogUtil.info('settings AppManagementModel getResourceManager init defaultIcon error:' + err); + } + } /** * get application data -- Gitee From 79202e0eefbb910e94e93a7fbb3caabaa15186f3 Mon Sep 17 00:00:00 2001 From: chenqi Date: Fri, 29 Jul 2022 16:35:34 +0800 Subject: [PATCH 7/7] =?UTF-8?q?update=20bata2=20code,=E5=B1=8F=E8=94=BDNFC?= =?UTF-8?q?=E5=85=A5=E5=8F=A3=EF=BC=8C=E5=9B=9E=E9=80=80build.gn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chenqi --- napi/settings/BUILD.gn | 2 +- product/phone/src/main/ets/pages/settingList.ets | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/napi/settings/BUILD.gn b/napi/settings/BUILD.gn index c395af5f..c25bd3d9 100644 --- a/napi/settings/BUILD.gn +++ b/napi/settings/BUILD.gn @@ -30,6 +30,7 @@ ohos_shared_library("settings") { "//foundation/ability/ability_runtime/frameworks/native/ability/native:data_ability_helper", "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager:ability_manager", "//foundation/arkui/napi:ace_napi", + "//foundation/distributeddatamgr/appdatamgr/relational_store/interfaces/inner_api/rdb:native_rdb", ] external_deps = [ @@ -37,7 +38,6 @@ ohos_shared_library("settings") { "bundle_framework:appexecfwk_base", "hiviewdfx_hilog_native:libhilog", "relational_store:native_dataability", - "relational_store:native_rdb", "utils_base:utils", ] diff --git a/product/phone/src/main/ets/pages/settingList.ets b/product/phone/src/main/ets/pages/settingList.ets index 639b67b1..41a87d0f 100644 --- a/product/phone/src/main/ets/pages/settingList.ets +++ b/product/phone/src/main/ets/pages/settingList.ets @@ -281,7 +281,8 @@ struct EntryComponent { @State isPhone: boolean = false; aboutToAppear() { - let info: string = parameter.getSync("const.SystemCapability.Communication.NFC.Core" ,"false"); +// let info: string = parameter.getSync("const.SystemCapability.Communication.NFC.Core" ,"false"); + let info = 'false' if (info === 'true') { this.nfcInfo = true; } else { -- Gitee