告警处理

Signed-off-by: sizhenzhen <sizhenzhen@h-partners.com>
This commit is contained in:
sizhenzhen
2025-08-30 18:38:19 +08:00
parent 3424f12e99
commit f60e8b1f9d
4 changed files with 376 additions and 233 deletions
@@ -161,6 +161,28 @@ export default struct FullScreen {
}
}
isSensorType(sensor: FingerPosition): boolean {
return sensor.sensorType === 'UNDER_SCREEN_SENSOR' ||
sensor.sensorType === 'BOTH_SENSOR' ||
sensor.sensorType === 'SensorType1'
}
handleRemainAttempts(payload: CmdData, num?: string): void {
if (payload.remainAttempts === 0) {
if (num === 'first') {
this.controlType.isShowFinger = false;
} else {
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_title_number_failed_fp_forbidden').id);
this.fingerText = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_title_number_failed_fp_forbidden').id);
}
this.faceFingerLockArr[1] = true;
this.controlType.jumpFinger = false;
this.cancelImage = false;
}
}
handleNoticeTypeFinger(payload: CmdData, num?: string): void {
let sensor: FingerPosition = { sensorType: '' };
if (payload.sensorInfo && JSON.stringify(payload.sensorInfo) !== '{}') {
@@ -174,9 +196,7 @@ export default struct FullScreen {
}
if (sensor && this.fingerPosition.udSensorCenterYInThousandth !== undefined &&
this.fingerPosition.udSensorRadiusInPx !== undefined) {
if (sensor.sensorType === 'UNDER_SCREEN_SENSOR' ||
sensor.sensorType === 'BOTH_SENSOR' ||
sensor.sensorType === 'SensorType1') {
if (this.isSensorType(sensor)) {
if (num !== 'first' && payload.remainAttempts > 0 && payload.result != 0) {
setTimeout(() => {
AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypeFinger]);
@@ -198,19 +218,7 @@ export default struct FullScreen {
}
}
}
if (payload.remainAttempts === 0) {
if (num === 'first') {
this.controlType.isShowFinger = false;
} else {
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_title_number_failed_fp_forbidden').id);
this.fingerText = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_title_number_failed_fp_forbidden').id);
}
this.faceFingerLockArr[1] = true;
this.controlType.jumpFinger = false;
this.cancelImage = false;
}
this.handleRemainAttempts(payload, num);
if (payload.result === 0) {
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
@@ -288,16 +296,23 @@ export default struct FullScreen {
}
countdown(freezingTime: number): void {
const TRY_AGAIN = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager.getStringSync($r('app.string.unified_authwidget_postretry').id);
const PLEASE_TRY = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager.getStringSync($r('app.string.unified_authwidget_pleaseretry').id);
const TRY_AGAIN =
(AppStorage.get('context') as common.ExtensionContext)?.resourceManager.getStringSync($r('app.string.unified_authwidget_postretry')
.id);
const PLEASE_TRY =
(AppStorage.get('context') as common.ExtensionContext)?.resourceManager.getStringSync($r('app.string.unified_authwidget_pleaseretry')
.id);
let promptText: string = '';
let freezingMillisecond = freezingTime;
if (freezingMillisecond > 0) {
promptText = TimeUtils.getFreezingTimeNm(freezingMillisecond, (AppStorage.get('context') as common.ExtensionContext));
promptText =
TimeUtils.getFreezingTimeNm(freezingMillisecond, (AppStorage.get('context') as common.ExtensionContext));
promptText = PLEASE_TRY + promptText + TRY_AGAIN;
setTimeout((t: number):void => this.countdown(t), INTERVAL, freezingTime - INTERVAL);
setTimeout((t: number): void => this.countdown(t), INTERVAL, freezingTime - INTERVAL);
} else {
promptText = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager.getStringSync($r('app.string.unified_authwidget_use_pwd').id);
promptText =
(AppStorage.get('context') as common.ExtensionContext)?.resourceManager.getStringSync($r('app.string.unified_authwidget_use_pwd')
.id);
this.clearPassword();
// 0: pin unlock
this.pinLock = 0;
@@ -349,7 +364,7 @@ export default struct FullScreen {
})
.visibility(Visibility.Hidden)
}
.position({ y: px2vp(this.screen[1] * LOCK_POSITION) - CANCEL_HIGH - this.SYSTEM_STATUS_BAR_HEIGHT})
.position({ y: px2vp(this.screen[1] * LOCK_POSITION) - CANCEL_HIGH - this.SYSTEM_STATUS_BAR_HEIGHT })
.width(Constants.fullContainerWidth)
} else {
Column() {
@@ -530,6 +545,7 @@ export default struct FullScreen {
}
}
.height($r('app.float.text_high'))
Button(($r('app.string.unified_authwidget_forgotpwd')), {
stateEffect: false
})
@@ -584,8 +600,9 @@ export default struct FullScreen {
} else if (index === 1) {
this.passwordArray[index - 1] = '';
this.numKeyboard[11].value = GO_BACK;
this.numKeyboard[11].row1 = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_back').id);
this.numKeyboard[11].row1 =
(AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_back').id);
} else {
this.passwordArray[index - 1] = '';
}
@@ -611,10 +628,12 @@ export default struct FullScreen {
}
.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 })
.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({
@@ -644,8 +663,9 @@ export default struct FullScreen {
} else if (index === 1) {
this.passwordArray[index - 1] = '';
this.numKeyboard[11].value = GO_BACK;
this.numKeyboard[11].row1 = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_back').id);
this.numKeyboard[11].row1 =
(AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_back').id);
} else {
this.passwordArray[index - 1] = '';
}
@@ -670,8 +690,10 @@ export default struct FullScreen {
}
.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 })
.position({
y: px2vp(this.screen[1] * NUM_KEY_BOTTOM) - CANCEL_HIGH - BOTTOM -
this.SYSTEM_STATUS_BAR_HEIGHT - this.SYSTEM_NAVIGATION_BAR_HEIGHT
})
}
} else {
Column() {
@@ -702,8 +724,9 @@ export default struct FullScreen {
} else if (index === 1) {
this.passwordArray[index - 1] = '';
this.numKeyboard[11].value = GO_BACK;
this.numKeyboard[11].row1 = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_back').id);
this.numKeyboard[11].row1 =
(AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_back').id);
} else {
this.passwordArray[index - 1] = '';
}
@@ -729,8 +752,10 @@ export default struct FullScreen {
}
.width(Constants.fullContainerWidth)
.height('37%')
.position({ y: px2vp(this.screen[1] * NUM_KEY_POSITION) - CANCEL_HIGH -
this.SYSTEM_STATUS_BAR_HEIGHT })
.position({
y: px2vp(this.screen[1] * NUM_KEY_POSITION) - CANCEL_HIGH -
this.SYSTEM_STATUS_BAR_HEIGHT
})
}
}
@@ -756,9 +781,11 @@ 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 })
.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)
@@ -785,8 +812,10 @@ export default struct FullScreen {
.height(this.controlType.isShowFinger ? $r('app.float.finger_high') : '9%')
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.Center)
.position({ y: px2vp(this.screen[1]) - CANCEL_HIGH - BOTTOM -
this.SYSTEM_STATUS_BAR_HEIGHT - this.SYSTEM_NAVIGATION_BAR_HEIGHT })
.position({
y: px2vp(this.screen[1]) - CANCEL_HIGH - BOTTOM -
this.SYSTEM_STATUS_BAR_HEIGHT - this.SYSTEM_NAVIGATION_BAR_HEIGHT
})
}
}
}
@@ -813,7 +842,7 @@ export default struct FullScreen {
.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')})
}.margin({ left: $r('app.float.margin_36'), right: $r('app.float.size_24') })
}
.width('96%')
.id('titleFullScreen')
+17 -6
View File
@@ -124,6 +124,20 @@ struct Index {
AppStorage.get<UIExtensionContentSession>('session')?.terminateSelf();
}
isFaceLockedFn(): boolean {
return this.authType.length == 1 && this.authType.includes(userAuth.UserAuthType.FACE) && this.isFaceLocked
}
isFingerprintLockedFn(): boolean {
return this.authType.length == 1 && this.authType.includes(userAuth.UserAuthType.FINGERPRINT) &&
this.isFingerprintLocked
}
isFaceAndFingerprintLocked(): boolean {
return this.authType.length == 2 && this.authType.includes(userAuth.UserAuthType.FACE) && this.isFaceLocked &&
this.authType.includes(userAuth.UserAuthType.FINGERPRINT) && this.isFingerprintLocked
}
handleAuthStart(): void {
LogUtils.info(TAG, 'handleAuthStart');
try {
@@ -145,22 +159,19 @@ struct Index {
}
})
if (that.skipLockedBiometricAuth) {
if (that.authType.length == 1 && that.authType.includes(userAuth.UserAuthType.FACE) && that.isFaceLocked) {
if (that.isFaceLockedFn()) {
that.handleFaceLocked();
return;
}
if (that.authType.length == 1 && that.authType.includes(userAuth.UserAuthType.FINGERPRINT) &&
that.isFingerprintLocked) {
if (that.isFingerprintLockedFn()) {
that.handleFingerprintLocked()
return;
}
if (that.authType.length == 2 && that.authType.includes(userAuth.UserAuthType.FACE) && that.isFaceLocked &&
that.authType.includes(userAuth.UserAuthType.FINGERPRINT) && that.isFingerprintLocked) {
if (that.isFaceAndFingerprintLocked()) {
that.handleFaceAndFingerprintLocked();
return;
}
}
that.cmdData = cmdDataObj?.cmd || [];
if (cmdDataObj?.pinSubType !== null && cmdDataObj?.pinSubType !== undefined) {
that.pinSubType = cmdDataObj?.pinSubType;
+138 -86
View File
@@ -81,14 +81,17 @@ export default struct FaceAuth {
@Link skipLockedBiometricAuth: boolean;
countTime(freezingTime: number): void {
const TRY_AGAIN = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager.getStringSync($r('app.string.unified_authwidget_postretry').id);
const TRY_AGAIN =
(AppStorage.get('context') as common.ExtensionContext)?.resourceManager.getStringSync($r('app.string.unified_authwidget_postretry')
.id);
let promptText: string = '';
let freezingMillisecond = freezingTime;
if (freezingMillisecond > 0) {
promptText = TimeUtils.getFreezingTimeNm(freezingMillisecond, (AppStorage.get('context') as common.ExtensionContext));
promptText =
TimeUtils.getFreezingTimeNm(freezingMillisecond, (AppStorage.get('context') as common.ExtensionContext));
promptText = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_many_failures').id) + promptText + TRY_AGAIN;
setTimeout((t: number):void => this.countTime(t), INTERVAL, freezingTime - INTERVAL);
setTimeout((t: number): void => this.countTime(t), INTERVAL, freezingTime - INTERVAL);
} else {
promptText = ' ';
this.isEdit = true;
@@ -108,6 +111,19 @@ export default struct FaceAuth {
}
}
handleDialogTypeAll(): void {
AuthUtils.getInstance()
.sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypeFinger, Constants.noticeTypeFace]);
AuthUtils.getInstance()
.sendNotice(Constants.noticeEventWidgetLoaded, [Constants.noticeTypeFinger, Constants.noticeTypeFace]);
}
handleDialogTypeOther(): void {
LogUtils.error(TAG, 'aboutToAppear not support type');
AuthUtils.getInstance().sendNotice(Constants.noticeEventInvalidParam, [Constants.noticeTypePin]);
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
aboutToAppear(): void {
LogUtils.debug(TAG, 'aboutToAppear');
try {
@@ -118,20 +134,13 @@ export default struct FaceAuth {
AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypeFace]);
AuthUtils.getInstance().sendNotice(Constants.noticeEventWidgetLoaded, [Constants.noticeTypeFace]);
} else if (this.dialogType === DialogType.ALL || this.dialogType === DialogType.FACE_FINGER_NAVIGATION) {
AuthUtils.getInstance()
.sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypeFinger, Constants.noticeTypeFace]);
AuthUtils.getInstance()
.sendNotice(Constants.noticeEventWidgetLoaded, [Constants.noticeTypeFinger, Constants.noticeTypeFace]);
this.handleDialogTypeAll();
} else {
LogUtils.error(TAG, 'aboutToAppear not support type');
AuthUtils.getInstance().sendNotice(Constants.noticeEventInvalidParam, [Constants.noticeTypePin]);
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
this.handleDialogTypeOther();
}
if (this.cmdData && this.cmdData.length > 0) {
this.onCmdDataChange('first');
}
if ((this.isPinFaceFinger || this.dialogType === DialogType.FACE_FINGER_NAVIGATION) &&
this.fingerPosition.udSensorCenterYInThousandth !== undefined &&
this.fingerPosition.udSensorRadiusInPx !== undefined) {
@@ -228,29 +237,37 @@ export default struct FaceAuth {
}
isColorWarning(prompt: string, context: Context): boolean {
return prompt === context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_hint_fp_retry_s2').id) ||
prompt === context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_hint_face_verify_fail_click_retry_s1').id) ||
prompt === context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_title_number_failed_face_forbidden').id) ||
prompt === context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_title_number_failed_fp_forbidden').id)
return prompt ===
context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_hint_fp_retry_s2').id) ||
prompt ===
context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_hint_face_verify_fail_click_retry_s1')
.id) ||
prompt ===
context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_title_number_failed_face_forbidden')
.id) ||
prompt ===
context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_title_number_failed_fp_forbidden').id)
}
isColorTextSecondary(prompt: string, context: Context): boolean {
return prompt === context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_hint_recognition').id) ||
prompt === context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_hint_recognize_success').id) ||
return prompt ===
context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_hint_recognition').id) ||
prompt ===
context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_hint_recognize_success').id) ||
prompt === context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_hint_inscreen_fp').id)
}
onFontColor(prompt: string, context: Context): Resource {
if (this.isColorWarning(prompt,context)) {
if (this.isColorWarning(prompt, context)) {
return $r('sys.color.ohos_id_color_warning');
} else if (this.isColorTextSecondary(prompt,context)) {
} else if (this.isColorTextSecondary(prompt, context)) {
return $r('sys.color.ohos_id_color_text_secondary');
} else {
return $r('sys.color.ohos_id_color_text_secondary');
}
}
handleOtherResult(payload: CmdData,num?: string): void {
handleOtherResult(payload: CmdData, num?: string): void {
if (payload.remainAttempts) {
this.inputValue = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_pwd_error').id);
@@ -273,7 +290,7 @@ export default struct FaceAuth {
}
}
handleNoticeTypePinExcludesDialogTypeFlag(payload: CmdData,num?: string): void {
handleNoticeTypePinExcludesDialogTypeFlag(payload: CmdData, num?: string): void {
if (payload.remainAttempts && payload.result !== 0) {
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_face_verify_fail_click_retry_s1').id);
@@ -313,40 +330,44 @@ export default struct FaceAuth {
}
}
handleNoticeTypeFingerFlag(payload: CmdData, remainAttempts: number, authResult: number, num?: string): void {
handleSensorType(payload: CmdData): void {
if (payload.sensorInfo && JSON.stringify(payload.sensorInfo) !== '{}') {
this.fingerPosition = JSON.parse(payload.sensorInfo);
try {
const displayClass = display.getDefaultDisplaySync();
this.screen = [displayClass.width, displayClass.height];
switch (JSON.parse(payload.sensorInfo)?.sensorType as string) {
case 'NON_SENSOR':
case 'OUT_OF_SCREEN_SENSOR': {
this.dialogTypeFlag = PIN_FACE;
break;
}
default:
if (this.dialogType !== DialogType.FACE_FINGER_NAVIGATION) {
this.isPinFaceFinger = true;
}
let tempPositionLine = JSON.parse(payload.sensorInfo).udSensorCenterYInThousandth / displayClass.height;
FuncUtils.judgmentOverflow(tempPositionLine);
if (tempPositionLine < FINGER_SENSOR_POSITION_LINE) {
if (!this.IS_LANDSCAPE && ![SIX_PIN, MULTI_PIN].includes(this.dialogTypeFlag)) {
this.screenType = SCREEN_LAND;
}
} else if (tempPositionLine > FINGER_SENSOR_POSITION_LINE) {
if (!this.IS_LANDSCAPE && ![SIX_PIN, MULTI_PIN].includes(this.dialogTypeFlag)) {
this.screenType = SCREEN_PORTRAIT;
}
}
break;
}
} catch (error) {
LogUtils.error(TAG, `getDefaultDisplaySync catch error: ${error?.code}`);
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
this.screen = [displayClass.width, displayClass.height];
switch (JSON.parse(payload.sensorInfo)?.sensorType as string) {
case 'NON_SENSOR':
case 'OUT_OF_SCREEN_SENSOR': {
this.dialogTypeFlag = PIN_FACE;
break;
}
default:
if (this.dialogType !== DialogType.FACE_FINGER_NAVIGATION) {
this.isPinFaceFinger = true;
}
let tempPositionLine = JSON.parse(payload.sensorInfo).udSensorCenterYInThousandth / displayClass.height;
FuncUtils.judgmentOverflow(tempPositionLine);
if (tempPositionLine < FINGER_SENSOR_POSITION_LINE) {
if (!this.IS_LANDSCAPE && ![SIX_PIN, MULTI_PIN].includes(this.dialogTypeFlag)) {
this.screenType = SCREEN_LAND;
}
} else if (tempPositionLine > FINGER_SENSOR_POSITION_LINE) {
if (!this.IS_LANDSCAPE && ![SIX_PIN, MULTI_PIN].includes(this.dialogTypeFlag)) {
this.screenType = SCREEN_PORTRAIT;
}
}
break;
}
}
}
handleNoticeTypeFingerFlag(payload: CmdData, remainAttempts: number, authResult: number, num?: string): void {
this.handleSensorType(payload);
if ((remainAttempts && authResult !== 0) || authResult === Constants.authResultPinExpired) {
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_fp_retry_s2').id);
@@ -381,35 +402,49 @@ export default struct FaceAuth {
}
}
handleResult(payload: CmdData, num?: string): boolean {
if (payload.result === 0) {
AuthUtils.getInstance().sendNotice(Constants.noticeEventWidgetReleased, [Constants.noticeTypePin]);
setTimeout(() => {
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}, SECOND);
} else if (payload.result && payload.result === Constants.authResultPinExpired) {
this.inputValue = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_pwd_error').id);
this.textValue = '';
return true;
} else {
this.handleOtherResult(payload, num)
}
return false;
}
handleNoticeTypeFace(payload: CmdData, num?: string): boolean {
if ([SIX_PIN, MULTI_PIN].includes(this.dialogTypeFlag)) {
return true;
}
if (payload.result && payload.result === Constants.authResultPinExpired) {
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_face_verify_fail_click_retry_s1').id);
this.faceLock = false;
return true;
}
this.handleNoticeTypePinExcludesDialogTypeFlag(payload, num);
return false;
}
onCmdDataChange(num?: string): void {
LogUtils.info(TAG, 'onCmdDataChange');
this.cmdData.length > 0 && this.cmdData.map(async (item) => {
const payload: CmdData = item.payload;
if (payload.type === Constants.noticeTypePin) {
if (payload.result === 0) {
AuthUtils.getInstance().sendNotice(Constants.noticeEventWidgetReleased, [Constants.noticeTypePin]);
setTimeout(() => {
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}, SECOND);
} else if (payload.result && payload.result === Constants.authResultPinExpired) {
this.inputValue = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_pwd_error').id);
this.textValue = '';
if (this.handleResult(payload, num)) {
return;
} else {
this.handleOtherResult(payload,num)
}
} else if (payload.type === Constants.noticeTypeFace) {
if ([SIX_PIN, MULTI_PIN].includes(this.dialogTypeFlag)) {
if (this.handleNoticeTypeFace(payload, num)) {
return;
}
if (payload.result && payload.result === Constants.authResultPinExpired) {
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_face_verify_fail_click_retry_s1').id);
this.faceLock = false;
return;
}
this.handleNoticeTypePinExcludesDialogTypeFlag(payload,num);
} else if (payload.type === Constants.noticeTypeFinger) {
const payload: CmdData = item.payload;
let lockoutDuration: number = 0;
@@ -439,7 +474,7 @@ export default struct FaceAuth {
if ([SIX_PIN, MULTI_PIN].includes(this.dialogTypeFlag)) {
return;
}
this.handleNoticeTypeFingerFlag(payload,remainAttempts,authResult,num);
this.handleNoticeTypeFingerFlag(payload, remainAttempts, authResult, num);
} else {
LogUtils.error(TAG, 'onCmdDataChange default');
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
@@ -460,14 +495,26 @@ export default struct FaceAuth {
build() {
Column() {
GridRow({
columns: { xs: 4, sm: 4, md: 8, lg: 12 },
columns: {
xs: 4,
sm: 4,
md: 8,
lg: 12
},
gutter: { x: 24, y: 24 },
breakpoints: { value: Constants.deviceDpi,
reference: BreakpointsReference.WindowSize },
breakpoints: {
value: Constants.deviceDpi,
reference: BreakpointsReference.WindowSize
},
direction: GridRowDirection.Row
}) {
GridCol({
span: { xs: 4, sm: 4, md: 4, lg: 6 },
span: {
xs: 4,
sm: 4,
md: 4,
lg: 6
},
offset: { md: 2, lg: 3 },
}) {
if (this.isPinFaceFinger) {
@@ -624,12 +671,13 @@ export default struct FaceAuth {
.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, (AppStorage.get('context') as common.ExtensionContext)))
}.margin({left: $r('app.float.size_24'), right: $r('app.float.size_24')})
.fontColor(this.onFontColor(this.prompt,
(AppStorage.get('context') as common.ExtensionContext)))
}.margin({ left: $r('app.float.size_24'), right: $r('app.float.size_24') })
}
.width('100%')
.height($r('app.float.scroll_height_122'))
.margin({top: $r('app.float.content_padding')})
.margin({ top: $r('app.float.content_padding') })
.scrollable(ScrollDirection.Vertical)
.scrollBarColor(Color.Gray)
} else {
@@ -692,7 +740,7 @@ export default struct FaceAuth {
.id('errFaceImgFaceAuth')
.width($r('app.float.image_small'))
.height($r('app.float.image_small'))
.margin({bottom: $r('app.float.content_padding') })
.margin({ bottom: $r('app.float.content_padding') })
.colorBlend($r('sys.color.ohos_id_color_activated'))
.onClick(() => {
this.sendFaceEvent();
@@ -702,11 +750,11 @@ export default struct FaceAuth {
.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')})
}.margin({ left: $r('app.float.size_24'), right: $r('app.float.size_24') })
}
.width('100%')
.height($r('app.float.scroll_height_90'))
.margin({ top: $r('app.float.content_padding_top')})
.margin({ top: $r('app.float.content_padding_top') })
.scrollable(ScrollDirection.Vertical)
.scrollBarColor(Color.Gray)
} else {
@@ -818,7 +866,7 @@ export default struct FaceAuth {
.id('errFaceImgFaceAuth')
.width($r('app.float.image_small'))
.height($r('app.float.image_small'))
.margin({bottom: $r('app.float.content_padding') })
.margin({ bottom: $r('app.float.content_padding') })
.colorBlend($r('sys.color.ohos_id_color_activated'))
.onClick(() => {
this.sendFaceEvent();
@@ -828,11 +876,11 @@ export default struct FaceAuth {
.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')})
}.margin({ left: $r('app.float.size_24'), right: $r('app.float.size_24') })
}
.width('100%')
.height($r('app.float.scroll_height_90'))
.margin({ top: $r('app.float.content_padding_top')})
.margin({ top: $r('app.float.content_padding_top') })
.scrollable(ScrollDirection.Vertical)
.scrollBarColor(Color.Gray)
} else {
@@ -962,14 +1010,16 @@ export default struct FaceAuth {
.onClick(() => {
this.sendFaceEvent();
})
Text(this.prompt).fontSize($r('sys.float.ohos_id_text_size_body2'))
Text(this.prompt)
.fontSize($r('sys.float.ohos_id_text_size_body2'))
.draggable(false)
.fontColor(this.onFontColor(this.prompt, (AppStorage.get('context') as common.ExtensionContext)))
.fontColor(this.onFontColor(this.prompt,
(AppStorage.get('context') as common.ExtensionContext)))
.height($r('app.float.size_24'))
.onClick(() => {
this.sendFaceEvent();
})
}.margin({left: $r('app.float.size_24'), right: $r('app.float.size_24')})
}.margin({ left: $r('app.float.size_24'), right: $r('app.float.size_24') })
}
.width('100%')
.height($r('app.float.scroll_height_182'))
@@ -998,7 +1048,8 @@ export default struct FaceAuth {
.onClick(() => {
this.sendFaceEvent();
})
Text(this.prompt).fontSize($r('sys.float.ohos_id_text_size_body2'))
Text(this.prompt)
.fontSize($r('sys.float.ohos_id_text_size_body2'))
.draggable(false)
.fontColor(this.onFontColor(this.prompt, (AppStorage.get('context') as common.ExtensionContext)))
.height($r('app.float.size_24'))
@@ -1164,11 +1215,12 @@ export default struct FaceAuth {
.fontSize($r('sys.float.ohos_id_text_size_body2'))
.id('textFaceAuth')
.height($r('app.float.size_24'))
.fontColor(this.onFontColor(this.prompt, (AppStorage.get('context') as common.ExtensionContext)))
.fontColor(this.onFontColor(this.prompt,
(AppStorage.get('context') as common.ExtensionContext)))
.onClick(() => {
this.sendFaceEvent();
})
}.margin({left: $r('app.float.size_24'), right: $r('app.float.size_24')})
}.margin({ left: $r('app.float.size_24'), right: $r('app.float.size_24') })
}
.width('100%')
.height($r('app.float.scroll_height_182'))
@@ -185,43 +185,113 @@ export default struct FingerprintAuth {
}
}
handleNoticeTypeFingerFirst(payload: CmdData,remainAttempts: number,authResult: number, num?: string): void {
handleNoticeTypeFingerFirst(payload: CmdData, remainAttempts: number, authResult: number, num?: string): void {
try {
const displayClass = display.getDefaultDisplaySync();
this.screen = [displayClass.width, displayClass.height];
if (payload.sensorInfo && JSON.stringify(payload.sensorInfo) !== '{}') {
this.fingerPosition = JSON.parse(payload.sensorInfo);
switch (this.fingerPosition.sensorType) {
case 'OUT_OF_SCREEN_SENSOR': {
this.isOffFinger = true;
break;
}
default:
let tempPositionLine = JSON.parse(payload.sensorInfo).udSensorCenterYInThousandth / displayClass.height;
FuncUtils.judgmentOverflow(tempPositionLine);
if (tempPositionLine < FINGER_SENSOR_POSITION_LINE) {
this.screenType = ON_SCREEN;
} else if (tempPositionLine > FINGER_SENSOR_POSITION_LINE) {
this.screenType = UNDER_SCREEN;
}
break;
}
}
if ((remainAttempts && authResult !== 0) || authResult === Constants.authResultPinExpired) {
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_fp_retry_s2').id);
this.fingerLock = false;
}
if (num === 'first') {
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync(this.isOffFinger ?
$r('app.string.unified_authwidget_hint_normal_fp_only').id :
$r('app.string.unified_authwidget_hint_inscreen_fp').id);
}
} catch (error) {
LogUtils.error(TAG, `getDefaultDisplaySync catch error: ${error?.code}`);
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
this.screen = [displayClass.width, displayClass.height];
if (payload.sensorInfo && JSON.stringify(payload.sensorInfo) !== '{}') {
this.fingerPosition = JSON.parse(payload.sensorInfo);
switch (this.fingerPosition.sensorType) {
case 'OUT_OF_SCREEN_SENSOR': {
this.isOffFinger = true;
break;
}
handleSkipLockedBiometricAuth(): void {
AuthUtils.getInstance().sendNotice(Constants.noticeEventWidgetReleased, [Constants.noticeTypeFinger]);
AuthUtils.getInstance()
.sendNotice(Constants.noticeEventUserNavigation, [Constants.noticeTypeFinger]);
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
isFingerSkipLockedBiometricAuth(): boolean {
return this.dialogType === DialogType.FINGER && this.skipLockedBiometricAuth;
}
handleFingerSkipLockedBiometricAuth(): void {
AuthUtils.getInstance().sendNotice(Constants.noticeEventWidgetReleased, [Constants.noticeTypeFinger]);
AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, [Constants.noticeTypeFinger]);
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
handleNoticeTypePinaAuthResult(authResult: number, lockoutDuration: number, remainAttempts: number,
num?: string): boolean {
if (authResult === 0) {
AuthUtils.getInstance().sendNotice(Constants.noticeEventWidgetReleased, [Constants.noticeTypePin]);
setTimeout(() => {
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}, SECOND)
} else if (authResult && authResult === Constants.authResultPinExpired) {
this.inputValue = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_pwd_error').id);
this.textValue = '';
return true;
} else {
this.handleNoticeTypePinOtherAuthResult(lockoutDuration, remainAttempts, num);
}
return false;
}
handleNoticeTypeFinger(payload: CmdData, remainAttempts: number, authResult: number, num?: string): boolean {
if ([MULTI_PIN, SIX_PIN].includes(this.state)) {
return true;
}
this.handleNoticeTypeFingerFirst(payload, remainAttempts, authResult, num);
if (remainAttempts === AUTH_LOCK) {
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_title_number_failed_fp_forbidden').id);
this.fingerLock = true;
if (payload.tipType === UserAuthTipType.SINGLE_AUTH_RESULT) {
this.handlePinFingerDialogType();
if ((AppStorage.get('wantParams') as WantParams)?.navigationButtonText as string &&
this.skipLockedBiometricAuth) {
this.handleSkipLockedBiometricAuth();
return true;
}
default:
let tempPositionLine = JSON.parse(payload.sensorInfo).udSensorCenterYInThousandth / displayClass.height;
FuncUtils.judgmentOverflow(tempPositionLine);
if (tempPositionLine < FINGER_SENSOR_POSITION_LINE) {
this.screenType = ON_SCREEN;
} else if (tempPositionLine > FINGER_SENSOR_POSITION_LINE) {
this.screenType = UNDER_SCREEN;
}
break;
if (this.isFingerSkipLockedBiometricAuth()) {
this.handleFingerSkipLockedBiometricAuth();
return true;
}
} else {
this.handleOtherSingleAuthResult();
}
}
if ((remainAttempts && authResult !== 0) || authResult === Constants.authResultPinExpired) {
if (authResult === 0) {
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_fp_retry_s2').id);
this.fingerLock = false;
}
if (num === 'first') {
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync(this.isOffFinger ?
$r('app.string.unified_authwidget_hint_normal_fp_only').id :
$r('app.string.unified_authwidget_hint_inscreen_fp').id);
.getStringSync($r('app.string.unified_authwidget_hint_fp_verify_success').id);
AuthUtils.getInstance().sendNotice(Constants.noticeEventWidgetReleased, [Constants.noticeTypeFinger]);
setTimeout(() => {
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}, SECOND);
}
return false;
}
onCmdDataChange(num?: string): void {
@@ -230,7 +300,7 @@ export default struct FingerprintAuth {
let lockoutDuration: number = 0;
let remainAttempts: number = 0;
let authResult: number = -1;
if (payload.type === Constants.noticeTypeFinger){
if (payload.type === Constants.noticeTypeFinger) {
if (item?.event === CmdNotifyEvents.CMD_NOTIFY_AUTH_TIP) {
const tipInfo: string = FuncUtils.getStringFromCharCode(payload.tipInfo);
if (tipInfo) {
@@ -245,7 +315,7 @@ export default struct FingerprintAuth {
remainAttempts = payload.remainAttempts;
authResult = payload.result;
}
} else if (payload.type === Constants.noticeTypePin){
} else if (payload.type === Constants.noticeTypePin) {
lockoutDuration = payload.lockoutDuration;
remainAttempts = payload.remainAttempts;
authResult = payload.result;
@@ -255,57 +325,13 @@ export default struct FingerprintAuth {
LogUtils.info(TAG,
`lockoutDuration: ${lockoutDuration} remainAttempts: ${remainAttempts} authResult: ${authResult}`);
if (payload.type === Constants.noticeTypePin) {
if (authResult === 0) {
AuthUtils.getInstance().sendNotice(Constants.noticeEventWidgetReleased, [Constants.noticeTypePin]);
setTimeout(() => {
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}, SECOND)
} else if (authResult && authResult === Constants.authResultPinExpired) {
this.inputValue = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_pwd_error').id);
this.textValue = '';
if (this.handleNoticeTypePinaAuthResult(authResult, lockoutDuration, remainAttempts, num)) {
return;
} else {
this.handleNoticeTypePinOtherAuthResult(lockoutDuration, remainAttempts, num);
}
} else if (payload.type === Constants.noticeTypeFinger) {
if ([MULTI_PIN, SIX_PIN].includes(this.state)) {
if (this.handleNoticeTypeFinger(payload, remainAttempts, authResult, num)) {
return;
}
this.handleNoticeTypeFingerFirst(payload, remainAttempts, authResult, num);
if (remainAttempts === AUTH_LOCK) {
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_title_number_failed_fp_forbidden').id);
this.fingerLock = true;
if (payload.tipType === UserAuthTipType.SINGLE_AUTH_RESULT) {
this.handlePinFingerDialogType();
if ((AppStorage.get('wantParams') as WantParams)?.navigationButtonText as string &&
this.skipLockedBiometricAuth) {
AuthUtils.getInstance().sendNotice(Constants.noticeEventWidgetReleased, [Constants.noticeTypeFinger]);
AuthUtils.getInstance()
.sendNotice(Constants.noticeEventUserNavigation, [Constants.noticeTypeFinger]);
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
return;
}
if (this.dialogType === DialogType.FINGER && this.skipLockedBiometricAuth) {
AuthUtils.getInstance().sendNotice(Constants.noticeEventWidgetReleased, [Constants.noticeTypeFinger]);
AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, [Constants.noticeTypeFinger]);
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
return;
}
} else {
this.handleOtherSingleAuthResult();
}
}
if (authResult === 0) {
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_fp_verify_success').id);
AuthUtils.getInstance().sendNotice(Constants.noticeEventWidgetReleased, [Constants.noticeTypeFinger]);
setTimeout(() => {
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}, SECOND);
}
} else {
LogUtils.error(TAG, 'onCmdDataChange default');
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
@@ -326,10 +352,11 @@ export default struct FingerprintAuth {
let freezingMillisecond = freezingTime;
// O: freezing FINISH
if (freezingMillisecond > 0) {
promptText = TimeUtils.getFreezingTimeNm(freezingMillisecond, (AppStorage.get('context') as common.ExtensionContext));
promptText =
TimeUtils.getFreezingTimeNm(freezingMillisecond, (AppStorage.get('context') as common.ExtensionContext));
promptText = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_many_failures').id) + promptText + TRY_AGAIN;
setTimeout((t: number):void => this.countTime(t), INTERVAL, freezingTime - INTERVAL);
setTimeout((t: number): void => this.countTime(t), INTERVAL, freezingTime - INTERVAL);
} else {
promptText = ' ';
this.isEdit = true;
@@ -339,11 +366,14 @@ export default struct FingerprintAuth {
onFingerPrintFontColor(prompt: string, context: Context): Resource {
if (prompt === context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_hint_fp_retry_s2').id) ||
prompt === context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_title_number_failed_fp_forbidden').id)) {
prompt ===
context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_title_number_failed_fp_forbidden')
.id)) {
return $r('sys.color.ohos_id_color_warning');
} else if (prompt === context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_hint_fp_verify_success').id) ||
context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_hint_inscreen_fp').id) ||
context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_hint_normal_fp_only').id)) {
} else if (prompt ===
context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_hint_fp_verify_success').id) ||
context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_hint_inscreen_fp').id) ||
context?.resourceManager?.getStringSync($r('app.string.unified_authwidget_hint_normal_fp_only').id)) {
return $r('sys.color.ohos_id_color_text_secondary');
} else {
return $r('sys.color.ohos_id_color_text_secondary');
@@ -386,14 +416,26 @@ export default struct FingerprintAuth {
build() {
Column() {
GridRow({
columns: { xs: 4, sm: 4, md: 8, lg: 12 },
columns: {
xs: 4,
sm: 4,
md: 8,
lg: 12
},
gutter: { x: 24, y: 24 },
breakpoints: { value: Constants.deviceDpi,
reference: BreakpointsReference.WindowSize },
breakpoints: {
value: Constants.deviceDpi,
reference: BreakpointsReference.WindowSize
},
direction: GridRowDirection.Row
}) {
GridCol({
span: { xs: 4, sm: 4, md: 4, lg: 6 },
span: {
xs: 4,
sm: 4,
md: 4,
lg: 6
},
offset: { md: 2, lg: 3 },
}) {
if (this.isOffFinger) {
@@ -415,9 +457,10 @@ export default struct FingerprintAuth {
.id('outFingerImage')
Text(this.prompt)
.draggable(false)
.fontColor(this.onFingerPrintFontColor(this.prompt, (AppStorage.get('context') as common.ExtensionContext)))
.fontColor(this.onFingerPrintFontColor(this.prompt,
(AppStorage.get('context') as common.ExtensionContext)))
.fontSize($r('sys.float.ohos_id_text_size_body2'))
}.margin({left: $r('app.float.size_24'), right: $r('app.float.size_24')})
}.margin({ left: $r('app.float.size_24'), right: $r('app.float.size_24') })
}
.width('100%')
.height($r('app.float.scroll_height_220'))
@@ -440,7 +483,8 @@ export default struct FingerprintAuth {
.id('outFingerImage')
Text(this.prompt)
.draggable(false)
.fontColor(this.onFingerPrintFontColor(this.prompt, (AppStorage.get('context') as common.ExtensionContext)))
.fontColor(this.onFingerPrintFontColor(this.prompt,
(AppStorage.get('context') as common.ExtensionContext)))
.fontSize($r('sys.float.ohos_id_text_size_body2'))
}
}
@@ -734,7 +778,7 @@ export default struct FingerprintAuth {
right: ($r('sys.float.ohos_id_dialog_margin_end')),
bottom: this.IS_LANDSCAPE ? '0' : ($r('sys.float.ohos_id_dialog_margin_bottom'))
})
} else if (this.state === PIN_FINGER && this.fingerPosition.udSensorRadiusInPx !== undefined ) {
} else if (this.state === PIN_FINGER && this.fingerPosition.udSensorRadiusInPx !== undefined) {
Column() {
if (this.screenType === ON_SCREEN) {
if (AppStorage.Get('titleLength') as number < (AppStorage.get('wantParams') as WantParams)?.title.length) {
@@ -744,7 +788,7 @@ 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')})
.margin({ left: $r('app.float.size_24'), right: $r('app.float.size_24') })
}
.width('100%')
.height($r('app.float.textArea_height'))
@@ -777,7 +821,8 @@ export default struct FingerprintAuth {
})
Text(this.prompt)
.draggable(false)
.fontColor(this.onFingerPrintFontColor(this.prompt, (AppStorage.get('context') as common.ExtensionContext)))
.fontColor(this.onFingerPrintFontColor(this.prompt,
(AppStorage.get('context') as common.ExtensionContext)))
.fontSize($r('sys.float.ohos_id_text_size_body2'))
Row() {
Column() {
@@ -870,8 +915,9 @@ export default struct FingerprintAuth {
.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, (AppStorage.get('context') as common.ExtensionContext)))
}.margin({left: $r('app.float.size_24'), right: $r('app.float.size_24')})
.fontColor(this.onFingerPrintFontColor(this.prompt,
(AppStorage.get('context') as common.ExtensionContext)))
}.margin({ left: $r('app.float.size_24'), right: $r('app.float.size_24') })
}
.width('100%')
.height($r('app.float.scroll_height_76'))
@@ -889,7 +935,8 @@ export default struct FingerprintAuth {
.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, (AppStorage.get('context') as common.ExtensionContext)))
.fontColor(this.onFingerPrintFontColor(this.prompt,
(AppStorage.get('context') as common.ExtensionContext)))
}
Image(this.prompt === (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_fp_verify_success').id)
@@ -918,14 +965,15 @@ export default struct FingerprintAuth {
} else if (this.state === SINGLE_FINGER) {
Column() {
if (this.screenType === ON_SCREEN && this.fingerPosition.udSensorRadiusInPx !== undefined) {
if (AppStorage.Get('titleLength') as number < (AppStorage.get('wantParams') as WantParams)?.title.length) {
if (AppStorage.Get('titleLength') as number <
(AppStorage.get('wantParams') as WantParams)?.title.length) {
Scroll() {
Text((AppStorage.get('wantParams') as 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')})
.margin({ left: $r('app.float.size_24'), right: $r('app.float.size_24') })
}
.width('100%')
.height($r('app.float.textArea_height'))
@@ -958,7 +1006,8 @@ export default struct FingerprintAuth {
})
Text(this.prompt)
.draggable(false)
.fontColor(this.onFingerPrintFontColor(this.prompt, (AppStorage.get('context') as common.ExtensionContext)))
.fontColor(this.onFingerPrintFontColor(this.prompt,
(AppStorage.get('context') as common.ExtensionContext)))
.fontSize($r('sys.float.ohos_id_text_size_body2'))
if (!((AppStorage.get('wantParams') as WantParams)?.navigationButtonText as string)) {
Row() {
@@ -1078,8 +1127,9 @@ export default struct FingerprintAuth {
.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, (AppStorage.get('context') as common.ExtensionContext)))
}.margin({left: $r('app.float.size_24'), right: $r('app.float.size_24')})
.fontColor(this.onFingerPrintFontColor(this.prompt,
(AppStorage.get('context') as common.ExtensionContext)))
}.margin({ left: $r('app.float.size_24'), right: $r('app.float.size_24') })
}
.width('100%')
.height($r('app.float.scroll_height_76'))
@@ -1097,7 +1147,8 @@ export default struct FingerprintAuth {
.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, (AppStorage.get('context') as common.ExtensionContext)))
.fontColor(this.onFingerPrintFontColor(this.prompt,
(AppStorage.get('context') as common.ExtensionContext)))
}
Image(this.prompt === (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_fp_verify_success').id)