From bc219dd450f9ef687b88546f10bb316bf172f8be Mon Sep 17 00:00:00 2001 From: liuziweicom Date: Wed, 30 Aug 2023 13:05:12 +0800 Subject: [PATCH] fix code Signed-off-by: liuziweicom --- .../main/ets/common/components/FullScreen.ets | 664 +++++++++++------- .../ets/common/components/NumkeyBoard.ets | 15 +- .../main/ets/common/components/PassWord.ets | 116 +-- .../ets/common/components/SixPassword.ets | 174 +++-- entry/src/main/ets/common/utils/FuncUtils.ts | 2 +- .../ets/pages/components/CustomPassword.ets | 7 +- .../main/ets/pages/components/FaceAuth.ets | 288 +++++--- .../ets/pages/components/FingerprintAuth.ets | 138 ++-- .../ets/pages/components/PasswordAuth.ets | 2 +- .../main/resources/base/element/float.json | 48 ++ .../main/resources/base/element/string.json | 4 + .../main/resources/en_US/element/string.json | 4 + .../main/resources/zh_CN/element/string.json | 4 + .../resources/base/element/float.json | 16 + .../resources/base/element/string.json | 4 + .../resources/en_US/element/string.json | 4 + .../resources/zh_CN/element/string.json | 4 + 17 files changed, 986 insertions(+), 508 deletions(-) diff --git a/entry/src/main/ets/common/components/FullScreen.ets b/entry/src/main/ets/common/components/FullScreen.ets index 5b0f9e4..53e5e1c 100644 --- a/entry/src/main/ets/common/components/FullScreen.ets +++ b/entry/src/main/ets/common/components/FullScreen.ets @@ -37,10 +37,18 @@ const AUTH_TYPE_FACE = 2; const AUTH_TYPE_FINGER = 4; const PASSWORD_LENGTH = 4; const PASSWORD_ARRAY_LENGTH = 6; -const UNDER_FINGER = 170; const NOTICE_DELAY = 50; const FINGER_SENSOR_POSITION_LINE = 0.75; const RADIUS = 2; +const PADDING_8 = 8; +const ONE_SECOND = 1000; +const CANCEL_HIGH = 40; +const BOTTOM = 72; +const MARGIN = 4; +const NUM_KEY_BOTTOM = 0.63; +const NUM_KEY_POSITION = 0.54; +const TIPS_POSITION = 0.245; +const LOCK_POSITION = 0.2675; interface ControlType { isSixPassword?: boolean, @@ -81,6 +89,7 @@ export default struct FullScreen { .getStringSync($r('app.string.unified_authwidget_hint_inscreen_fp')); @StorageLink('screenLockDirection') screenLockDirection: number = 1; @StorageLink('SYSTEM_STATUS_BAR_HEIGHT') SYSTEM_STATUS_BAR_HEIGHT: number = 0; + @StorageLink('SYSTEM_NAVIGATION_BAR_HEIGHT') SYSTEM_NAVIGATION_BAR_HEIGHT: number = 0; @State controlType: ControlType = { jumpFinger: false, isLandscape: false, @@ -166,8 +175,6 @@ export default struct FullScreen { if (sensorInfo && JSON.stringify(sensorInfo) !== '{}') { sensor = JSON.parse(sensorInfo); this.fingerPosition = sensor || { sensorType: '' }; - const displayClass = display.getDefaultDisplaySync(); - this.screen = [displayClass.width, displayClass.height]; } if (remainAttempts && result !== 0) { if (this.controlType.jumpFinger) { @@ -185,9 +192,14 @@ export default struct FullScreen { this.prompt = globalThis.context.resourceManager .getStringSync($r('app.string.unified_authwidget_hint_fp_retry_s2')); } - let tempPositionLine = sensor.udSensorCenterYInThousandth / this.screen[1]; - FuncUtils.judgmentOverflow(tempPositionLine); - if (num === 'first' && tempPositionLine > FINGER_SENSOR_POSITION_LINE && result != 0) { + + this.fingerButtonPositionY = px2vp(this.fingerPosition.udSensorCenterYInThousandth / THOUSANDTH * this.screen[1]); + FuncUtils.judgmentOverflow(this.fingerButtonPositionY); + this.fingerPositionY = this.fingerButtonPositionY - this.SYSTEM_STATUS_BAR_HEIGHT + - px2vp(this.fingerPosition.udSensorRadiusInPx * RADIUS); + this.fingerPositionLine = this.fingerPositionY / px2vp(this.screen[1]); + FuncUtils.judgmentOverflow(this.fingerPositionLine); + if (num === 'first' && this.fingerPositionLine > FINGER_SENSOR_POSITION_LINE && result != 0) { AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypeFinger]); } } @@ -221,28 +233,28 @@ export default struct FullScreen { aboutToAppear(): void { LogUtils.debug(TAG, 'aboutToAppear'); try { + const displayClass = display.getDefaultDisplaySync(); + this.screen = [displayClass.width, displayClass.height]; AppStorage.SetOrCreate('passwordArray', []); if (this.cmdData && this.cmdData.length > 0) { this.onCmdDataChange('first'); } if (this.controlType.isShowFinger) { - this.fingerPositionLine = this.fingerPosition.udSensorCenterYInThousandth / this.screen[1]; - FuncUtils.judgmentOverflow(this.fingerPositionLine); let tempPosition = px2vp(this.fingerPosition.udSensorCenterYInThousandth * this.screen[1]); FuncUtils.judgmentOverflow(tempPosition); this.fingerButtonPositionY = tempPosition / THOUSANDTH; FuncUtils.judgmentOverflow(this.fingerButtonPositionY); this.fingerPositionY = this.fingerButtonPositionY - this.SYSTEM_STATUS_BAR_HEIGHT - - this.SYSTEM_STATUS_BAR_HEIGHT - px2vp(this.fingerPosition.udSensorRadiusInPx * RADIUS); + - this.SYSTEM_STATUS_BAR_HEIGHT - px2vp(this.fingerPosition.udSensorRadiusInPx * RADIUS) - PADDING_8; FuncUtils.judgmentOverflow(this.fingerPositionY); this.fingerTipsPositionY = this.fingerButtonPositionY - px2vp(FINGER_Y_POSITION) - FINGER_HIGH - - this.SYSTEM_STATUS_BAR_HEIGHT - px2vp(this.fingerPosition.udSensorRadiusInPx * RADIUS); + - this.SYSTEM_STATUS_BAR_HEIGHT - px2vp(this.fingerPosition.udSensorRadiusInPx * RADIUS) - PADDING_8; FuncUtils.judgmentOverflow(this.fingerTipsPositionY); this.fingerTextPositionY = this.fingerButtonPositionY - px2vp(FINGER_Y_POSITION) - FINGER_TEXT_POSITION - - this.SYSTEM_STATUS_BAR_HEIGHT - px2vp(this.fingerPosition.udSensorRadiusInPx * RADIUS); + - this.SYSTEM_STATUS_BAR_HEIGHT - px2vp(this.fingerPosition.udSensorRadiusInPx * RADIUS) - PADDING_8; FuncUtils.judgmentOverflow(this.fingerTextPositionY); } @@ -274,11 +286,12 @@ export default struct FullScreen { countdown(freezingTime): void { const TRY_AGAIN = globalThis.context.resourceManager.getStringSync($r('app.string.unified_authwidget_postretry')); + const PLEASE_TRY = globalThis.context.resourceManager.getStringSync($r('app.string.unified_authwidget_pleaseretry')); let promptText: string = ''; let freezingMillisecond = freezingTime; if (freezingMillisecond > 0) { promptText = TimeUtils.getFreezingTimeNm(freezingMillisecond, globalThis.context); - promptText += TRY_AGAIN; + promptText =PLEASE_TRY + promptText + TRY_AGAIN; setTimeout(this.countdown.bind(this), INTERVAL, freezingTime - INTERVAL); } else { promptText = globalThis.context.resourceManager.getStringSync($r('app.string.unified_authwidget_use_pwd')); @@ -298,147 +311,192 @@ export default struct FullScreen { build() { if (!this.controlType.jumpFinger) { Column() { - Column() { - // 1: pin lock - if (this.pinLock === 1) { + + // 1: pin lock + if(this.pinLock === 1) { + Column() { Text($r('app.string.unified_authwidget_locked')) .draggable(false) .margin({ bottom: $r('app.float.content_padding') }) .fontColor($r('sys.color.ohos_id_color_text_primary_contrary')) .fontSize($r('sys.float.ohos_id_text_size_headline6')) .fontWeight(FontWeight.Medium) - } else if (this.controlType.isShowFace) { - Image($r('app.media.white_faceID')) + Text(this.prompt) .draggable(false) - .id('faceImgCustomPwd') - .width($r('app.float.image_small')) - .height($r('app.float.image_small')) - .margin({ bottom: $r('app.float.content_padding') }) + .id('cancelIconCustomPassword') + .fontSize($r('sys.float.ohos_id_text_size_body2')) + .fontWeight(FontWeight.Medium) + .fontColor($r('sys.color.ohos_id_color_text_secondary_contrary')) + .margin({ bottom: $r('app.float.margin_16') }) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .height($r('app.float.size_24')) + Button(($r('app.string.unified_authwidget_forgotpwd')), { + stateEffect: false + }) + .id('forgotBtnCustomPwd') + .height($r('app.float.text_high')) + .backgroundColor(Color.Transparent) + .fontColor($r('sys.color.ohos_id_color_text_primary_activated')) + .fontSize($r('sys.float.ohos_id_text_size_button1')) + .fontWeight(FontWeight.Medium) .onClick(() => { - if (!this.faceFingerLockArr[0]) { + let str = this.passwordArrayNumber.toString() + this.textValue = str.replace(/,/g, ''); + }) + .visibility(Visibility.Hidden) + } + .position({ y: px2vp(this.screen[1] * LOCK_POSITION) - CANCEL_HIGH - this.SYSTEM_STATUS_BAR_HEIGHT}) + .width(Constants.fullContainerWidth) + } else { + Column() { + if (this.controlType.isShowFace) { + Image($r('app.media.white_faceID')) + .draggable(false) + .id('faceImgCustomPwd') + .width($r('app.float.image_small')) + .height($r('app.float.image_small')) + .margin({ bottom: $r('app.float.content_padding') }) + .onClick(() => { + if (!this.faceFingerLockArr[0]) { + this.prompt = globalThis.context.resourceManager + .getStringSync($r('app.string.unified_authwidget_hint_recognition')); + AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypeFace]); + } else { + this.prompt = globalThis.context.resourceManager + .getStringSync($r('app.string.unified_authwidget_title_face_forbidden')); + } + }) + } + if (!this.controlType.isShowFace) { + Text() + .draggable(false) + .width($r('app.float.image_small')) + .height($r('app.float.image_small')) + .margin({ bottom: $r('app.float.content_padding') }) + } + Text(this.prompt) + .draggable(false) + .id('cancelIconCustomPassword') + .fontSize($r('sys.float.ohos_id_text_size_body1')) + .fontWeight(FontWeight.Medium) + .fontColor($r('sys.color.ohos_id_color_text_primary_contrary')) + .margin({ bottom: $r('app.float.margin_16') }) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .height($r('app.float.size_24')) + .onClick(() => { + if (this.prompt === globalThis.context.resourceManager + .getStringSync($r('app.string.unified_authwidget_hint_face_verify_fail_click_retry_s1'))) { this.prompt = globalThis.context.resourceManager .getStringSync($r('app.string.unified_authwidget_hint_recognition')); AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypeFace]); - } else { - this.prompt = globalThis.context.resourceManager - .getStringSync($r('app.string.unified_authwidget_title_face_forbidden')); } }) - } else if (!this.controlType.isShowFace) { - Column() { - } - .width($r('app.float.image_small')) - .height($r('app.float.image_small')) - .margin({ bottom: $r('app.float.content_padding') }) - } - Text(this.prompt) - .draggable(false) - .id('cancelIconCustomPassword') - .fontSize(this.pinLock === 0 - ? $r('sys.float.ohos_id_text_size_body1') - : $r('sys.float.ohos_id_text_size_body2')) - .fontWeight(FontWeight.Medium) - .fontColor(this.pinLock === 0 - ? $r('sys.color.ohos_id_color_text_primary_contrary') - : $r('sys.color.ohos_id_color_text_secondary_contrary')) - .margin({ bottom: $r('app.float.margin_16') }) - .textAlign(TextAlign.Center) - .textOverflow({ overflow: TextOverflow.None }) - .height($r('app.float.size_24')) - .onClick(() => { - if (this.prompt === globalThis.context.resourceManager - .getStringSync($r('app.string.unified_authwidget_hint_face_verify_fail_click_retry_s1'))) { - this.prompt = globalThis.context.resourceManager - .getStringSync($r('app.string.unified_authwidget_hint_recognition')); - AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypeFace]); - } - }) - Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - // 0: pin unlock - if (this.pinLock === 0) { - if (this.pinSubType === Constants.pinSix) { - Stack() { - List() { - ForEach(this.passwordArray, item => { - if ((!item || item === '') && item !== 0) { - ListItem() { - Button() - .border({ - color: Color.White, - style: BorderStyle.Solid, - width: 1 - }) - .borderRadius($r('app.float.input_btn_size')) - .width($r('app.float.input_btn_size')) - .height($r('app.float.input_btn_size')) - .type(ButtonType.Circle) - .backgroundColor(Color.Transparent) - } - .margin({ - left: $r('app.float.margin_12'), - right: $r('app.float.margin_12'), - top: $r('app.float.margin_14') - }) - } else { - ListItem() { - Button() - .borderRadius($r('app.float.input_btn_size')) - .width($r('app.float.input_btn_size')) - .height($r('app.float.input_btn_size')) - .type(ButtonType.Circle) - .backgroundColor($r('sys.color.ohos_id_color_text_primary_contrary')) + Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + // 0: pin unlock + if (this.pinLock === 0) { + if (this.pinSubType === Constants.pinSix) { + Stack() { + List() { + ForEach(this.passwordArray, item => { + if ((!item || item === '') && item !== 0) { + ListItem() { + Button() + .border({ + color: Color.White, + style: BorderStyle.Solid, + width: 1 + }) + .borderRadius($r('app.float.input_btn_size')) + .width($r('app.float.input_btn_size')) + .height($r('app.float.input_btn_size')) + .type(ButtonType.Circle) + .backgroundColor(Color.Transparent) + } + .margin({ + left: $r('app.float.margin_12'), + right: $r('app.float.margin_12'), + top: $r('app.float.margin_14') + }) + } else { + ListItem() { + Button() + .borderRadius($r('app.float.input_btn_size')) + .width($r('app.float.input_btn_size')) + .height($r('app.float.input_btn_size')) + .type(ButtonType.Circle) + .backgroundColor($r('sys.color.ohos_id_color_text_primary_contrary')) + } + .margin({ + left: $r('app.float.margin_12'), + right: $r('app.float.margin_12'), + top: $r('app.float.margin_14') + }) } - .margin({ - left: $r('app.float.margin_12'), - right: $r('app.float.margin_12'), - top: $r('app.float.margin_14') + }) + } + .listDirection(Axis.Horizontal) + .height($r('app.float.input_height')) + + if (this.IS_LANDSCAPE) { + TextInput({ placeholder: '', text: this.passwordArray?.join('') }) + .draggable(false) + .onChange(async (value: string) => { + const arr = value?.replace(/[^\d]/g, '')?.split(''); + arr?.map((item, index) => { + this.passwordArray[index] = item; + }); + if (arr?.length === SIX_MAX_LENGTH) { + this.textValue = arr?.join(''); + AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypePin]); + } }) - } - }) + .maxLength(SIX_MAX_LENGTH) + .visibility(Visibility.Visible) + .opacity(0) + .caretColor('transparent') + } } - .listDirection(Axis.Horizontal) - .height($r('app.float.input_height')) - if (this.IS_LANDSCAPE) { - TextInput({ placeholder: '', text: this.passwordArray?.join('') }) + } else if (this.pinSubType === Constants.pinNumber) { + Stack() { + TextInput({ placeholder: '', text: this.passwordArrayNumber.join('') }) .draggable(false) .onChange(async (value: string) => { - const arr = value?.replace(/[^\d]/g, '')?.split(''); - arr?.map((item, index) => { - this.passwordArray[index] = item; - }); - if (arr?.length === SIX_MAX_LENGTH) { - this.textValue = arr?.join(''); - AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypePin]); + // Removes non-numeric characters from a string + this.passwordArrayNumber = value.replace(/[^\d]/g, '').split(''); + }) + .id('pinInputNumber') + .onSubmit(async (enterKey: EnterKeyType) => { + let str = this.passwordArrayNumber.toString(); + this.textValue = str.replace(/,/g, ''); + if (this.passwordArrayNumber.length < PASSWORD_LENGTH) { + return; } + const strData = this.passwordArrayNumber.toString(); + this.textValue = strData.replace(/,/g, ''); + AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypePin]); + }) + .fontColor(Color.White) + .height($r('app.float.btn_height')) + .width($r('app.float.fullScreen_input_width')) + .type(InputType.Password) + .copyOption(CopyOptions.None) + .fontSize($r('sys.float.ohos_id_text_size_body1')) + .fontWeight(FontWeight.Regular) + .maxLength(MAX_LENGTH) + .backgroundColor('rgba(255,255,255,0.2)') + .textAlign(TextAlign.Start) + .margin({ + left: $r('app.float.custom_password_input_margin'), + right: $r('app.float.custom_password_input_margin') }) - .maxLength(SIX_MAX_LENGTH) - .visibility(Visibility.Visible) - .opacity(0) - .caretColor('transparent') } - } - - } else if (this.pinSubType === Constants.pinNumber) { - Stack() { - TextInput({ placeholder: '', text: this.passwordArrayNumber.join('') }) + } else if (this.pinSubType === Constants.pinMixed) { + TextInput({ text: this.passwordObj }) .draggable(false) - .onChange(async (value: string) => { - // Removes non-numeric characters from a string - this.passwordArrayNumber = value.replace(/[^\d]/g, '').split(''); - }) - .id('pinInputNumber') - .onSubmit(async (enterKey: EnterKeyType) => { - let str = this.passwordArrayNumber.toString(); - this.textValue = str.replace(/,/g, ''); - if (this.passwordArrayNumber.length < PASSWORD_LENGTH) { - return; - } - const strData = this.passwordArrayNumber.toString(); - this.textValue = strData.replace(/,/g, ''); - AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypePin]); - }) .fontColor(Color.White) .height($r('app.float.btn_height')) .width($r('app.float.fullScreen_input_width')) @@ -453,119 +511,220 @@ export default struct FullScreen { left: $r('app.float.custom_password_input_margin'), right: $r('app.float.custom_password_input_margin') }) + .onSubmit(async (enterKey: EnterKeyType) => { + // check callback + if (this.passwordObj.length < PASSWORD_LENGTH) { + return; + } + this.textValue = this.passwordObj; + AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypePin]); + }) + .onChange((value: string) => { + this.passwordObj = value; + }) + .id('pinInput') } - } else if (this.pinSubType === Constants.pinMixed) { - TextInput({ text: this.passwordObj }) - .draggable(false) - .fontColor(Color.White) - .height($r('app.float.btn_height')) - .width($r('app.float.fullScreen_input_width')) - .type(InputType.Password) - .copyOption(CopyOptions.None) - .fontSize($r('sys.float.ohos_id_text_size_body1')) - .fontWeight(FontWeight.Regular) - .maxLength(MAX_LENGTH) - .backgroundColor('rgba(255,255,255,0.2)') - .textAlign(TextAlign.Start) - .margin({ - left: $r('app.float.custom_password_input_margin'), - right: $r('app.float.custom_password_input_margin') - }) - .onSubmit(async (enterKey: EnterKeyType) => { - // check callback - if (this.passwordObj.length < PASSWORD_LENGTH) { - return; - } - this.textValue = this.passwordObj; - AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypePin]); - }) - .onChange((value: string) => { - this.passwordObj = value; - }) - .id('pinInput') } } - } - .height($r('app.float.text_high')) - - Button(($r('app.string.unified_authwidget_forgotpwd')), { - stateEffect: false - }) - .id('forgotBtnCustomPwd') .height($r('app.float.text_high')) - .backgroundColor(Color.Transparent) - .fontColor($r('sys.color.ohos_id_color_text_primary_activated')) - .fontSize($r('sys.float.ohos_id_text_size_button1')) - .fontWeight(FontWeight.Medium) - .onClick(() => { - let str = this.passwordArrayNumber.toString() - this.textValue = str.replace(/,/g, ''); + Button(($r('app.string.unified_authwidget_forgotpwd')), { + stateEffect: false }) - .visibility(Visibility.Hidden) + .id('forgotBtnCustomPwd') + .height($r('app.float.text_high')) + .backgroundColor(Color.Transparent) + .fontColor($r('sys.color.ohos_id_color_text_primary_activated')) + .fontSize($r('sys.float.ohos_id_text_size_button1')) + .fontWeight(FontWeight.Medium) + .onClick(() => { + let str = this.passwordArrayNumber.toString() + this.textValue = str.replace(/,/g, ''); + }) + .visibility(Visibility.Hidden) + } + .width(Constants.fullContainerWidth) + .position({ y: px2vp(this.screen[1] * TIPS_POSITION) - CANCEL_HIGH - this.SYSTEM_STATUS_BAR_HEIGHT }) } - .width(Constants.fullContainerWidth) - .position({y:'10%'}) // 0: pin unlock - Column() { - if (!this.IS_LANDSCAPE && this.pinLock === 0 && this.pinSubType === Constants.pinSix) { - NumKeyBoard({ - onKeyPress: (index, callback) => { - let keyValue = this.numKeyboard[index].value; - if (keyValue > 0 || keyValue === 0) { - const index = this.passwordArray.map(item => item).indexOf('') - if (index > -1) { - this.passwordArray[index] = keyValue + ''; - this.numKeyboard[11].row1 = $r('app.string.unified_authwidget_delete'); - this.numKeyboard[11].value = DEL_PWD; - if (index === 5) { - this.passwordArray[index] = keyValue + ''; + if (!this.IS_LANDSCAPE && this.pinLock === 0 && this.pinSubType === Constants.pinSix) { + if (this.controlType.isShowFinger && this.fingerPosition.sensorType !== 'OUT_OF_SCREEN_SENSOR' + && this.fingerPosition.sensorType !== 'NON_SENSOR') { + if (this.fingerPositionLine > FINGER_SENSOR_POSITION_LINE) { + Column() { + NumKeyBoard({ + onKeyPress: (index, callback) => { + let keyValue = this.numKeyboard[index].value; + if (keyValue > 0 || keyValue === 0) { + const index = this.passwordArray.map(item => item).indexOf('') + if (index > -1) { + this.passwordArray[index] = keyValue + ''; + this.numKeyboard[11].row1 = $r('app.string.unified_authwidget_delete'); + this.numKeyboard[11].value = DEL_PWD; + if (index === 5) { + this.passwordArray[index] = keyValue + ''; + if (this.passwordArray.join('').length < PASSWORD_ARRAY_LENGTH) { + return; + } + let str = this.passwordArray.toString(); + this.textValue = str.replace(/,/g, ''); + AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypePin]); + } + this.updateStorage(callback); + } + } else if (keyValue === DEL_PWD) { + const index = this.passwordArray.map(item => item).indexOf(''); + if (index === -1) { + this.passwordArray[5] = ''; + } else if (index === 1) { + this.passwordArray[index - 1] = ''; + this.numKeyboard[11].value = GO_BACK; + this.numKeyboard[11].row1 = globalThis.context.resourceManager + .getStringSync($r('app.string.unified_authwidget_back')); + } else { + this.passwordArray[index - 1] = ''; + } + this.updateStorage(callback); + } else if (keyValue === GO_BACK) { + // 0: pin unlock + this.pinLock = 0; + this.clearPassword(); + globalThis.session?.terminateSelf?.(); + AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, globalThis?.wantParams?.type || []); + } else if (keyValue === CALL_PHONE) { if (this.passwordArray.join('').length < PASSWORD_ARRAY_LENGTH) { return; } + let str = this.passwordArray.toString(); this.textValue = str.replace(/,/g, ''); AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypePin]); } - this.updateStorage(callback); } - } else if (keyValue === DEL_PWD) { - const index = this.passwordArray.map(item => item).indexOf(''); - if (index === -1) { - this.passwordArray[5] = ''; - } else if (index === 1) { - this.passwordArray[index - 1] = ''; - this.numKeyboard[11].value = GO_BACK; - this.numKeyboard[11].row1 = globalThis.context.resourceManager - .getStringSync($r('app.string.unified_authwidget_back')); - } else { - this.passwordArray[index - 1] = ''; - } - this.updateStorage(callback); - } else if (keyValue === GO_BACK) { - // 0: pin unlock - this.pinLock = 0; - this.clearPassword(); - globalThis.session?.terminateSelf?.(); - AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, globalThis?.wantParams?.type || []); - } else if (keyValue === CALL_PHONE) { - if (this.passwordArray.join('').length < PASSWORD_ARRAY_LENGTH) { - return; + }) + } + .width(Constants.fullContainerWidth) + .height('37%') + .position({ y: px2vp(this.screen[1] * NUM_KEY_BOTTOM) + - CANCEL_HIGH - MARGIN - px2vp(this.fingerPosition.udSensorRadiusInPx * RADIUS) + - px2vp((THOUSANDTH - this.fingerPosition.udSensorCenterYInThousandth) / THOUSANDTH * this.screen[1]) + - this.SYSTEM_STATUS_BAR_HEIGHT }) + } else { + Column() { + NumKeyBoard({ + onKeyPress: (index, callback) => { + let keyValue = this.numKeyboard[index].value; + if (keyValue > 0 || keyValue === 0) { + const index = this.passwordArray.map(item => item).indexOf('') + if (index > -1) { + this.passwordArray[index] = keyValue + ''; + this.numKeyboard[11].row1 = $r('app.string.unified_authwidget_delete'); + this.numKeyboard[11].value = DEL_PWD; + if (index === 5) { + this.passwordArray[index] = keyValue + ''; + if (this.passwordArray.join('').length < PASSWORD_ARRAY_LENGTH) { + return; + } + let str = this.passwordArray.toString(); + this.textValue = str.replace(/,/g, ''); + AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypePin]); + } + this.updateStorage(callback); + } + } else if (keyValue === DEL_PWD) { + const index = this.passwordArray.map(item => item).indexOf(''); + if (index === -1) { + this.passwordArray[5] = ''; + } else if (index === 1) { + this.passwordArray[index - 1] = ''; + this.numKeyboard[11].value = GO_BACK; + this.numKeyboard[11].row1 = globalThis.context.resourceManager + .getStringSync($r('app.string.unified_authwidget_back')); + } else { + this.passwordArray[index - 1] = ''; + } + this.updateStorage(callback); + } else if (keyValue === GO_BACK) { + // 0: pin unlock + this.pinLock = 0; + this.clearPassword(); + globalThis.session?.terminateSelf?.(); + AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, globalThis?.wantParams?.type || []); + } else if (keyValue === CALL_PHONE) { + if (this.passwordArray.join('').length < PASSWORD_ARRAY_LENGTH) { + return; + } + let str = this.passwordArray.toString(); + this.textValue = str.replace(/,/g, ''); + AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypePin]); + } } - - let str = this.passwordArray.toString(); - this.textValue = str.replace(/,/g, ''); - AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypePin]); - } + }) } - }) + .width(Constants.fullContainerWidth) + .height('37%') + .position({ y: px2vp(this.screen[1] * NUM_KEY_BOTTOM) - CANCEL_HIGH - BOTTOM + - this.SYSTEM_STATUS_BAR_HEIGHT - this.SYSTEM_NAVIGATION_BAR_HEIGHT }) + } } else { - Text().draggable(false).height(Constants.fullContainerHeight) + Column() { + NumKeyBoard({ + onKeyPress: (index, callback) => { + let keyValue = this.numKeyboard[index].value; + if (keyValue > 0 || keyValue === 0) { + const index = this.passwordArray.map(item => item).indexOf('') + if (index > -1) { + this.passwordArray[index] = keyValue + ''; + this.numKeyboard[11].row1 = $r('app.string.unified_authwidget_delete'); + this.numKeyboard[11].value = DEL_PWD; + if (index === 5) { + this.passwordArray[index] = keyValue + ''; + if (this.passwordArray.join('').length < PASSWORD_ARRAY_LENGTH) { + return; + } + let str = this.passwordArray.toString(); + this.textValue = str.replace(/,/g, ''); + AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypePin]); + } + this.updateStorage(callback); + } + } else if (keyValue === DEL_PWD) { + const index = this.passwordArray.map(item => item).indexOf(''); + if (index === -1) { + this.passwordArray[5] = ''; + } else if (index === 1) { + this.passwordArray[index - 1] = ''; + this.numKeyboard[11].value = GO_BACK; + this.numKeyboard[11].row1 = globalThis.context.resourceManager + .getStringSync($r('app.string.unified_authwidget_back')); + } else { + this.passwordArray[index - 1] = ''; + } + this.updateStorage(callback); + } else if (keyValue === GO_BACK) { + // 0: pin unlock + this.pinLock = 0; + this.clearPassword(); + globalThis.session?.terminateSelf?.(); + AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, globalThis?.wantParams?.type || []); + } else if (keyValue === CALL_PHONE) { + if (this.passwordArray.join('').length < PASSWORD_ARRAY_LENGTH) { + return; + } + + let str = this.passwordArray.toString(); + this.textValue = str.replace(/,/g, ''); + AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypePin]); + } + } + }) + } + .width(Constants.fullContainerWidth) + .height('37%') + .position({ y: px2vp(this.screen[1] * NUM_KEY_POSITION) - CANCEL_HIGH + - this.SYSTEM_STATUS_BAR_HEIGHT }) } } - .width(Constants.fullContainerWidth) - .height('45%') - .position({y:'30%'}) // 1: pin lock if (this.controlType.isShowFinger && this.pinLock !== 1 && !this.faceFingerLockArr[1]) { @@ -587,6 +746,9 @@ export default struct FullScreen { } }) } + .position({ y: px2vp(this.fingerPosition.udSensorCenterYInThousandth / THOUSANDTH * this.screen[1]) + - px2vp(this.fingerPosition.udSensorRadiusInPx * RADIUS) + - CANCEL_HIGH - this.SYSTEM_STATUS_BAR_HEIGHT }) .width(Constants.fullContainerWidth) .height(this.controlType.isShowFinger ? $r('app.float.finger_high') : '9%') .justifyContent(FlexAlign.Start) @@ -613,17 +775,12 @@ export default struct FullScreen { .height(this.controlType.isShowFinger ? $r('app.float.finger_high') : '9%') .justifyContent(FlexAlign.Start) .alignItems(HorizontalAlign.Center) - .position({y:'75%'}) + .position({ y: px2vp(this.screen[1]) - CANCEL_HIGH - BOTTOM + - this.SYSTEM_STATUS_BAR_HEIGHT - this.SYSTEM_NAVIGATION_BAR_HEIGHT }) } } } } - if (!this.controlType.isShowFinger) { - Column() { - } - .width(Constants.fullContainerWidth) - .height(this.controlType.isShowFinger ? $r('app.float.finger_high') : '9%') - } } .alignItems(HorizontalAlign.Center) .height(Constants.fullContainerHeight) @@ -632,21 +789,30 @@ export default struct FullScreen { Column() { if (AppStorage.Get('titleLength') < globalThis.wantParams?.title.length) { Scroll() { - Text(globalThis.wantParams?.title) - .draggable(false) - .fontColor($r('sys.color.ohos_id_color_text_primary_contrary')) - .fontSize($r('sys.float.ohos_id_text_size_sub_title2')) - .fontWeight(FontWeight.Medium) + Column() { + Text(globalThis.wantParams?.title) + .draggable(false) + .fontColor($r('sys.color.ohos_id_color_text_primary_contrary')) + .fontSize($r('sys.float.ohos_id_text_size_sub_title2')) + .fontWeight(FontWeight.Medium) + Text(this.fingerText) + .draggable(false) + .height($r('app.float.text_high')) + .fontColor($r('sys.color.ohos_id_color_text_primary_contrary')) + .fontSize($r('sys.float.ohos_id_text_size_body2')) + .fontWeight(FontWeight.Regular) + .textAlign(TextAlign.Center) + .margin({ top: $r('app.float.padding_8') }) + }.margin({left: $r('app.float.margin_36'), right: $r('app.float.size_24')}) } - .width('80%') + .width('96%') .id('titleFullScreen') .position({ y: this.fingerTextPositionY, - x: '10%' }) - .height($r('app.float.textArea_height')) + .height($r('app.float.scroll_height_72')) .scrollable(ScrollDirection.Vertical) - .scrollBarColor(Color.Gray) + .scrollBarColor('sys.color.ohos_id_color_foreground') } else { Text(globalThis.wantParams?.title) .draggable(false) @@ -660,20 +826,20 @@ export default struct FullScreen { }) .width('100%') .textAlign(TextAlign.Center) + Text(this.fingerText) + .draggable(false) + .height($r('app.float.text_high')) + .fontColor($r('sys.color.ohos_id_color_text_secondary_contrary')) + .fontSize($r('sys.float.ohos_id_text_size_body2')) + .fontWeight(FontWeight.Regular) + .position({ + y: this.fingerTipsPositionY + }) + .width('100%') + .textAlign(TextAlign.Center) + .margin({ top: $r('app.float.padding_8') }) } - Text(this.fingerText) - .draggable(false) - .height($r('app.float.text_high')) - .fontColor($r('sys.color.ohos_id_color_text_secondary_contrary')) - .fontSize($r('sys.float.ohos_id_text_size_body2')) - .fontWeight(FontWeight.Regular) - .position({ - y: this.fingerTipsPositionY - }) - .width('100%') - .textAlign(TextAlign.Center) - .margin({ top: $r('app.float.padding_8') }) Column() { Image($r('app.media.ic_unlock_fingerprint')) .draggable(false) diff --git a/entry/src/main/ets/common/components/NumkeyBoard.ets b/entry/src/main/ets/common/components/NumkeyBoard.ets index 1c13460..718ab58 100644 --- a/entry/src/main/ets/common/components/NumkeyBoard.ets +++ b/entry/src/main/ets/common/components/NumkeyBoard.ets @@ -44,7 +44,9 @@ export default struct NumKeyBoard { Text(item.row1) .draggable(false) .id('textNumKeyBordCustomPwd' + item.index) - .fontSize($r('app.float.digital_password_prompt_font_size')) + .fontSize(deviceInfo.deviceType === 'tablet' + ? $r('app.float.digital_password_prompt_font_size') + : $r('app.float.numKeyBoard_row1_16')) .fontWeight(FontWeight.Medium) .fontColor(Color.White) .textAlign(TextAlign.Center) @@ -55,7 +57,9 @@ export default struct NumKeyBoard { Text(item.row1) .draggable(false) .id('textNumKeyBordCustomPwd' + item.index) - .fontSize($r('app.float.digital_password_row1_font_size')) + .fontSize(deviceInfo.deviceType === 'tablet' + ? $r('app.float.digital_password_prompt_font_size') + : $r('app.float.numKeyBoard_row1_28')) .fontWeight(FontWeight.Medium) .fontColor(Color.White) .textAlign(TextAlign.Center) @@ -66,7 +70,9 @@ export default struct NumKeyBoard { if (!!item.row2) { Text(item.row2) .draggable(false) - .fontSize($r('app.float.digital_password_row2_font_size')) + .fontSize(deviceInfo.deviceType === 'tablet' + ? $r('app.float.digital_password_row2_font_size') + : $r('app.float.numKeyBoard_row2')) .fontWeight(FontWeight.Regular) .fontColor(Color.White) .opacity($r('app.float.numkeyBoard_text_opacity')) @@ -78,6 +84,9 @@ export default struct NumKeyBoard { } .width(Constants.fullContainerWidth) .height($r('app.float.keyboard_key_high')) + .height(deviceInfo.deviceType === 'tablet' + ? $r('app.float.keyboard_key_high') + : $r('app.float.keyboard_key_high_phone')) } if (deviceInfo.deviceType === 'tablet') { diff --git a/entry/src/main/ets/common/components/PassWord.ets b/entry/src/main/ets/common/components/PassWord.ets index cbe92c9..f73b69c 100644 --- a/entry/src/main/ets/common/components/PassWord.ets +++ b/entry/src/main/ets/common/components/PassWord.ets @@ -46,15 +46,51 @@ export default struct PassWord { Column() { if (AppStorage.Get('titleLength') < globalThis.wantParams?.title.length) { Scroll() { - Text(globalThis.wantParams?.title) - .draggable(false) - .fontSize($r('sys.float.ohos_id_text_size_body1')) - .fontColor($r('sys.color.ohos_id_color_text_primary')) - .fontWeight(FontWeight.Medium) - .id('titlePwdAuth') + Column() { + Text(globalThis.wantParams?.title) + .draggable(false) + .fontSize($r('sys.float.ohos_id_text_size_body1')) + .fontColor($r('sys.color.ohos_id_color_text_primary')) + .fontWeight(FontWeight.Medium) + .id('titlePwdAuth') + + TextInput({ + placeholder: '', + text: this.pinSubType === Constants.pinNumber ? this.passwordArrNumber.join('') : this.textValue + }) + .draggable(false) + .maxLength(MAX_LENGTH) + .enabled(this.isEdit) + .height($r('app.float.input_height')) + .type(InputType.Password) + .margin({ + top: $r('app.float.content_padding'), + left: $r('app.float.digital_password_mask_height'), + right: $r('app.float.digital_password_mask_height') + }) + .textAlign(TextAlign.Start) + .fontColor($r('sys.color.ohos_id_color_text_primary')) + .border({ + width: this.inputValue === ' ' ? '' : $r('app.float.input_border'), + color: this.inputValue === ' ' ? '' : ($r('sys.color.ohos_id_color_warning')) + }) + .onChange((value: string) => { + if (this.pinSubType === Constants.pinNumber) { + this.passwordArrNumber = value.replace(/[^\d]/g, '').split(''); + } + this.textValue = value; + }) + .id('pinInputMix') + Text(this.inputValue) + .draggable(false) + .fontSize($r('sys.float.ohos_id_text_size_body2')) + .margin({ top: $r('app.float.element_margin') }) + .fontColor($r('sys.color.ohos_id_color_warning')) + } + .margin({left: $r('app.float.size_24'), right: $r('app.float.size_24')}) } - .width('80%') - .height($r('app.float.textArea_height')) + .width('100%') + .height($r('app.float.scroll_height_88')) .margin({ top: $r('app.float.title_padding_top') }) .scrollable(ScrollDirection.Vertical) .scrollBarColor(Color.Gray) @@ -67,40 +103,40 @@ export default struct PassWord { .height($r('app.float.size_24')) .fontWeight(FontWeight.Medium) .id('titlePwdAuth') + TextInput({ + placeholder: '', + text: this.pinSubType === Constants.pinNumber ? this.passwordArrNumber.join('') : this.textValue + }) + .draggable(false) + .maxLength(MAX_LENGTH) + .enabled(this.isEdit) + .height($r('app.float.input_height')) + .type(InputType.Password) + .margin({ + top: $r('app.float.content_padding'), + left: $r('app.float.digital_password_mask_height'), + right: $r('app.float.digital_password_mask_height') + }) + .textAlign(TextAlign.Start) + .fontColor($r('sys.color.ohos_id_color_text_primary')) + .border({ + width: this.inputValue === ' ' ? '' : $r('app.float.input_border'), + color: this.inputValue === ' ' ? '' : ($r('sys.color.ohos_id_color_warning')) + }) + .onChange((value: string) => { + if (this.pinSubType === Constants.pinNumber) { + this.passwordArrNumber = value.replace(/[^\d]/g, '').split(''); + } + this.textValue = value; + }) + .id('pinInputMix') + Text(this.inputValue) + .draggable(false) + .fontSize($r('sys.float.ohos_id_text_size_body2')) + .margin({ top: $r('app.float.element_margin') }) + .fontColor($r('sys.color.ohos_id_color_warning')) } - TextInput({ - placeholder: '', - text: this.pinSubType === Constants.pinNumber ? this.passwordArrNumber.join('') : this.textValue - }) - .draggable(false) - .maxLength(MAX_LENGTH) - .enabled(this.isEdit) - .height($r('app.float.input_height')) - .type(InputType.Password) - .margin({ - top: $r('app.float.content_padding'), - left: $r('app.float.digital_password_mask_height'), - right: $r('app.float.digital_password_mask_height') - }) - .textAlign(TextAlign.Start) - .fontColor($r('sys.color.ohos_id_color_text_primary')) - .border({ - width: this.inputValue === ' ' ? '' : $r('app.float.input_border'), - color: this.inputValue === ' ' ? '' : ($r('sys.color.ohos_id_color_warning')) - }) - .onChange((value: string) => { - if (this.pinSubType === Constants.pinNumber) { - this.passwordArrNumber = value.replace(/[^\d]/g, '').split(''); - } - this.textValue = value; - }) - .id('pinInputMix') - Text(this.inputValue) - .draggable(false) - .fontSize($r('sys.float.ohos_id_text_size_body2')) - .margin({ top: $r('app.float.element_margin') }) - .fontColor($r('sys.color.ohos_id_color_warning')) } } } \ No newline at end of file diff --git a/entry/src/main/ets/common/components/SixPassword.ets b/entry/src/main/ets/common/components/SixPassword.ets index 6bc2490..183ce4c 100644 --- a/entry/src/main/ets/common/components/SixPassword.ets +++ b/entry/src/main/ets/common/components/SixPassword.ets @@ -43,14 +43,72 @@ export default struct SixPassword { Column() { if (AppStorage.Get('titleLength') < globalThis.wantParams?.title.length) { Scroll() { - Text(globalThis.wantParams?.title) - .draggable(false) - .fontSize($r('sys.float.ohos_id_text_size_body1')) - .fontColor($r('sys.color.ohos_id_color_text_primary')) - .fontWeight(FontWeight.Medium) + Column() { + Text(globalThis.wantParams?.title) + .draggable(false) + .fontSize($r('sys.float.ohos_id_text_size_body1')) + .fontColor($r('sys.color.ohos_id_color_text_primary')) + .fontWeight(FontWeight.Medium) + + Column() { + Stack() { + List({ space: 4 }) { + ForEach(['', '', '', '', '', ''], (item, index) => { + ListItem() { + Button() + .border({ + color: $r('sys.color.ohos_id_color_primary'), + style: BorderStyle.Solid, + width: this.textValue.length !== 0 && index < this.textValue.length + ? $r('app.float.button_border_width') : 1 + }) + .type(ButtonType.Circle) + .backgroundColor(Color.White) + .width($r('app.float.input_btn_size')) + .height($r('app.float.input_btn_size')) + .borderRadius($r('app.float.input_btn_size')) + .margin(index > 0 ? + { + left: $r('app.float.input_btn_padding_around'), + top: $r('app.float.margin_12') + } : { top: $r('app.float.margin_12') }) + .focusable(true) + } + }, item => item) + } + .listDirection(Axis.Horizontal) + .height($r('app.float.input_height')) + + TextInput({ placeholder: '', text: this.passwordArrayNumber?.join('') }) + .draggable(false) + .onChange(async (value: string) => { + this.passwordArrayNumber = value?.replace(/[^\d]/g, '')?.split(''); + this.textValue = this.passwordArrayNumber?.join(''); + if (this.textValue?.length === MAX_LENGTH) { + AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypePin]); + } + }) + .backgroundImageSize(ImageSize.Auto) + .enabled(this.isEdit) + .maxLength(MAX_LENGTH) + .visibility(Visibility.Visible) + .opacity(0) + .caretColor('transparent') + .id('pinSix') + } + } + .margin({ top: $r('app.float.content_padding') }) + + Text(this.inputValue) + .draggable(false) + .fontSize($r('sys.float.ohos_id_text_size_body2')) + .margin({ top: $r('app.float.element_margin') }) + .fontColor($r('sys.color.ohos_id_color_warning')) + } + .margin({left: $r('app.float.size_24'), right: $r('app.float.size_24')}) } - .width('80%') - .height($r('app.float.textArea_height')) + .width('100%') + .height($r('app.float.scroll_height_88')) .margin({ top: $r('app.float.title_padding_top') }) .scrollable(ScrollDirection.Vertical) .scrollBarColor(Color.Gray) @@ -62,62 +120,62 @@ export default struct SixPassword { .fontColor($r('sys.color.ohos_id_color_text_primary')) .height($r('app.float.size_24')) .fontWeight(FontWeight.Medium) - } + Column() { + Stack() { + List({ space: 4 }) { + ForEach(['', '', '', '', '', ''], (item, index) => { + ListItem() { + Button() + .border({ + color: $r('sys.color.ohos_id_color_primary'), + style: BorderStyle.Solid, + width: this.textValue.length !== 0 && index < this.textValue.length + ? $r('app.float.button_border_width') : 1 + }) + .type(ButtonType.Circle) + .backgroundColor(Color.White) + .width($r('app.float.input_btn_size')) + .height($r('app.float.input_btn_size')) + .borderRadius($r('app.float.input_btn_size')) + .margin(index > 0 ? + { + left: $r('app.float.input_btn_padding_around'), + top: $r('app.float.margin_12') + } : { top: $r('app.float.margin_12') }) + .focusable(true) + } + }, item => item) + } + .listDirection(Axis.Horizontal) + .height($r('app.float.input_height')) - Column() { - Stack() { - List({ space: 4 }) { - ForEach(['', '', '', '', '', ''], (item, index) => { - ListItem() { - Button() - .border({ - color: $r('sys.color.ohos_id_color_primary'), - style: BorderStyle.Solid, - width: this.textValue.length !== 0 && index < this.textValue.length - ? $r('app.float.button_border_width') : 1 - }) - .type(ButtonType.Circle) - .backgroundColor(Color.White) - .width($r('app.float.input_btn_size')) - .height($r('app.float.input_btn_size')) - .borderRadius($r('app.float.input_btn_size')) - .margin(index > 0 ? - { - left: $r('app.float.input_btn_padding_around'), - top: $r('app.float.margin_12') - } : { top: $r('app.float.margin_12') }) - .focusable(true) - } - }, item => item) + TextInput({ placeholder: '', text: this.passwordArrayNumber?.join('') }) + .draggable(false) + .onChange(async (value: string) => { + this.passwordArrayNumber = value?.replace(/[^\d]/g, '')?.split(''); + this.textValue = this.passwordArrayNumber?.join(''); + if (this.textValue?.length === MAX_LENGTH) { + AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypePin]); + } + }) + .backgroundImageSize(ImageSize.Auto) + .enabled(this.isEdit) + .maxLength(MAX_LENGTH) + .visibility(Visibility.Visible) + .opacity(0) + .caretColor('transparent') + .id('pinSix') } - .listDirection(Axis.Horizontal) - .height($r('app.float.input_height')) - - TextInput({ placeholder: '', text: this.passwordArrayNumber?.join('') }) - .draggable(false) - .onChange(async (value: string) => { - this.passwordArrayNumber = value?.replace(/[^\d]/g, '')?.split(''); - this.textValue = this.passwordArrayNumber?.join(''); - if (this.textValue?.length === MAX_LENGTH) { - AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypePin]); - } - }) - .backgroundImageSize(ImageSize.Auto) - .enabled(this.isEdit) - .maxLength(MAX_LENGTH) - .visibility(Visibility.Visible) - .opacity(0) - .caretColor('transparent') - .id('pinSix') } + .margin({ top: $r('app.float.content_padding') }) + + Text(this.inputValue) + .draggable(false) + .fontSize($r('sys.float.ohos_id_text_size_body2')) + .margin({ top: $r('app.float.element_margin') }) + .fontColor($r('sys.color.ohos_id_color_warning')) } - .margin({ top: $r('app.float.content_padding') }) - Text(this.inputValue) - .draggable(false) - .fontSize($r('sys.float.ohos_id_text_size_body2')) - .margin({ top: $r('app.float.element_margin') }) - .fontColor($r('sys.color.ohos_id_color_warning')) } } } \ No newline at end of file diff --git a/entry/src/main/ets/common/utils/FuncUtils.ts b/entry/src/main/ets/common/utils/FuncUtils.ts index dde42d8..fa5e43b 100644 --- a/entry/src/main/ets/common/utils/FuncUtils.ts +++ b/entry/src/main/ets/common/utils/FuncUtils.ts @@ -76,7 +76,7 @@ export class FuncUtils { judgmentOverflow(value: number): void { if (value === Number.POSITIVE_INFINITY || value === Number.NEGATIVE_INFINITY) { - LogUtils.error(TAG, 'judgmentOverflow spill code value: ' + value); + LogUtils.error(TAG, 'judgmentOverflow spill code value: ' + value); globalThis.session?.terminateSelf?.(); } } diff --git a/entry/src/main/ets/pages/components/CustomPassword.ets b/entry/src/main/ets/pages/components/CustomPassword.ets index 313f96c..77b0764 100644 --- a/entry/src/main/ets/pages/components/CustomPassword.ets +++ b/entry/src/main/ets/pages/components/CustomPassword.ets @@ -26,7 +26,7 @@ const BLUR_OPACITY = 0.5; const SATURATE = 1.3; const BLUR_RADIUS = 242; const BACK_BLUR = 80; -const PADDING_ZERO = 0; +const PADDING_SIXTEEN = 16; let pinAuthManager; let pinData = ''; @@ -88,7 +88,7 @@ export default struct CustomPassword { .id('cancelImgCustomPwd') .width($r('app.float.image_back_size')) .height($r('app.float.image_back_size')) - .margin({ left: $r('sys.float.ohos_id_max_padding_start'), top: $r('app.float.content_padding') }) + .margin({ left: $r('sys.float.ohos_id_max_padding_start'), top: this.SYSTEM_STATUS_BAR_HEIGHT + PADDING_SIXTEEN }) .backgroundColor(this.isBackTouched ? $r('sys.color.ohos_id_color_hover') : Color.Transparent) .onClick(() => { @@ -126,9 +126,6 @@ export default struct CustomPassword { } } } - .padding(this.IS_LANDSCAPE - ? PADDING_ZERO - : { top: this.SYSTEM_STATUS_BAR_HEIGHT, bottom: this.SYSTEM_NAVIGATION_BAR_HEIGHT }) .justifyContent(FlexAlign.SpaceBetween) .width(Constants.fullContainerWidth) .height(Constants.fullContainerWidth) diff --git a/entry/src/main/ets/pages/components/FaceAuth.ets b/entry/src/main/ets/pages/components/FaceAuth.ets index 3e511b4..af17db1 100644 --- a/entry/src/main/ets/pages/components/FaceAuth.ets +++ b/entry/src/main/ets/pages/components/FaceAuth.ets @@ -477,43 +477,63 @@ export default struct FaceAuth { }) } - Image($r('app.media.error_faceID')) - .draggable(false) - .id('imgAllFaceAuth') - .width($r('app.float.image_small')) - .height($r('app.float.image_small')) - .margin({ top: $r('app.float.content_padding'), bottom: $r('app.float.content_padding') }) - .colorBlend($r('sys.color.ohos_id_color_activated')) - .onClick(() => { - this.sendFaceEvent(); - }) if (AppStorage.Get('titleLength') < globalThis.wantParams?.title.length) { Scroll() { - Text(globalThis.wantParams?.title) - .draggable(false) - .fontSize($r('sys.float.ohos_id_text_size_body1')) - .fontColor($r('sys.color.ohos_id_color_text_primary')) - .fontWeight(FontWeight.Medium) + Column() { + Image($r('app.media.error_faceID')) + .draggable(false) + .id('imgAllFaceAuth') + .width($r('app.float.image_small')) + .height($r('app.float.image_small')) + .margin({ bottom: $r('app.float.content_padding') }) + .colorBlend($r('sys.color.ohos_id_color_activated')) + .onClick(() => { + this.sendFaceEvent(); + }) + Text(globalThis.wantParams?.title) + .draggable(false) + .fontSize($r('sys.float.ohos_id_text_size_body1')) + .fontColor($r('sys.color.ohos_id_color_text_primary')) + .fontWeight(FontWeight.Medium) + Text(this.prompt) + .draggable(false) + .id('resetPromptTextAllFaceAuth') + .margin({ top: $r('app.float.element_margin') }) + .height($r('app.float.size_24')) + .fontSize($r('sys.float.ohos_id_text_size_body2')) + .fontColor(this.onFontColor(this.prompt, globalThis.context)) + }.margin({left: $r('app.float.size_24'), right: $r('app.float.size_24')}) } - .width('80%') - .height($r('app.float.textArea_height')) + .width('100%') + .height($r('app.float.scroll_height_122')) + .margin({top: $r('app.float.content_padding')}) .scrollable(ScrollDirection.Vertical) .scrollBarColor(Color.Gray) } else { + Image($r('app.media.error_faceID')) + .draggable(false) + .id('imgAllFaceAuth') + .width($r('app.float.image_small')) + .height($r('app.float.image_small')) + .margin({ top: $r('app.float.content_padding'), bottom: $r('app.float.content_padding') }) + .colorBlend($r('sys.color.ohos_id_color_activated')) + .onClick(() => { + this.sendFaceEvent(); + }) Text(globalThis.wantParams?.title) .draggable(false) .fontSize($r('sys.float.ohos_id_text_size_body1')) .fontColor($r('sys.color.ohos_id_color_text_primary')) .height($r('app.float.size_24')) .fontWeight(FontWeight.Medium) + Text(this.prompt) + .draggable(false) + .id('resetPromptTextAllFaceAuth') + .margin({ top: $r('app.float.element_margin') }) + .height($r('app.float.size_24')) + .fontSize($r('sys.float.ohos_id_text_size_body2')) + .fontColor(this.onFontColor(this.prompt, globalThis.context)) } - Text(this.prompt) - .draggable(false) - .id('resetPromptTextAllFaceAuth') - .margin({ top: $r('app.float.element_margin') }) - .height($r('app.float.size_24')) - .fontSize($r('sys.float.ohos_id_text_size_body2')) - .fontColor(this.onFontColor(this.prompt, globalThis.context)) Image($r('app.media.ic_blue_fingerprint')) .draggable(false) .id('blueFingerprintImgAllFaceAuth') @@ -539,30 +559,44 @@ export default struct FaceAuth { }) } else if (this.dialogTypeFlag === PIN_FACE_FINGER && this.screenType === SCREEN_LAND) { Column() { - // Facial fingerprint password, second form - Image($r('app.media.error_faceID')) - .draggable(false) - .id('errFaceImgFaceAuth') - .width($r('app.float.image_small')) - .height($r('app.float.image_small')) - .margin({ top: $r('app.float.content_padding_top'), bottom: $r('app.float.content_padding') }) - .colorBlend($r('sys.color.ohos_id_color_activated')) - .onClick(() => { - this.sendFaceEvent(); - }) if (AppStorage.Get('titleLength') < globalThis.wantParams?.title.length) { Scroll() { - Text(globalThis.wantParams?.title) - .draggable(false) - .fontSize($r('sys.float.ohos_id_text_size_body1')) - .fontColor($r('sys.color.ohos_id_color_text_primary')) - .fontWeight(FontWeight.Medium) + Column() { + // Facial fingerprint password, second form + Image($r('app.media.error_faceID')) + .draggable(false) + .id('errFaceImgFaceAuth') + .width($r('app.float.image_small')) + .height($r('app.float.image_small')) + .margin({bottom: $r('app.float.content_padding') }) + .colorBlend($r('sys.color.ohos_id_color_activated')) + .onClick(() => { + this.sendFaceEvent(); + }) + Text(globalThis.wantParams?.title) + .draggable(false) + .fontSize($r('sys.float.ohos_id_text_size_body1')) + .fontColor($r('sys.color.ohos_id_color_text_primary')) + .fontWeight(FontWeight.Medium) + }.margin({left: $r('app.float.size_24'), right: $r('app.float.size_24')}) } - .width('80%') - .height($r('app.float.textArea_height')) + .width('100%') + .height($r('app.float.scroll_height_90')) + .margin({ top: $r('app.float.content_padding_top')}) .scrollable(ScrollDirection.Vertical) .scrollBarColor(Color.Gray) } else { + // Facial fingerprint password, second form + Image($r('app.media.error_faceID')) + .draggable(false) + .id('errFaceImgFaceAuth') + .width($r('app.float.image_small')) + .height($r('app.float.image_small')) + .margin({ top: $r('app.float.content_padding_top'), bottom: $r('app.float.content_padding') }) + .colorBlend($r('sys.color.ohos_id_color_activated')) + .onClick(() => { + this.sendFaceEvent(); + }) Text(globalThis.wantParams?.title) .draggable(false) .fontSize($r('sys.float.ohos_id_text_size_body1')) @@ -570,7 +604,6 @@ export default struct FaceAuth { .height($r('app.float.size_24')) .fontWeight(FontWeight.Medium) } - Image($r('app.media.ic_blue_fingerprint')) .draggable(false) .id('blueFingerprintImgFaceAuth') @@ -653,14 +686,37 @@ export default struct FaceAuth { // Pin FACE if (AppStorage.Get('titleLength') < globalThis.wantParams?.title.length) { Scroll() { - Text(globalThis.wantParams?.title) - .draggable(false) - .fontSize($r('sys.float.ohos_id_text_size_body1')) - .fontColor($r('sys.color.ohos_id_color_text_primary')) - .fontWeight(FontWeight.Medium) + Column() { + Text(globalThis.wantParams?.title) + .draggable(false) + .fontSize($r('sys.float.ohos_id_text_size_body1')) + .fontColor($r('sys.color.ohos_id_color_text_primary')) + .fontWeight(FontWeight.Medium) + Image(this.prompt !== globalThis.context.resourceManager + .getStringSync($r('app.string.unified_authwidget_hint_recognize_success')) + ? $r('app.media.error_faceID') : $r('app.media.right_faceID')) + .draggable(false) + .margin({ + top: $r('app.float.digital_password_mask_height'), + bottom: $r('app.float.digital_password_mask_height') + }) + .width($r('app.float.image_size')) + .height($r('app.float.image_size')) + .colorBlend($r('sys.color.ohos_id_color_activated')) + .onClick(() => { + this.sendFaceEvent(); + }) + Text(this.prompt).fontSize($r('sys.float.ohos_id_text_size_body2')) + .draggable(false) + .fontColor(this.onFontColor(this.prompt, globalThis.context)) + .height($r('app.float.size_24')) + .onClick(() => { + this.sendFaceEvent(); + }) + }.margin({left: $r('app.float.size_24'), right: $r('app.float.size_24')}) } - .width('80%') - .height($r('app.float.textArea_height')) + .width('100%') + .height($r('app.float.scroll_height_182')) .margin({ top: $r('app.float.title_padding_top') }) .scrollable(ScrollDirection.Vertical) .scrollBarColor(Color.Gray) @@ -672,28 +728,28 @@ export default struct FaceAuth { .fontColor($r('sys.color.ohos_id_color_text_primary')) .height($r('app.float.size_24')) .fontWeight(FontWeight.Medium) + Image(this.prompt !== globalThis.context.resourceManager + .getStringSync($r('app.string.unified_authwidget_hint_recognize_success')) + ? $r('app.media.error_faceID') : $r('app.media.right_faceID')) + .draggable(false) + .margin({ + top: $r('app.float.digital_password_mask_height'), + bottom: $r('app.float.digital_password_mask_height') + }) + .width($r('app.float.image_size')) + .height($r('app.float.image_size')) + .colorBlend($r('sys.color.ohos_id_color_activated')) + .onClick(() => { + this.sendFaceEvent(); + }) + Text(this.prompt).fontSize($r('sys.float.ohos_id_text_size_body2')) + .draggable(false) + .fontColor(this.onFontColor(this.prompt, globalThis.context)) + .height($r('app.float.size_24')) + .onClick(() => { + this.sendFaceEvent(); + }) } - Image(this.prompt !== globalThis.context.resourceManager - .getStringSync($r('app.string.unified_authwidget_hint_recognize_success')) - ? $r('app.media.error_faceID') : $r('app.media.right_faceID')) - .draggable(false) - .margin({ - top: $r('app.float.digital_password_mask_height'), - bottom: $r('app.float.digital_password_mask_height') - }) - .width($r('app.float.image_size')) - .height($r('app.float.image_size')) - .colorBlend($r('sys.color.ohos_id_color_activated')) - .onClick(() => { - this.sendFaceEvent(); - }) - Text(this.prompt).fontSize($r('sys.float.ohos_id_text_size_body2')) - .draggable(false) - .fontColor(this.onFontColor(this.prompt, globalThis.context)) - .height($r('app.float.size_24')) - .onClick(() => { - this.sendFaceEvent(); - }) Row() { Column() { Button($r('app.string.unified_authwidget_cancel'), { stateEffect: true }) @@ -813,15 +869,41 @@ export default struct FaceAuth { // Single FACE if (AppStorage.Get('titleLength') < globalThis.wantParams?.title.length) { Scroll() { - Text(globalThis.wantParams?.title) - .draggable(false) - .fontSize($r('sys.float.ohos_id_text_size_body1')) - .fontColor($r('sys.color.ohos_id_color_text_primary')) - .fontWeight(FontWeight.Medium) - .id('titleFaceAuth') + Column() { + Text(globalThis.wantParams?.title) + .draggable(false) + .fontSize($r('sys.float.ohos_id_text_size_body1')) + .fontColor($r('sys.color.ohos_id_color_text_primary')) + .fontWeight(FontWeight.Medium) + .id('titleFaceAuth') + Image(this.prompt !== globalThis.context.resourceManager + .getStringSync($r('app.string.unified_authwidget_hint_recognize_success')) + ? $r('app.media.error_faceID') : $r('app.media.right_faceID')) + .draggable(false) + .id('imageFaceAuth') + .margin({ + top: $r('app.float.digital_password_mask_height'), + bottom: $r('app.float.digital_password_mask_height') + }) + .width($r('app.float.image_size')) + .height($r('app.float.image_size')) + .colorBlend($r('sys.color.ohos_id_color_activated')) + .onClick(() => { + this.sendFaceEvent(); + }) + Text(this.prompt) + .draggable(false) + .fontSize($r('sys.float.ohos_id_text_size_body2')) + .id('textFaceAuth') + .height($r('app.float.size_24')) + .fontColor(this.onFontColor(this.prompt, globalThis.context)) + .onClick(() => { + this.sendFaceEvent(); + }) + }.margin({left: $r('app.float.size_24'), right: $r('app.float.size_24')}) } - .width('80%') - .height($r('app.float.textArea_height')) + .width('100%') + .height($r('app.float.scroll_height_182')) .margin({ top: $r('app.float.title_padding_top') }) .scrollable(ScrollDirection.Vertical) .scrollBarColor(Color.Gray) @@ -834,31 +916,31 @@ export default struct FaceAuth { .height($r('app.float.size_24')) .fontWeight(FontWeight.Medium) .id('titleFaceAuth') + Image(this.prompt !== globalThis.context.resourceManager + .getStringSync($r('app.string.unified_authwidget_hint_recognize_success')) + ? $r('app.media.error_faceID') : $r('app.media.right_faceID')) + .draggable(false) + .id('imageFaceAuth') + .margin({ + top: $r('app.float.digital_password_mask_height'), + bottom: $r('app.float.digital_password_mask_height') + }) + .width($r('app.float.image_size')) + .height($r('app.float.image_size')) + .colorBlend($r('sys.color.ohos_id_color_activated')) + .onClick(() => { + this.sendFaceEvent(); + }) + Text(this.prompt) + .draggable(false) + .fontSize($r('sys.float.ohos_id_text_size_body2')) + .id('textFaceAuth') + .height($r('app.float.size_24')) + .fontColor(this.onFontColor(this.prompt, globalThis.context)) + .onClick(() => { + this.sendFaceEvent(); + }) } - Image(this.prompt !== globalThis.context.resourceManager - .getStringSync($r('app.string.unified_authwidget_hint_recognize_success')) - ? $r('app.media.error_faceID') : $r('app.media.right_faceID')) - .id('imageFaceAuth') - .draggable(false) - .margin({ - top: $r('app.float.digital_password_mask_height'), - bottom: $r('app.float.digital_password_mask_height') - }) - .width($r('app.float.image_size')) - .height($r('app.float.image_size')) - .colorBlend($r('sys.color.ohos_id_color_activated')) - .onClick(() => { - this.sendFaceEvent(); - }) - Text(this.prompt) - .draggable(false) - .fontSize($r('sys.float.ohos_id_text_size_body2')) - .id('textFaceAuth') - .height($r('app.float.size_24')) - .fontColor(this.onFontColor(this.prompt, globalThis.context)) - .onClick(() => { - this.sendFaceEvent(); - }) if (!globalThis.wantParams?.navigationButtonText) { Row() { Column() { diff --git a/entry/src/main/ets/pages/components/FingerprintAuth.ets b/entry/src/main/ets/pages/components/FingerprintAuth.ets index 26a426c..9af192c 100644 --- a/entry/src/main/ets/pages/components/FingerprintAuth.ets +++ b/entry/src/main/ets/pages/components/FingerprintAuth.ets @@ -300,26 +300,50 @@ export default struct FingerprintAuth { if (this.isOffFinger) { Column() { if ([PIN_FINGER, SINGLE_FINGER].includes(this.state)) { - Text().margin({ top: $r('app.float.content_padding_top') }) - TextArea({ text: globalThis.wantParams?.title }) - .draggable(false) - .focusable(false) - .textAlign(TextAlign.Center) - .fontSize($r('sys.float.ohos_id_text_size_body1')) - .fontColor($r('sys.color.ohos_id_color_text_primary')) - .backgroundColor(Color.White) - .height($r('app.float.textArea_height')) - Image(this.getFingerPosition(this.fingerPosition?.outOfScreenSensorType)) - .draggable(false) - .width($r('app.float.image_big')) - .height($r('app.float.image_big')) - .margin({ top: $r('app.float.content_padding'), bottom: $r('app.float.content_padding') }) - .id('outFingerImage') - - Text(this.prompt) - .draggable(false) - .fontColor(this.onFingerPrintFontColor(this.prompt, globalThis.context)) - .fontSize($r('sys.float.ohos_id_text_size_body2')) + if (AppStorage.Get('titleLength') < globalThis.wantParams?.title.length) { + Scroll() { + Column() { + Text(globalThis.wantParams?.title) + .draggable(false) + .fontSize($r('sys.float.ohos_id_text_size_body1')) + .fontColor($r('sys.color.ohos_id_color_text_primary')) + .fontWeight(FontWeight.Medium) + Image(this.getFingerPosition(this.fingerPosition?.outOfScreenSensorType)) + .draggable(false) + .width($r('app.float.image_big')) + .height($r('app.float.image_big')) + .margin({ top: $r('app.float.content_padding'), bottom: $r('app.float.content_padding') }) + .id('outFingerImage') + Text(this.prompt) + .draggable(false) + .fontColor(this.onFingerPrintFontColor(this.prompt, globalThis.context)) + .fontSize($r('sys.float.ohos_id_text_size_body2')) + }.margin({left: $r('app.float.size_24'), right: $r('app.float.size_24')}) + } + .width('100%') + .height($r('app.float.scroll_height_220')) + .margin({ top: $r('app.float.title_padding_top') }) + .scrollable(ScrollDirection.Vertical) + .scrollBarColor(Color.Gray) + } else { + Text(globalThis.wantParams?.title) + .draggable(false) + .margin({ top: $r('app.float.title_padding_top') }) + .fontSize($r('sys.float.ohos_id_text_size_body1')) + .fontColor($r('sys.color.ohos_id_color_text_primary')) + .height($r('app.float.size_24')) + .fontWeight(FontWeight.Medium) + Image(this.getFingerPosition(this.fingerPosition?.outOfScreenSensorType)) + .draggable(false) + .width($r('app.float.image_big')) + .height($r('app.float.image_big')) + .margin({ top: $r('app.float.content_padding'), bottom: $r('app.float.content_padding') }) + .id('outFingerImage') + Text(this.prompt) + .draggable(false) + .fontColor(this.onFingerPrintFontColor(this.prompt, globalThis.context)) + .fontSize($r('sys.float.ohos_id_text_size_body2')) + } } if (this.state === PIN_FINGER) { @@ -603,8 +627,9 @@ export default struct FingerprintAuth { .fontSize($r('sys.float.ohos_id_text_size_body1')) .fontColor($r('sys.color.ohos_id_color_text_primary')) .fontWeight(FontWeight.Medium) + .margin({left: $r('app.float.size_24'), right: $r('app.float.size_24')}) } - .width('80%') + .width('100%') .height($r('app.float.textArea_height')) .margin({ top: $r('app.float.title_padding_top') }) .scrollable(ScrollDirection.Vertical) @@ -711,14 +736,22 @@ export default struct FingerprintAuth { if (AppStorage.Get('titleLength') < globalThis.wantParams?.title.length) { Scroll() { - Text(globalThis.wantParams?.title) - .draggable(false) - .fontSize($r('sys.float.ohos_id_text_size_body1')) - .fontColor($r('sys.color.ohos_id_color_text_primary')) - .fontWeight(FontWeight.Medium) + Column() { + Text(globalThis.wantParams?.title) + .draggable(false) + .fontSize($r('sys.float.ohos_id_text_size_body1')) + .fontColor($r('sys.color.ohos_id_color_text_primary')) + .fontWeight(FontWeight.Medium) + Text(this.prompt) + .draggable(false) + .margin({ top: $r('app.float.element_margin') }) + .height($r('app.float.size_24')) + .fontSize($r('sys.float.ohos_id_text_size_body2')) + .fontColor(this.onFingerPrintFontColor(this.prompt, globalThis.context)) + }.margin({left: $r('app.float.size_24'), right: $r('app.float.size_24')}) } - .width('80%') - .height($r('app.float.textArea_height')) + .width('100%') + .height($r('app.float.scroll_height_76')) .scrollable(ScrollDirection.Vertical) .scrollBarColor(Color.Gray) } else { @@ -728,13 +761,13 @@ export default struct FingerprintAuth { .fontColor($r('sys.color.ohos_id_color_text_primary')) .height($r('app.float.size_24')) .fontWeight(FontWeight.Medium) + Text(this.prompt) + .draggable(false) + .margin({ top: $r('app.float.element_margin') }) + .height($r('app.float.size_24')) + .fontSize($r('sys.float.ohos_id_text_size_body2')) + .fontColor(this.onFingerPrintFontColor(this.prompt, globalThis.context)) } - Text(this.prompt) - .draggable(false) - .margin({ top: $r('app.float.element_margin') }) - .height($r('app.float.size_24')) - .fontSize($r('sys.float.ohos_id_text_size_body2')) - .fontColor(this.onFingerPrintFontColor(this.prompt, globalThis.context)) Image(this.prompt === globalThis.context.resourceManager .getStringSync($r('app.string.unified_authwidget_hint_fp_verify_success')) ? $r('app.media.right_faceID') : $r('app.media.ic_blue_fingerprint')) @@ -769,8 +802,9 @@ export default struct FingerprintAuth { .fontSize($r('sys.float.ohos_id_text_size_body1')) .fontColor($r('sys.color.ohos_id_color_text_primary')) .fontWeight(FontWeight.Medium) + .margin({left: $r('app.float.size_24'), right: $r('app.float.size_24')}) } - .width('80%') + .width('100%') .height($r('app.float.textArea_height')) .margin({ top: $r('app.float.title_padding_top') }) .scrollable(ScrollDirection.Vertical) @@ -902,14 +936,22 @@ export default struct FingerprintAuth { if (AppStorage.Get('titleLength') < globalThis.wantParams?.title.length) { Scroll() { - Text(globalThis.wantParams?.title) - .draggable(false) - .fontSize($r('sys.float.ohos_id_text_size_body1')) - .fontColor($r('sys.color.ohos_id_color_text_primary')) - .fontWeight(FontWeight.Medium) + Column() { + Text(globalThis.wantParams?.title) + .draggable(false) + .fontSize($r('sys.float.ohos_id_text_size_body1')) + .fontColor($r('sys.color.ohos_id_color_text_primary')) + .fontWeight(FontWeight.Medium) + Text(this.prompt) + .draggable(false) + .margin({ top: $r('app.float.element_margin') }) + .height($r('app.float.size_24')) + .fontSize($r('sys.float.ohos_id_text_size_body2')) + .fontColor(this.onFingerPrintFontColor(this.prompt, globalThis.context)) + }.margin({left: $r('app.float.size_24'), right: $r('app.float.size_24')}) } - .width('80%') - .height($r('app.float.textArea_height')) + .width('100%') + .height($r('app.float.scroll_height_76')) .scrollable(ScrollDirection.Vertical) .scrollBarColor(Color.Gray) } else { @@ -919,13 +961,13 @@ export default struct FingerprintAuth { .fontColor($r('sys.color.ohos_id_color_text_primary')) .height($r('app.float.size_24')) .fontWeight(FontWeight.Medium) + Text(this.prompt) + .draggable(false) + .margin({ top: $r('app.float.element_margin') }) + .height($r('app.float.size_24')) + .fontSize($r('sys.float.ohos_id_text_size_body2')) + .fontColor(this.onFingerPrintFontColor(this.prompt, globalThis.context)) } - Text(this.prompt) - .draggable(false) - .margin({ top: $r('app.float.element_margin') }) - .height($r('app.float.size_24')) - .fontSize($r('sys.float.ohos_id_text_size_body2')) - .fontColor(this.onFingerPrintFontColor(this.prompt, globalThis.context)) Image(this.prompt === globalThis.context.resourceManager .getStringSync($r('app.string.unified_authwidget_hint_fp_verify_success')) ? $r('app.media.right_faceID') : $r('app.media.ic_blue_fingerprint')) diff --git a/entry/src/main/ets/pages/components/PasswordAuth.ets b/entry/src/main/ets/pages/components/PasswordAuth.ets index 6d488b9..90144e1 100644 --- a/entry/src/main/ets/pages/components/PasswordAuth.ets +++ b/entry/src/main/ets/pages/components/PasswordAuth.ets @@ -64,7 +64,7 @@ export default struct PasswordAuth { .getStringSync($r('app.string.unified_authwidget_frequency')); } if (num === 'first') { - this.inputValue = ''; + this.inputValue = ' '; } return; } diff --git a/entry/src/main/resources/base/element/float.json b/entry/src/main/resources/base/element/float.json index 292f94e..397e265 100644 --- a/entry/src/main/resources/base/element/float.json +++ b/entry/src/main/resources/base/element/float.json @@ -396,6 +396,10 @@ "name": "padding_16", "value": "16vp" }, + { + "name": "margin_36", + "value": "36vp" + }, { "name": "margin_64", "value": "64vp" @@ -407,6 +411,50 @@ { "name": "textArea_height", "value": "36vp" + }, + { + "name": "numKeyBoard_row1_16", + "value": "16vp" + }, + { + "name": "numKeyBoard_row1_28", + "value": "28vp" + }, + { + "name": "numKeyBoard_row2", + "value": "12vp" + }, + { + "name": "keyboard_key_high_phone", + "value": "54vp" + }, + { + "name": "scroll_height_122", + "value": "122vp" + }, + { + "name": "scroll_height_90", + "value": "90vp" + }, + { + "name": "scroll_height_182", + "value": "182vp" + }, + { + "name": "scroll_height_220", + "value": "220vp" + }, + { + "name": "scroll_height_76", + "value": "76vp" + }, + { + "name": "scroll_height_88", + "value": "88vp" + }, + { + "name": "scroll_height_72", + "value": "72vp" } ] } \ No newline at end of file diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index c92645d..7d9ddaa 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -172,6 +172,10 @@ "name": "unified_authwidget_many_failures", "value": "Too many failures, please " }, + { + "name": "unified_authwidget_pleaseretry", + "value": "Please" + }, { "name": "unified_authwidget_postretry", "value": "retry" diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json index c92645d..7d9ddaa 100644 --- a/entry/src/main/resources/en_US/element/string.json +++ b/entry/src/main/resources/en_US/element/string.json @@ -172,6 +172,10 @@ "name": "unified_authwidget_many_failures", "value": "Too many failures, please " }, + { + "name": "unified_authwidget_pleaseretry", + "value": "Please" + }, { "name": "unified_authwidget_postretry", "value": "retry" diff --git a/entry/src/main/resources/zh_CN/element/string.json b/entry/src/main/resources/zh_CN/element/string.json index 130cc86..3ee5e90 100644 --- a/entry/src/main/resources/zh_CN/element/string.json +++ b/entry/src/main/resources/zh_CN/element/string.json @@ -172,6 +172,10 @@ "name": "unified_authwidget_many_failures", "value": "失败次数过多,请" }, + { + "name": "unified_authwidget_pleaseretry", + "value": "请" + }, { "name": "unified_authwidget_postretry", "value": "后重试" diff --git a/entry/src/ohosTest/resources/base/element/float.json b/entry/src/ohosTest/resources/base/element/float.json index 0e1ab70..1a7d2b8 100644 --- a/entry/src/ohosTest/resources/base/element/float.json +++ b/entry/src/ohosTest/resources/base/element/float.json @@ -407,6 +407,22 @@ { "name": "textArea_height", "value": "44vp" + }, + { + "name": "numKeyBoard_row1_16", + "value": "16vp" + }, + { + "name": "numKeyBoard_row1_28", + "value": "28vp" + }, + { + "name": "numKeyBoard_row2", + "value": "12vp" + }, + { + "name": "keyBoard_key_high_phone", + "value": "54vp" } ] } \ No newline at end of file diff --git a/entry/src/ohosTest/resources/base/element/string.json b/entry/src/ohosTest/resources/base/element/string.json index e93dbb7..c360f26 100644 --- a/entry/src/ohosTest/resources/base/element/string.json +++ b/entry/src/ohosTest/resources/base/element/string.json @@ -172,6 +172,10 @@ "name": "unified_authwidget_many_failures", "value": "Too many failures, please " }, + { + "name": "unified_authwidget_pleaseretry", + "value": "Please" + }, { "name": "unified_authwidget_postretry", "value": "retry" diff --git a/entry/src/ohosTest/resources/en_US/element/string.json b/entry/src/ohosTest/resources/en_US/element/string.json index 7c50286..4f36890 100644 --- a/entry/src/ohosTest/resources/en_US/element/string.json +++ b/entry/src/ohosTest/resources/en_US/element/string.json @@ -184,6 +184,10 @@ "name": "unified_authwidget_many_failures", "value": "Too many failures, please " }, + { + "name": "unified_authwidget_pleaseretry", + "value": "Please" + }, { "name": "unified_authwidget_postretry", "value": "retry" diff --git a/entry/src/ohosTest/resources/zh_CN/element/string.json b/entry/src/ohosTest/resources/zh_CN/element/string.json index 918082f..ba2baf2 100644 --- a/entry/src/ohosTest/resources/zh_CN/element/string.json +++ b/entry/src/ohosTest/resources/zh_CN/element/string.json @@ -184,6 +184,10 @@ "name": "unified_authwidget_many_failures", "value": "失败次数过多,请" }, + { + "name": "unified_authwidget_pleaseretry", + "value": "请" + }, { "name": "unified_authwidget_postretry", "value": "后重试" -- Gitee