!74 告警处理

Merge pull request !74 from 李蜜/master
This commit is contained in:
openharmony_ci
2025-03-05 03:39:15 +00:00
committed by Gitee
14 changed files with 263 additions and 256 deletions
@@ -76,9 +76,9 @@ export default struct FullScreen {
@StorageLink('passwordArrayNumber') passwordArrayNumber: string[] = [];
@State passwordObj: string = '';
numKeyboard: NumKeyBoardItem[] = Constants.numKeyBoard;
@State prompt: string = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
@State prompt: string = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_use_pwd').id);
@State fingerText: string = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
@State fingerText: string = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_inscreen_fp').id);
@StorageLink('screenLockDirection') screenLockDirection: number = 1;
@StorageLink('SYSTEM_STATUS_BAR_HEIGHT') SYSTEM_STATUS_BAR_HEIGHT: number = 0;
@@ -104,18 +104,18 @@ export default struct FullScreen {
if (payload.type === Constants.noticeTypePin) {
this.clearPassword();
if (payload.remainAttempts) {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_pwd_error').id);
if (num === 'first' && this.prompt !== (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
if (num === 'first' && this.prompt !== (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_recognition').id)) {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_use_pwd').id);
}
// 3: pin Residual number
if (payload.remainAttempts < 3 && num !== 'first') {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_pwd_error_can_try').id)
+ payload.remainAttempts + (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_pwd_error_can_try').id) +
payload.remainAttempts + (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_frequency').id);
}
}
@@ -130,12 +130,12 @@ export default struct FullScreen {
this.pinLock = 1;
}
if (payload.result === 0) {
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
} else if (payload.type === Constants.noticeTypeFace) {
if (payload.remainAttempts < 5 && payload.remainAttempts > 0) {
if (this.pinLock !== 1) {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_face_verify_fail_click_retry_s1').id);
this.faceFingerLockArr[0] = false;
}
@@ -145,30 +145,30 @@ export default struct FullScreen {
this.controlType.isShowFace = false;
} else {
if (this.pinLock !== 1) {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_recognition').id);
}
}
}
if (payload.remainAttempts === 0) {
if (num !== 'first') {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_title_number_failed_face_forbidden').id);
}
this.faceFingerLockArr[0] = true;
}
if (payload.result === 0) {
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
} else if (payload.type === Constants.noticeTypeFinger) {
let sensor: FingerPosition = { sensorType: '' };
let sensor: FingerPosition = { sensorType: '' };
if (payload.sensorInfo && JSON.stringify(payload.sensorInfo) !== '{}') {
sensor = JSON.parse(payload.sensorInfo);
this.fingerPosition = sensor || { sensorType: '' };
}
if (payload.remainAttempts && payload.result !== 0) {
if (this.controlType.jumpFinger) {
this.fingerText = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.fingerText = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_fp_retry_s2').id);
}
if (sensor && this.fingerPosition.udSensorCenterYInThousandth !== undefined &&
@@ -180,14 +180,15 @@ export default struct FullScreen {
setTimeout(() => {
AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypeFinger]);
}, NOTICE_DELAY);
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_fp_retry_s2').id);
}
this.fingerButtonPositionY = px2vp(this.fingerPosition.udSensorCenterYInThousandth / THOUSANDTH * this.screen[1]);
this.fingerButtonPositionY =
px2vp(this.fingerPosition.udSensorCenterYInThousandth / THOUSANDTH * this.screen[1]);
FuncUtils.judgmentOverflow(this.fingerButtonPositionY);
this.fingerPositionY = this.fingerButtonPositionY - this.SYSTEM_STATUS_BAR_HEIGHT
- this.SYSTEM_STATUS_BAR_HEIGHT - px2vp(this.fingerPosition.udSensorRadiusInPx * RADIUS) - PADDING_8;
this.fingerPositionY = this.fingerButtonPositionY - this.SYSTEM_STATUS_BAR_HEIGHT -
this.SYSTEM_STATUS_BAR_HEIGHT - px2vp(this.fingerPosition.udSensorRadiusInPx * RADIUS) - PADDING_8;
this.fingerPositionLine = this.fingerPositionY / px2vp(this.screen[1]);
FuncUtils.judgmentOverflow(this.fingerPositionLine);
if (num === 'first' && this.fingerPositionLine > FINGER_SENSOR_POSITION_LINE && payload.result != 0) {
@@ -200,9 +201,9 @@ export default struct FullScreen {
if (num === 'first') {
this.controlType.isShowFinger = false;
} else {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
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
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;
@@ -210,11 +211,11 @@ export default struct FullScreen {
this.cancelImage = false;
}
if (payload.result === 0) {
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
} else {
LogUtils.error(TAG, 'type: ' + payload.type);
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
})
}
@@ -235,16 +236,16 @@ export default struct FullScreen {
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) - PADDING_8;
this.fingerPositionY = this.fingerButtonPositionY - this.SYSTEM_STATUS_BAR_HEIGHT -
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) - PADDING_8;
this.fingerTipsPositionY = this.fingerButtonPositionY - px2vp(FINGER_Y_POSITION) - FINGER_HIGH -
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) - PADDING_8;
this.fingerTextPositionY = this.fingerButtonPositionY - px2vp(FINGER_Y_POSITION) - FINGER_TEXT_POSITION -
this.SYSTEM_STATUS_BAR_HEIGHT - px2vp(this.fingerPosition.udSensorRadiusInPx * RADIUS) - PADDING_8;
FuncUtils.judgmentOverflow(this.fingerTextPositionY);
}
@@ -254,7 +255,7 @@ export default struct FullScreen {
}
} catch (error) {
LogUtils.error(TAG, 'aboutToAppear catch error: ' + error?.code);
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
}
@@ -264,7 +265,7 @@ export default struct FullScreen {
this.passwordArray = ['', '', '', '', '', ''];
this.passwordObj = '';
this.numKeyboard[11].value = GO_BACK;
this.numKeyboard[11].row1 = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.numKeyboard[11].row1 = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_back').id);
this.updateStorage(() => {
})
@@ -275,16 +276,16 @@ 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 =PLEASE_TRY + promptText + TRY_AGAIN;
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);
} 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;
@@ -303,7 +304,7 @@ export default struct FullScreen {
Column() {
// 1: pin lock
if(this.pinLock === 1) {
if (this.pinLock === 1) {
Column() {
Text($r('app.string.unified_authwidget_locked'))
.draggable(false)
@@ -349,11 +350,11 @@ export default struct FullScreen {
.margin({ bottom: $r('app.float.content_padding') })
.onClick(() => {
if (!this.faceFingerLockArr[0]) {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_recognition').id);
AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypeFace]);
} else {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_title_face_forbidden').id);
}
})
@@ -376,9 +377,9 @@ export default struct FullScreen {
.textOverflow({ overflow: TextOverflow.None })
.height($r('app.float.size_24'))
.onClick(() => {
if (this.prompt === (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
if (this.prompt === (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_face_verify_fail_click_retry_s1').id)) {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_recognition').id);
AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypeFace]);
}
@@ -538,15 +539,16 @@ export default struct FullScreen {
// 0: pin unlock
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 && this.fingerPosition.udSensorRadiusInPx !== undefined
&& this.fingerPosition.udSensorCenterYInThousandth !== undefined) {
if (this.controlType.isShowFinger && this.fingerPosition.sensorType !== 'OUT_OF_SCREEN_SENSOR' &&
this.fingerPosition.sensorType !== 'NON_SENSOR') {
if (this.fingerPositionLine > FINGER_SENSOR_POSITION_LINE &&
this.fingerPosition.udSensorRadiusInPx !== undefined &&
this.fingerPosition.udSensorCenterYInThousandth !== undefined) {
Column() {
NumKeyBoard({
onKeyPress: (index , callback) => {
onKeyPress: (index, callback) => {
let keyValue = this.numKeyboard[index].value;
if (keyValue!= undefined && keyValue >= 0) {
if (keyValue != undefined && keyValue >= 0) {
const index = this.passwordArray.map(item => item).indexOf('')
if (index > -1) {
this.passwordArray[index] = keyValue + '';
@@ -570,7 +572,7 @@ 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
this.numKeyboard[11].row1 = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_back').id);
} else {
this.passwordArray[index - 1] = '';
@@ -580,9 +582,9 @@ export default struct FullScreen {
// 0: pin unlock
this.pinLock = 0;
this.clearPassword();
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, [] ||
(AppStorage.get("wantParams") as WantParams)?.type as string[]);
(AppStorage.get('wantParams') as WantParams)?.type as string[]);
} else if (keyValue === CALL_PHONE) {
if (this.passwordArray.join('').length < PASSWORD_ARRAY_LENGTH) {
return;
@@ -597,10 +599,10 @@ 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({
@@ -630,7 +632,7 @@ 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
this.numKeyboard[11].row1 = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_back').id);
} else {
this.passwordArray[index - 1] = '';
@@ -640,9 +642,9 @@ export default struct FullScreen {
// 0: pin unlock
this.pinLock = 0;
this.clearPassword();
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, [] ||
(AppStorage.get("wantParams") as WantParams)?.type as string[]);
(AppStorage.get('wantParams') as WantParams)?.type as string[]);
} else if (keyValue === CALL_PHONE) {
if (this.passwordArray.join('').length < PASSWORD_ARRAY_LENGTH) {
return;
@@ -656,8 +658,8 @@ 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() {
@@ -688,7 +690,7 @@ 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
this.numKeyboard[11].row1 = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_back').id);
} else {
this.passwordArray[index - 1] = '';
@@ -698,9 +700,9 @@ export default struct FullScreen {
// 0: pin unlock
this.pinLock = 0;
this.clearPassword();
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, [] ||
(AppStorage.get("wantParams") as WantParams)?.type as string[]);
(AppStorage.get('wantParams') as WantParams)?.type as string[]);
} else if (keyValue === CALL_PHONE) {
if (this.passwordArray.join('').length < PASSWORD_ARRAY_LENGTH) {
return;
@@ -715,8 +717,8 @@ 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 })
}
}
@@ -727,8 +729,9 @@ export default struct FullScreen {
if (this.fingerPosition.sensorType === 'UNDER_SCREEN_SENSOR' ||
this.fingerPosition.sensorType === 'BOTH_SENSOR' ||
this.fingerPosition.sensorType === 'SensorType1') {
if (this.fingerPositionLine > FINGER_SENSOR_POSITION_LINE && !this.IS_LANDSCAPE && this.fingerPosition.udSensorRadiusInPx !== undefined
&& this.fingerPosition.udSensorCenterYInThousandth !== undefined) {
if (this.fingerPositionLine > FINGER_SENSOR_POSITION_LINE && !this.IS_LANDSCAPE &&
this.fingerPosition.udSensorRadiusInPx !== undefined &&
this.fingerPosition.udSensorCenterYInThousandth !== undefined) {
Column() {
Image($r('app.media.ic_unlock_fingerprint'))
.draggable(false)
@@ -741,11 +744,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%')
.height(this.controlType.isShowFinger ? $r('app.float.finger_high') : '9%')
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.Center)
} else {
@@ -767,11 +770,11 @@ export default struct FullScreen {
})
}
.width(Constants.fullContainerWidth)
.height(this.controlType.isShowFinger ? $r('app.float.finger_high'): '9%')
.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 })
}
}
}
@@ -782,10 +785,10 @@ export default struct FullScreen {
.width(Constants.fullContainerWidth)
} else if (!this.controlType.isLandscape && this.fingerPosition.udSensorRadiusInPx !== undefined) {
Column() {
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() {
Column() {
Text((AppStorage.get("wantParams") as WantParams)?.title)
Text((AppStorage.get('wantParams') as WantParams)?.title)
.draggable(false)
.fontColor($r('sys.color.ohos_id_color_text_primary_contrary'))
.fontSize($r('sys.float.ohos_id_text_size_sub_title2'))
@@ -809,7 +812,7 @@ export default struct FullScreen {
.scrollable(ScrollDirection.Vertical)
.scrollBarColor('sys.color.ohos_id_color_foreground')
} else {
Text((AppStorage.get("wantParams") as WantParams)?.title)
Text((AppStorage.get('wantParams') as WantParams)?.title)
.draggable(false)
.height($r('app.float.text_high'))
.fontColor($r('sys.color.ohos_id_color_text_primary_contrary'))
@@ -861,7 +864,7 @@ export default struct FullScreen {
this.controlType.jumpFinger = false;
this.cancelImage = false;
AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, [Constants.noticeTypeFinger]);
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_use_pwd').id);
})
}
@@ -108,8 +108,10 @@ export default struct NumKeyBoard {
}
}
.onClick(() => {
setTimeout((index: number, callback: Function):void => this.onKeyPress?.(index, callback), 0, item.index, () => {
});
setTimeout((index: number, callback: Function): void => this.onKeyPress?.(index, callback), 0,
item.index,
() => {
});
})
.id('numKeyBordCustomPwd' + item.index)
}
@@ -44,10 +44,10 @@ export default struct PassWord {
build() {
Column() {
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() {
Column() {
Text((AppStorage.get("wantParams") as WantParams)?.title)
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'))
@@ -95,7 +95,7 @@ export default struct PassWord {
.scrollable(ScrollDirection.Vertical)
.scrollBarColor(Color.Gray)
} else {
Text((AppStorage.get("wantParams") as WantParams)?.title)
Text((AppStorage.get('wantParams') as WantParams)?.title)
.draggable(false)
.margin({ top: $r('app.float.title_padding_top') })
.fontSize($r('sys.float.ohos_id_text_size_body1'))
@@ -41,10 +41,10 @@ export default struct SixPassword {
build() {
Column() {
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() {
Column() {
Text((AppStorage.get("wantParams") as WantParams)?.title)
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'))
@@ -72,11 +72,11 @@ export default struct SixPassword {
{
left: $r('app.float.input_btn_padding_around'),
top: $r('app.float.margin_12')
}: { top: $r('app.float.margin_12') })
} : { top: $r('app.float.margin_12') })
.focusable(true)
}
}
}, (item: string) => item)
}, (item: string) => item)
}
.listDirection(Axis.Horizontal)
.height($r('app.float.input_height'))
@@ -115,7 +115,7 @@ export default struct SixPassword {
.scrollable(ScrollDirection.Vertical)
.scrollBarColor(Color.Gray)
} else {
Text((AppStorage.get("wantParams") as WantParams)?.title)
Text((AppStorage.get('wantParams') as WantParams)?.title)
.draggable(false)
.margin({ top: $r('app.float.title_padding_top') })
.fontSize($r('sys.float.ohos_id_text_size_body1'))
@@ -144,7 +144,7 @@ export default struct SixPassword {
{
left: $r('app.float.input_btn_padding_around'),
top: $r('app.float.margin_12')
}: { top: $r('app.float.margin_12') })
} : { top: $r('app.float.margin_12') })
.focusable(true)
}
}
+2 -2
View File
@@ -33,7 +33,7 @@ export default class AuthUtils {
sendNotice(cmd: string, type: Array<string>): void {
try {
const eventData = {
widgetContextId: AppStorage.get("widgetContextId"),
widgetContextId: AppStorage.get('widgetContextId'),
event: cmd,
version: Constants.noticeVersion,
payload: {
@@ -46,7 +46,7 @@ export default class AuthUtils {
LogUtils.info(TAG, 'sendNotice success');
} catch (error) {
LogUtils.error(TAG, 'sendNotice catch error: ' + error?.code);
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
}
}
+1 -1
View File
@@ -82,7 +82,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);
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
}
}
@@ -30,7 +30,7 @@ export class WindowPrivacyUtils {
});
} catch (error) {
LogUtils.error(TAG, 'setWindowPrivacyMode catch error: ' + error?.code);
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
}
}
+1 -1
View File
@@ -46,7 +46,7 @@ export default class Constants {
static noticeEventCancel = 'EVENT_AUTH_USER_CANCEL';
static noticeEventInvalidParam = 'EVENT_AUTH_WIDGET_PARA_INVALID';
static numKeyBoard : NumKeyBoardItem[]= [
static numKeyBoard : NumKeyBoardItem[] = [
{
index: 0,
row1: '1',
@@ -27,7 +27,7 @@ const MASK_THIN_COLOR = '#33182431';
export default class UserAuthAbility extends UserAuthExtensionAbility {
onCreate() {
LogUtils.info(TAG, 'UserAuthExtensionAbility onCreate');
AppStorage.setOrCreate("context", this.context);
AppStorage.setOrCreate('context', this.context);
}
onForeground(): void {
@@ -36,7 +36,7 @@ export default class UserAuthAbility extends UserAuthExtensionAbility {
onBackground(): void {
LogUtils.info(TAG, 'UserAuthExtensionAbility onBackground');
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
onDestroy(): void | Promise<void> {
@@ -45,11 +45,11 @@ export default class UserAuthAbility extends UserAuthExtensionAbility {
onSessionCreate(want, session): void {
LogUtils.info(TAG, 'UserAuthExtensionAbility onSessionCreate');
AppStorage.setOrCreate("wantParams", want?.parameters?.useriamCmdData);
AppStorage.setOrCreate("session", session);
AppStorage.setOrCreate('wantParams', want?.parameters?.useriamCmdData);
AppStorage.setOrCreate('session', session);
(session as UIExtensionContentSession)?.loadContent('pages/Index');
try {
if ((AppStorage.get("wantParams") as WantParams)?.windowModeType === 'DIALOG_BOX') {
if ((AppStorage.get('wantParams') as WantParams)?.windowModeType === 'DIALOG_BOX') {
(session as UIExtensionContentSession)?.setWindowBackgroundColor(MASK_THIN_COLOR);
} else {
(session as UIExtensionContentSession)?.setWindowBackgroundColor(TRANSPARENT_COLOR);
+14 -14
View File
@@ -52,28 +52,28 @@ struct Index {
screen.getAllScreens((err, data) => {
if (err.code) {
LogUtils.error(TAG, 'Failed to get all screens. err: ' + err.code);
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
return;
}
LogUtils.debug(TAG, ' get all screens. result:-- ' + JSON.stringify(data));
this.isLandscape = data[0]?.orientation === LANDSCAPE
|| data[0]?.supportedModeInfo[0]?.width > data[0]?.supportedModeInfo[0]?.height;
this.isLandscape = data[0]?.orientation === LANDSCAPE ||
data[0]?.supportedModeInfo[0]?.width > data[0]?.supportedModeInfo[0]?.height;
AppStorage.SetOrCreate('titleLength', (data[0]?.supportedModeInfo[0]?.width * 0.8 / fp2px(16)))
LogUtils.debug(TAG, 'titleLength: ' + (data[0]?.supportedModeInfo[0]?.width * 0.8 / fp2px(16)));
LogUtils.debug(TAG, 'title: ' + (AppStorage.get("wantParams") as WantParams)?.title.length);
LogUtils.debug(TAG, 'title: ' + (AppStorage.get('wantParams') as WantParams)?.title.length);
AppStorage.SetOrCreate('IS_LANDSCAPE', this.isLandscape);
LogUtils.debug(TAG, 'WantParams ' + JSON.stringify(AppStorage.get("wantParams") as WantParams));
if ((AppStorage.get("wantParams") as WantParams)) {
this.getParams((AppStorage.get("wantParams") as WantParams));
LogUtils.debug(TAG, 'WantParams ' + JSON.stringify(AppStorage.get('wantParams') as WantParams));
if ((AppStorage.get('wantParams') as WantParams)) {
this.getParams((AppStorage.get('wantParams') as WantParams));
this.handleAuthStart();
this.cmdData = (AppStorage.get("wantParams") as WantParams)?.cmd as CmdType[];
this.cmdData = (AppStorage.get('wantParams') as WantParams)?.cmd as CmdType[];
} else {
LogUtils.error(TAG, 'aboutToAppear wantParams null');
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
if (this.isLandscape && this.underFingerPrint) {
setTimeout(() => {
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}, FIVE_SECOND)
} else {
this.loadFlag = true;
@@ -81,7 +81,7 @@ struct Index {
});
} catch (error) {
LogUtils.error(TAG, 'getAllScreens catch error: ' + error?.code);
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
}
@@ -102,7 +102,7 @@ struct Index {
});
} catch (error) {
LogUtils.error(TAG, 'getUserAuthWidgetMgr catch error: ' + error?.code);
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
}
@@ -159,7 +159,7 @@ struct Index {
return userAuth.UserAuthType.PIN;
}
})
AppStorage.setOrCreate("widgetContextId", resultInfo?.widgetContextId);
AppStorage.setOrCreate('widgetContextId', resultInfo?.widgetContextId);
this.authType = newType;
this.type = resultInfo?.type;
this.windowModeType = resultInfo?.windowModeType;
@@ -173,7 +173,7 @@ struct Index {
if (this.isLandscape && this.underFingerPrint) {
Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Center, alignItems: ItemAlign.End }) {
Column() {
Text((AppStorage.get("context") as common.ExtensionContext)?.resourceManager
Text((AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_tip_verify_in_portrait_mode').id))
.draggable(false)
.fontColor($r('sys.color.ohos_id_color_text_primary_contrary'))
@@ -61,7 +61,7 @@ export default struct CustomPassword {
});
} catch (error) {
LogUtils.error(TAG, 'aboutToAppear PINAuth catch error: ' + error?.code);
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
}
@@ -91,11 +91,11 @@ export default struct CustomPassword {
.height($r('app.float.image_back_size'))
.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)
? $r('sys.color.ohos_id_color_hover') : Color.Transparent)
.onClick(() => {
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, [] ||
(AppStorage.get("wantParams") as WantParams)?.type as string[]);
(AppStorage.get('wantParams') as WantParams)?.type as string[]);
})
.onTouch((event?: TouchEvent) => {
if (event == undefined) {
@@ -48,7 +48,7 @@ let pinData = '';
@Component
export default struct FaceAuth {
@State prompt: string = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
@State prompt: string = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_recognition').id);
@State @Watch('onTextValueChange') textValue: string = '';
@Link @Watch('onCmdDataChange') cmdData: Array<CmdType>;
@@ -73,12 +73,12 @@ export default struct FaceAuth {
@StorageLink('SYSTEM_NAVIGATION_BAR_HEIGHT') SYSTEM_NAVIGATION_BAR_HEIGHT: number = 0;
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 = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
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);
} else {
@@ -105,7 +105,7 @@ export default struct FaceAuth {
try {
if (this.dialogType === DialogType.PIN_FACE || this.dialogType === DialogType.FACE) {
this.prompt =
(AppStorage.get("context") as common.ExtensionContext)?.resourceManager?.getStringSync($r('app.string.unified_authwidget_hint_recognition')
(AppStorage.get('context') as common.ExtensionContext)?.resourceManager?.getStringSync($r('app.string.unified_authwidget_hint_recognition')
.id);
AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypeFace]);
} else if (this.dialogType === DialogType.ALL || this.dialogType === DialogType.FACE_FINGER_NAVIGATION) {
@@ -114,7 +114,7 @@ export default struct FaceAuth {
} else {
LogUtils.error(TAG, 'aboutToAppear not support type');
AuthUtils.getInstance().sendNotice(Constants.noticeEventInvalidParam, [Constants.noticeTypePin]);
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
if (this.cmdData && this.cmdData.length > 0) {
@@ -129,11 +129,11 @@ export default struct FaceAuth {
let tempFingerPositionY = px2vp(this.screen[1]) * this.fingerPosition.udSensorCenterYInThousandth;
FuncUtils.judgmentOverflow(tempFingerPositionY);
if (tempPosition < FINGER_SENSOR_POSITION_LINE) {
this.fingerPositionY = (tempFingerPositionY / THOUSANDTH) - px2vp(this.screen[1])
+ this.SYSTEM_NAVIGATION_BAR_HEIGHT - MARGIN_TOP - px2vp(this.fingerPosition.udSensorRadiusInPx);
this.fingerPositionY = (tempFingerPositionY / THOUSANDTH) - px2vp(this.screen[1]) +
this.SYSTEM_NAVIGATION_BAR_HEIGHT - MARGIN_TOP - px2vp(this.fingerPosition.udSensorRadiusInPx);
} else {
this.fingerPositionY = (tempFingerPositionY / THOUSANDTH) - px2vp(this.screen[1])
+ this.SYSTEM_NAVIGATION_BAR_HEIGHT - PADDING_24 - px2vp(this.fingerPosition.udSensorRadiusInPx);
this.fingerPositionY = (tempFingerPositionY / THOUSANDTH) - px2vp(this.screen[1]) +
this.SYSTEM_NAVIGATION_BAR_HEIGHT - PADDING_24 - px2vp(this.fingerPosition.udSensorRadiusInPx);
}
FuncUtils.judgmentOverflow(this.fingerPositionY);
}
@@ -148,7 +148,7 @@ export default struct FaceAuth {
});
} catch (error) {
LogUtils.error(TAG, 'aboutToAppear catch error: ' + error?.code);
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
}
@@ -160,7 +160,8 @@ export default struct FaceAuth {
if ([DialogType.PIN_FACE, DialogType.ALL].includes(this.dialogType)) {
LogUtils.debug(TAG, 'toPin this.dialogType: ' + this.dialogType);
if (this.dialogType === DialogType.ALL) {
AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, [Constants.noticeTypeFace, Constants.noticeTypeFinger]);
AuthUtils.getInstance()
.sendNotice(Constants.noticeEventCancel, [Constants.noticeTypeFace, Constants.noticeTypeFinger]);
} else if (this.dialogType === DialogType.PIN_FACE) {
AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, [Constants.noticeTypeFace]);
} else {
@@ -176,7 +177,7 @@ export default struct FaceAuth {
sendFaceEvent(): void {
if (!this.faceLock) {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_recognition').id);
AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypeFace]);
}
@@ -212,24 +213,24 @@ export default struct FaceAuth {
const payload: CmdData = item.payload;
if (payload.type === Constants.noticeTypePin) {
if (payload.result === 0) {
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
} else if (payload.result && payload.result === Constants.authResultPinExpired) {
this.inputValue = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.inputValue = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_pwd_error').id);
this.textValue = '';
return;
} else {
if (payload.remainAttempts) {
this.inputValue = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.inputValue = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_pwd_error').id);
this.textValue = '';
if (num === 'first') {
this.inputValue = '';
}
if (payload.remainAttempts < HINT_TIMES_BY_FAIL_LESS) {
this.inputValue = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_pwd_error_can_try').id)
+ payload.remainAttempts + (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.inputValue = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_pwd_error_can_try').id) +
payload.remainAttempts + (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_frequency').id);
}
}
@@ -245,22 +246,22 @@ export default struct FaceAuth {
return;
}
if (payload.result && payload.result === Constants.authResultPinExpired) {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
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;
}
if (payload.remainAttempts && payload.result !== 0) {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
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;
}
if (num === 'first') {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_recognition').id);
}
if (payload.remainAttempts === 0) {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_title_number_failed_face_forbidden').id);
this.faceLock = true;
if (this.dialogType === DialogType.ALL) {
@@ -272,10 +273,10 @@ export default struct FaceAuth {
}
}
if (payload.result === 0) {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_recognize_success').id)
setTimeout(() => {
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}, SECOND);
}
} else if (payload.type === Constants.noticeTypeFinger) {
@@ -311,16 +312,16 @@ export default struct FaceAuth {
}
}
if ((payload.remainAttempts && payload.result !== 0) || payload.result === Constants.authResultPinExpired) {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
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
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_normal_fp_only').id);
}
if (payload.remainAttempts === 0) {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
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 (this.dialogType === DialogType.ALL) {
@@ -332,15 +333,15 @@ export default struct FaceAuth {
}
}
if (payload.result === 0) {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_fp_verify_success').id)
setTimeout(() => {
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}, SECOND);
}
} else {
LogUtils.error(TAG, 'onCmdDataChange default');
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
})
}
@@ -350,9 +351,9 @@ export default struct FaceAuth {
AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, [Constants.noticeTypePin]);
} else {
AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, [] ||
(AppStorage.get("wantParams") as WantParams)?.type as string[]);
(AppStorage.get('wantParams') as WantParams)?.type as string[]);
}
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
build() {
@@ -459,7 +460,7 @@ export default struct FaceAuth {
bottom: this.IS_LANDSCAPE ? '0' : ($r('sys.float.ohos_id_dialog_margin_bottom'))
})
} else if (this.dialogTypeFlag === PIN_FACE_FINGER && this.screenType === SCREEN_PORTRAIT &&
this.fingerPosition.udSensorRadiusInPx !== undefined) {
this.fingerPosition.udSensorRadiusInPx !== undefined) {
Column() {
// The first form of facial fingerprint password
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
@@ -494,7 +495,7 @@ export default struct FaceAuth {
})
}
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() {
Column() {
Image($r('app.media.error_faceID'))
@@ -507,7 +508,7 @@ export default struct FaceAuth {
.onClick(() => {
this.sendFaceEvent();
})
Text((AppStorage.get("wantParams") as WantParams)?.title)
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'))
@@ -518,7 +519,7 @@ 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)))
.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%')
@@ -537,7 +538,7 @@ export default struct FaceAuth {
.onClick(() => {
this.sendFaceEvent();
})
Text((AppStorage.get("wantParams") as WantParams)?.title)
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'))
@@ -549,7 +550,7 @@ 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)))
.fontColor(this.onFontColor(this.prompt, (AppStorage.get('context') as common.ExtensionContext)))
}
Image($r('app.media.ic_blue_fingerprint'))
.draggable(false)
@@ -574,10 +575,10 @@ export default struct FaceAuth {
right: ($r('sys.float.ohos_id_dialog_margin_end')),
bottom: ($r('sys.float.ohos_id_dialog_margin_bottom'))
})
} else if (this.dialogTypeFlag === PIN_FACE_FINGER && this.screenType === SCREEN_LAND
&& this.fingerPosition.udSensorRadiusInPx !== undefined) {
} else if (this.dialogTypeFlag === PIN_FACE_FINGER && this.screenType === SCREEN_LAND &&
this.fingerPosition.udSensorRadiusInPx !== undefined) {
Column() {
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() {
Column() {
// Facial fingerprint password, second form
@@ -591,7 +592,7 @@ export default struct FaceAuth {
.onClick(() => {
this.sendFaceEvent();
})
Text((AppStorage.get("wantParams") as WantParams)?.title)
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'))
@@ -615,7 +616,7 @@ export default struct FaceAuth {
.onClick(() => {
this.sendFaceEvent();
})
Text((AppStorage.get("wantParams") as WantParams)?.title)
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'))
@@ -638,9 +639,9 @@ export default struct FaceAuth {
.margin({ top: $r('app.float.content_padding') })
.fontSize($r('sys.float.ohos_id_text_size_body2'))
.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(() => {
if (this.prompt === (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
if (this.prompt === (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
?.getStringSync($r('app.string.unified_authwidget_hint_face_verify_fail_click_retry_s1').id)) {
this.sendFaceEvent();
}
@@ -698,9 +699,9 @@ export default struct FaceAuth {
})
}
} else if (this.dialogType === DialogType.FACE_FINGER_NAVIGATION &&
(AppStorage.get("wantParams") as WantParams)?.navigationButtonText as string) {
(AppStorage.get('wantParams') as WantParams)?.navigationButtonText as string) {
Column() {
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() {
Column() {
// Facial fingerprint password, second form
@@ -714,7 +715,7 @@ export default struct FaceAuth {
.onClick(() => {
this.sendFaceEvent();
})
Text((AppStorage.get("wantParams") as WantParams)?.title)
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'))
@@ -738,7 +739,7 @@ export default struct FaceAuth {
.onClick(() => {
this.sendFaceEvent();
})
Text((AppStorage.get("wantParams") as WantParams)?.title)
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'))
@@ -761,9 +762,9 @@ export default struct FaceAuth {
.margin({ top: $r('app.float.content_padding') })
.fontSize($r('sys.float.ohos_id_text_size_body2'))
.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(() => {
if (this.prompt === (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
if (this.prompt === (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
?.getStringSync($r('app.string.unified_authwidget_hint_face_verify_fail_click_retry_s1').id)) {
this.sendFaceEvent();
}
@@ -791,7 +792,7 @@ export default struct FaceAuth {
.color($r('sys.color.ohos_id_color_list_separator'))
.width($r('app.float.divider_width'))
Column() {
Button((AppStorage.get("wantParams") as WantParams)?.navigationButtonText as string)
Button((AppStorage.get('wantParams') as WantParams)?.navigationButtonText as string)
.id('usePwdBtnFaceAuth')
.margin({ right: $r('app.float.content_padding') })
.width(Constants.ninetyPercentWidth)
@@ -804,7 +805,7 @@ export default struct FaceAuth {
AuthUtils.getInstance()
.sendNotice('EVENT_AUTH_USER_NAVIGATION',
[Constants.noticeTypeFace, Constants.noticeTypeFinger]);
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
})
}.width(Constants.halfContainerWidth)
@@ -825,15 +826,15 @@ export default struct FaceAuth {
Column() {
if (this.dialogTypeFlag === PIN_FACE) {
// Pin FACE
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() {
Column() {
Text((AppStorage.get("wantParams") as WantParams)?.title)
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)
Image(this.prompt !== (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
Image(this.prompt !== (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_recognize_success').id)
? $r('app.media.error_faceID') : $r('app.media.right_faceID'))
.draggable(false)
@@ -849,7 +850,7 @@ export default struct FaceAuth {
})
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();
@@ -862,14 +863,14 @@ export default struct FaceAuth {
.scrollable(ScrollDirection.Vertical)
.scrollBarColor(Color.Gray)
} else {
Text((AppStorage.get("wantParams") as WantParams)?.title)
Text((AppStorage.get('wantParams') as 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.prompt !== (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
Image(this.prompt !== (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_recognize_success').id)
? $r('app.media.error_faceID') : $r('app.media.right_faceID'))
.draggable(false)
@@ -885,7 +886,7 @@ export default struct FaceAuth {
})
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();
@@ -1008,16 +1009,16 @@ export default struct FaceAuth {
}
if (this.dialogTypeFlag === SINGLE_FACE) {
// Single FACE
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() {
Column() {
Text((AppStorage.get("wantParams") as WantParams)?.title)
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)
.id('titleFaceAuth')
Image(this.prompt !== (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
Image(this.prompt !== (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_recognize_success').id)
? $r('app.media.error_faceID') : $r('app.media.right_faceID'))
.draggable(false)
@@ -1037,7 +1038,7 @@ 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();
})
@@ -1049,7 +1050,7 @@ export default struct FaceAuth {
.scrollable(ScrollDirection.Vertical)
.scrollBarColor(Color.Gray)
} else {
Text((AppStorage.get("wantParams") as WantParams)?.title)
Text((AppStorage.get('wantParams') as WantParams)?.title)
.draggable(false)
.margin({ top: $r('app.float.title_padding_top') })
.fontSize($r('sys.float.ohos_id_text_size_body1'))
@@ -1057,7 +1058,7 @@ export default struct FaceAuth {
.height($r('app.float.size_24'))
.fontWeight(FontWeight.Medium)
.id('titleFaceAuth')
Image(this.prompt !== (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
Image(this.prompt !== (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_recognize_success').id)
? $r('app.media.error_faceID') : $r('app.media.right_faceID'))
.draggable(false)
@@ -1077,12 +1078,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();
})
}
if (!((AppStorage.get("wantParams") as WantParams)?.navigationButtonText as string)) {
if (!((AppStorage.get('wantParams') as WantParams)?.navigationButtonText as string)) {
Row() {
Column() {
Button($r('app.string.unified_authwidget_cancel'), { stateEffect: true })
@@ -1123,10 +1124,10 @@ export default struct FaceAuth {
.color($r('sys.color.ohos_id_color_list_separator'))
.width($r('app.float.divider_width'))
Column() {
Button((AppStorage.get("wantParams") as WantParams)?.navigationButtonText as string)
Button((AppStorage.get('wantParams') as WantParams)?.navigationButtonText as string)
.onClick(() => {
AuthUtils.getInstance().sendNotice('EVENT_AUTH_USER_NAVIGATION', [Constants.noticeTypeFace]);
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
})
.margin({ right: $r('app.float.content_padding') })
.width(Constants.ninetyPercentWidth)
@@ -53,7 +53,7 @@ export default struct FingerprintAuth {
@Link type: string;
@Link pinSubType: string;
@Link dialogType: DialogType;
@State prompt: string = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
@State prompt: string = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_inscreen_fp').id);
@State @Watch('onTextValueChange') textValue: string = '';
@Link @Watch('onCmdDataChange') cmdData: Array<CmdType>;
@@ -78,12 +78,13 @@ export default struct FingerprintAuth {
if (this.cmdData && this.cmdData.length > 0) {
this.onCmdDataChange('first');
}
if (this.fingerPosition.udSensorCenterYInThousandth !== undefined && (this.screenType === ON_SCREEN || this.screenType === UNDER_SCREEN)) {
if (this.fingerPosition.udSensorCenterYInThousandth !== undefined && (this.screenType === ON_SCREEN ||
this.screenType === UNDER_SCREEN)) {
let tempPositionY = px2vp(this.fingerPosition.udSensorCenterYInThousandth * this.screen[1]);
FuncUtils.judgmentOverflow(tempPositionY);
if (this.screenType === ON_SCREEN) {
this.fingerPositionY = px2vp(this.screen[1]) - tempPositionY / THOUSANDTH + BOTTOM_BUTTON
+ PADDING_8 + BOTTOM_TEXT + PADDING_24;
this.fingerPositionY = px2vp(this.screen[1]) - tempPositionY / THOUSANDTH + BOTTOM_BUTTON +
PADDING_8 + BOTTOM_TEXT + PADDING_24;
} else if (this.screenType === UNDER_SCREEN) {
this.fingerPositionY = px2vp(this.screen[1]) - tempPositionY / THOUSANDTH + PADDING_24;
}
@@ -100,7 +101,7 @@ export default struct FingerprintAuth {
});
} catch (error) {
LogUtils.error(TAG, 'aboutToAppear PINAuth catch error: ' + error?.code);
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
}
@@ -118,24 +119,24 @@ export default struct FingerprintAuth {
const payload: CmdData = item.payload;
if (payload.type === Constants.noticeTypePin) {
if (payload.result === 0) {
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
} else if (payload.result && payload.result === Constants.authResultPinExpired) {
this.inputValue = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.inputValue = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_pwd_error').id);
this.textValue = '';
return;
} else {
if (payload.remainAttempts) {
this.inputValue = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.inputValue = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_pwd_error').id);
this.textValue = '';
if (num === 'first') {
this.inputValue = '';
}
if (payload.remainAttempts < PIN_FAIL_TIP) {
this.inputValue = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.inputValue = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_pwd_error_can_try').id) +
payload.remainAttempts + (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
payload.remainAttempts + (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_frequency').id);
}
}
@@ -171,18 +172,18 @@ export default struct FingerprintAuth {
}
}
if ((payload.remainAttempts && payload.result !== 0) || payload.result === Constants.authResultPinExpired) {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
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
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);
}
if (payload.remainAttempts === AUTH_LOCK) {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
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 (this.dialogType === DialogType.PIN_FINGER) {
@@ -195,15 +196,15 @@ export default struct FingerprintAuth {
}
}
if (payload.result === 0) {
this.prompt = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_fp_verify_success').id)
setTimeout(() => {
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}, SECOND);
}
} else {
LogUtils.error(TAG, 'onCmdDataChange default');
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
})
}
@@ -215,14 +216,14 @@ export default struct FingerprintAuth {
}
countTime(freezingTime: number): void {
const TRY_AGAIN = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
const TRY_AGAIN = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_postretry').id);
let promptText: string = '';
let freezingMillisecond = freezingTime;
// O: freezing FINISH
if (freezingMillisecond > 0) {
promptText = TimeUtils.getFreezingTimeNm(freezingMillisecond, (AppStorage.get("context") as common.ExtensionContext));
promptText = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
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);
} else {
@@ -263,9 +264,9 @@ export default struct FingerprintAuth {
AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, [Constants.noticeTypePin]);
} else {
AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, [] ||
(AppStorage.get("wantParams") as WantParams)?.type as string[]);
(AppStorage.get('wantParams') as WantParams)?.type as string[]);
}
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
toPin(): void {
@@ -294,10 +295,10 @@ export default struct FingerprintAuth {
if (this.isOffFinger) {
Column() {
if ([PIN_FINGER, SINGLE_FINGER].includes(this.state) && this.fingerPosition !== 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() {
Column() {
Text((AppStorage.get("wantParams") as WantParams)?.title)
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'))
@@ -310,7 +311,7 @@ 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')})
}
@@ -320,7 +321,7 @@ export default struct FingerprintAuth {
.scrollable(ScrollDirection.Vertical)
.scrollBarColor(Color.Gray)
} else {
Text((AppStorage.get("wantParams") as WantParams)?.title)
Text((AppStorage.get('wantParams') as WantParams)?.title)
.draggable(false)
.margin({ top: $r('app.float.title_padding_top') })
.fontSize($r('sys.float.ohos_id_text_size_body1'))
@@ -335,7 +336,7 @@ 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'))
}
}
@@ -382,7 +383,7 @@ export default struct FingerprintAuth {
.height($r('app.float.btn_height'))
.margin({ top: $r('app.float.element_margin'), bottom: $r('app.float.content_padding') })
} else if (this.state === SINGLE_FINGER) {
if (!((AppStorage.get("wantParams") as WantParams)?.navigationButtonText as string)) {
if (!((AppStorage.get('wantParams') as WantParams)?.navigationButtonText as string)) {
Row() {
Column() {
Button($r('app.string.unified_authwidget_cancel'), { stateEffect: true })
@@ -424,11 +425,11 @@ export default struct FingerprintAuth {
.color($r('sys.color.ohos_id_color_list_separator'))
.width($r('app.float.divider_width'))
Column() {
Button((AppStorage.get("wantParams") as WantParams)?.navigationButtonText as string)
Button((AppStorage.get('wantParams') as WantParams)?.navigationButtonText as string)
.onClick(() => {
AuthUtils.getInstance()
.sendNotice('EVENT_AUTH_USER_NAVIGATION', [Constants.noticeTypeFinger]);
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
})
.margin({ right: $r('app.float.content_padding') })
.width(Constants.ninetyPercentWidth)
@@ -614,9 +615,9 @@ export default struct FingerprintAuth {
} 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) {
if (AppStorage.Get('titleLength') as number < (AppStorage.get('wantParams') as WantParams)?.title.length) {
Scroll() {
Text((AppStorage.get("wantParams") as WantParams)?.title)
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'))
@@ -629,7 +630,7 @@ export default struct FingerprintAuth {
.scrollable(ScrollDirection.Vertical)
.scrollBarColor(Color.Gray)
} else {
Text((AppStorage.get("wantParams") as WantParams)?.title)
Text((AppStorage.get('wantParams') as WantParams)?.title)
.draggable(false)
.margin({ top: $r('app.float.title_padding_top') })
.fontSize($r('sys.float.ohos_id_text_size_body1'))
@@ -637,7 +638,7 @@ export default struct FingerprintAuth {
.height($r('app.float.size_24'))
.fontWeight(FontWeight.Medium)
}
Image(this.prompt === (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
Image(this.prompt === (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_fp_verify_success').id)
? $r('app.media.right_faceID') : $r('app.media.ic_blue_fingerprint'))
.draggable(false)
@@ -654,7 +655,7 @@ 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() {
@@ -728,10 +729,10 @@ export default struct FingerprintAuth {
})
}
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() {
Column() {
Text((AppStorage.get("wantParams") as WantParams)?.title)
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'))
@@ -741,7 +742,7 @@ 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)))
}.margin({left: $r('app.float.size_24'), right: $r('app.float.size_24')})
}
.width('100%')
@@ -749,7 +750,7 @@ export default struct FingerprintAuth {
.scrollable(ScrollDirection.Vertical)
.scrollBarColor(Color.Gray)
} else {
Text((AppStorage.get("wantParams") as WantParams)?.title)
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'))
@@ -760,9 +761,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)))
.fontColor(this.onFingerPrintFontColor(this.prompt, (AppStorage.get('context') as common.ExtensionContext)))
}
Image(this.prompt === (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
Image(this.prompt === (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_fp_verify_success').id)
? $r('app.media.right_faceID') : $r('app.media.ic_blue_fingerprint'))
.draggable(false)
@@ -789,9 +790,9 @@ 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)
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'))
@@ -804,7 +805,7 @@ export default struct FingerprintAuth {
.scrollable(ScrollDirection.Vertical)
.scrollBarColor(Color.Gray)
} else {
Text((AppStorage.get("wantParams") as WantParams)?.title)
Text((AppStorage.get('wantParams') as WantParams)?.title)
.draggable(false)
.margin({ top: $r('app.float.title_padding_top') })
.fontSize($r('sys.float.ohos_id_text_size_body1'))
@@ -812,7 +813,7 @@ export default struct FingerprintAuth {
.height($r('app.float.size_24'))
.fontWeight(FontWeight.Medium)
}
Image(this.prompt === (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
Image(this.prompt === (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_fp_verify_success').id)
? $r('app.media.right_faceID') : $r('app.media.ic_blue_fingerprint'))
.draggable(false)
@@ -829,9 +830,9 @@ 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)) {
if (!((AppStorage.get('wantParams') as WantParams)?.navigationButtonText as string)) {
Row() {
Column() {
Button($r('app.string.unified_authwidget_cancel'), { stateEffect: true })
@@ -873,11 +874,11 @@ export default struct FingerprintAuth {
.color($r('sys.color.ohos_id_color_list_separator'))
.width($r('app.float.divider_width'))
Column() {
Button(((AppStorage.get("wantParams") as WantParams)?.navigationButtonText as string))
Button(((AppStorage.get('wantParams') as WantParams)?.navigationButtonText as string))
.onClick(() => {
AuthUtils.getInstance()
.sendNotice('EVENT_AUTH_USER_NAVIGATION', [Constants.noticeTypeFinger]);
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
})
.id('navigationButtonTextFingerprintAuth')
.margin({ right: $r('app.float.content_padding') })
@@ -907,8 +908,8 @@ export default struct FingerprintAuth {
this.handleCancel();
this.textValue = '';
})
if ((AppStorage.get("wantParams") as WantParams)?.navigationButtonText as string) {
Button((AppStorage.get("wantParams") as WantParams)?.navigationButtonText as string)
if ((AppStorage.get('wantParams') as WantParams)?.navigationButtonText as string) {
Button((AppStorage.get('wantParams') as WantParams)?.navigationButtonText as string)
.id('fingerUnderButton')
.backgroundColor(Color.White)
.height($r('app.float.digital_password_mask_height'))
@@ -923,15 +924,15 @@ export default struct FingerprintAuth {
.onClick(() => {
AuthUtils.getInstance()
.sendNotice('EVENT_AUTH_USER_NAVIGATION', [Constants.noticeTypeFinger]);
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
})
}
}
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() {
Column() {
Text((AppStorage.get("wantParams") as WantParams)?.title)
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'))
@@ -941,7 +942,7 @@ 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)))
}.margin({left: $r('app.float.size_24'), right: $r('app.float.size_24')})
}
.width('100%')
@@ -949,7 +950,7 @@ export default struct FingerprintAuth {
.scrollable(ScrollDirection.Vertical)
.scrollBarColor(Color.Gray)
} else {
Text((AppStorage.get("wantParams") as WantParams)?.title)
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'))
@@ -960,9 +961,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)))
.fontColor(this.onFingerPrintFontColor(this.prompt, (AppStorage.get('context') as common.ExtensionContext)))
}
Image(this.prompt === (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
Image(this.prompt === (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_fp_verify_success').id)
? $r('app.media.right_faceID') : $r('app.media.ic_blue_fingerprint'))
.draggable(false)
@@ -54,21 +54,21 @@ export default struct PasswordAuth {
const payload: CmdData = item.payload;
if (payload.type === Constants.noticeTypePin) {
if (payload.result && payload.result === Constants.authResultPinExpired) {
this.inputValue = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.inputValue = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_pwd_error').id);
this.textValue = '';
return;
}
if (payload.remainAttempts && payload.remainAttempts < MAX_FAIL_TIMES) {
this.inputValue = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.inputValue = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_hint_pwd_error').id);
this.textValue = '';
// pin auth Remaining number
if (payload.remainAttempts < HINT_TIMES_BY_FAIL_LESS) {
this.inputValue = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_pwd_error_can_try').id)
+ payload.remainAttempts + (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
this.inputValue = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_pwd_error_can_try').id) +
payload.remainAttempts + (AppStorage.get('context') as common.ExtensionContext)?.resourceManager
.getStringSync($r('app.string.unified_authwidget_frequency').id);
}
if (num === 'first') {
@@ -84,7 +84,7 @@ export default struct PasswordAuth {
return;
}
if (payload.result === 0) {
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
this.inputValue = ' ';
this.textValue = '';
@@ -109,7 +109,7 @@ export default struct PasswordAuth {
});
} catch (error) {
LogUtils.error(TAG, 'aboutToAppear PINAuth catch error: ' + error?.code);
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
}
@@ -119,12 +119,12 @@ export default struct PasswordAuth {
}
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 = (AppStorage.get("context") as common.ExtensionContext)?.resourceManager
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);
} else {
@@ -136,8 +136,8 @@ export default struct PasswordAuth {
handleCancel(): void {
AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, [] ||
(AppStorage.get("wantParams") as WantParams)?.type as string[]);
(AppStorage.get("session") as UIExtensionContentSession)?.terminateSelf();
(AppStorage.get('wantParams') as WantParams)?.type as string[]);
(AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf();
}
build() {