From 3e504c5bbdc4b8d26e19fceba06093c98ccf8d25 Mon Sep 17 00:00:00 2001 From: dengxiaoyu Date: Wed, 5 Feb 2025 11:25:08 +0800 Subject: [PATCH] open switch in private space 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 e3c09a7e..5ead3fcf 100644 --- a/application/AppScope/app.json +++ b/application/AppScope/app.json @@ -2,8 +2,8 @@ "app": { "bundleName": "com.ohos.dhardwareui", "vendor": "example", - "versionCode": 10000034, - "versionName": "1.0.34", + "versionCode": 10000035, + "versionName": "1.0.35", "icon": "$media:app_icon", "label": "$string:app_name", "minAPIVersion": 12, diff --git a/application/AppScope/app.json5 b/application/AppScope/app.json5 index e969d9a1..d626d03b 100644 --- a/application/AppScope/app.json5 +++ b/application/AppScope/app.json5 @@ -16,8 +16,8 @@ "app": { "bundleName": "com.ohos.dhardwareui", "vendor": "example", - "versionCode": 10000034, - "versionName": "1.0.34", + "versionCode": 10000035, + "versionName": "1.0.35", "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 6e5f95e3..bcbf0e99 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'; @@ -85,7 +84,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 = ''; onPortrait(mediaQueryResult: mediaQuery.MediaQueryResult): void { @@ -179,40 +177,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 { @@ -251,7 +215,6 @@ struct ContinueSwitch { this.initSwitchStatus(); this.getStringSync(); this.getImageArray(); - this.getForegroundOsAccountLocalId(); this.listener.on('change', (mediaQueryResult: mediaQuery.MediaQueryResult) => { this.onPortrait(mediaQueryResult); }) -- Gitee