From e1478d15cbb0fbc19bc974181bac8099f7571115 Mon Sep 17 00:00:00 2001 From: dengxiaoyu Date: Thu, 13 Feb 2025 14:28:59 +0800 Subject: [PATCH 1/2] open switch in private Signed-off-by: dengxiaoyu --- application/AppScope/app.json | 4 +- application/AppScope/app.json5 | 4 +- .../src/main/ets/pages/ContinueSwitch.ets | 37 ------------------- 3 files changed, 4 insertions(+), 41 deletions(-) diff --git a/application/AppScope/app.json b/application/AppScope/app.json index 5ead3fcf..5c71f73b 100644 --- a/application/AppScope/app.json +++ b/application/AppScope/app.json @@ -2,8 +2,8 @@ "app": { "bundleName": "com.ohos.dhardwareui", "vendor": "example", - "versionCode": 10000035, - "versionName": "1.0.35", + "versionCode": 10000036, + "versionName": "1.0.36", "icon": "$media:app_icon", "label": "$string:app_name", "minAPIVersion": 12, diff --git a/application/AppScope/app.json5 b/application/AppScope/app.json5 index d626d03b..60f44fc7 100644 --- a/application/AppScope/app.json5 +++ b/application/AppScope/app.json5 @@ -16,8 +16,8 @@ "app": { "bundleName": "com.ohos.dhardwareui", "vendor": "example", - "versionCode": 10000035, - "versionName": "1.0.35", + "versionCode": 10000036, + "versionName": "1.0.36", "icon": "$media:app_icon", "label": "$string:app_name", "minAPIVersion": 12, diff --git a/application/entry/src/main/ets/pages/ContinueSwitch.ets b/application/entry/src/main/ets/pages/ContinueSwitch.ets index b1533a24..c8519019 100644 --- a/application/entry/src/main/ets/pages/ContinueSwitch.ets +++ b/application/entry/src/main/ets/pages/ContinueSwitch.ets @@ -24,7 +24,6 @@ import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant'; import CommonConstants, { FontSizeScale } from '../common/constants/CommonConstants'; import { logger } from '../utils/Logger'; import { TipsJumpUtils } from '../utils/TipsJumpUtils'; -import osAccount from '@ohos.account.osAccount'; import systemParameterEnhance from '@ohos.systemParameterEnhance'; import i18n from '@ohos.i18n'; import { LengthMetrics } from '@ohos.arkui.node'; @@ -86,7 +85,6 @@ struct ContinueSwitch { private scroller: Scroller = new Scroller(); private learnMore: ResourceStr = $r('app.string.learn_more'); private continueDesc: ResourceStr = $r('app.string.continue_desc_text', ''); - private accountManager: osAccount.AccountManager = osAccount.getAccountManager(); private startReason?: string = ''; private isSmallFoldProduct: boolean = DeviceUtil.isSmallFoldProduct(); @@ -181,40 +179,6 @@ struct ContinueSwitch { logger.info(`${TAG} this.gapLength : ${this.gapLength}`); } - getForegroundOsAccountLocalId(): void { - logger.info(`${TAG} getForegroundOsAccountLocalId in`); - try { - this.accountManager.getForegroundOsAccountLocalId().then((localId: number) => { - logger.info(`${TAG} getForegroundOsAccountLocalId, localId: ${localId}`); - this.getAccountInfo(localId); - }).catch((err: BusinessError) => { - logger.error(`${TAG} getForegroundOsAccountLocalId errCode: ${err?.code}`); - }); - } catch (err) { - logger.error(`${TAG} getForegroundOsAccountLocalId exception: ${err?.message}`); - } - } - - getAccountInfo(localId: number): void { - logger.info(`${TAG} getAccountInfo in`); - try { - this.accountManager.queryOsAccountById(localId).then((accountInfo: osAccount.OsAccountInfo) => { - logger.info(`${TAG} queryOsAccountById, accountInfo.type: ${accountInfo.type}`); - if (accountInfo.type === osAccount.OsAccountType.PRIVATE) { - let status: boolean = settings.setValueSync(context, CommonConstants.CONTINUE_SWITCH_KEY, switchState.close, - settings.domainName.USER_SECURITY); - this.isSwitchOn = false; - this.isEnabled = false; - logger.info(`${TAG} set value isSuccess : status = ${status}; set:Continue_Switch_Status is 0`); - } - }).catch((err: BusinessError) => { - logger.error(`${TAG} queryOsAccountById errCode: ${err?.code}`); - }); - } catch (err) { - logger.error(`${TAG} queryOsAccountById exception: ${err?.message}`); - } - } - initSwitchStatus(): void { logger.info(`${TAG} initSwitchStatus in`); try { @@ -253,7 +217,6 @@ struct ContinueSwitch { this.initSwitchStatus(); this.getStringSync(); this.getImageArray(); - this.getForegroundOsAccountLocalId(); this.listener.on('change', (mediaQueryResult: mediaQuery.MediaQueryResult) => { this.onPortrait(mediaQueryResult); }) -- Gitee From a9d181287f9af9ee44daac5974650e05abf77bf6 Mon Sep 17 00:00:00 2001 From: dengxiaoyu Date: Fri, 14 Feb 2025 02:01:28 +0000 Subject: [PATCH 2/2] update application/entry/src/main/ets/pages/ContinueSwitch.ets. Signed-off-by: dengxiaoyu --- application/entry/src/main/ets/pages/ContinueSwitch.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/entry/src/main/ets/pages/ContinueSwitch.ets b/application/entry/src/main/ets/pages/ContinueSwitch.ets index c8519019..007d150c 100644 --- a/application/entry/src/main/ets/pages/ContinueSwitch.ets +++ b/application/entry/src/main/ets/pages/ContinueSwitch.ets @@ -474,7 +474,7 @@ struct ContinueSwitch { try { let displayInfo: display.Display | undefined = display.getDefaultDisplaySync(); if (displayInfo) { - halfHeight = px2vp(displayInfo.height / 2); + halfHeight = !this.is2in1 && displayInfo.height > 0 ? px2vp(displayInfo.height / 2) : (newArea.height / 2); logger.info(`${TAG} display: halfHeight = ${halfHeight}`); } } catch (error) { -- Gitee