1/** 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15import resourceManager from '@ohos.resourceManager'; 16 17export default class Constants { 18 static deviceDpi = ['520vp', '840vp']; 19 20 // Pin type 21 static pinSix = 'PIN_SIX'; 22 static pinNumber = 'PIN_NUMBER'; 23 static pinMixed = 'PIN_MIXED'; 24 25 // layout params - Pic 26 static fullContainerWidth = '100%'; 27 static fullContainerHeight = '100%'; 28 static halfContainerWidth = '50%'; 29 static ninetyPercentWidth = '90%'; 30 31 // getUserAuthWidgetMgr params 32 static userAuthWidgetMgrVersion = 1; 33 // command result success 34 static userAuthWidgetMgrSuccess = 0; 35 // auth result that pin expired from auth service 36 static authResultPinExpired = 13; 37 38 // sendNotice params 39 // version 40 static noticeVersion = '1'; 41 // type 42 static noticeTypePin = 'pin'; 43 static noticeTypeFace = 'face'; 44 static noticeTypeFinger = 'fingerprint'; 45 // event cancel 46 static noticeEventCancel = 'EVENT_AUTH_USER_CANCEL'; 47 static noticeEventInvalidParam = 'EVENT_AUTH_WIDGET_PARA_INVALID'; 48 49 static numKeyBoard : NumKeyBoardItem[] = [ 50 { 51 index: 0, 52 row1: '1', 53 row2: ' ', 54 value: 1, 55 bkg: false 56 } as NumKeyBoardItem, 57 { 58 index: 1, 59 row1: '2', 60 row2: 'ABC', 61 value: 2, 62 bkg: false 63 } as NumKeyBoardItem, 64 { 65 index: 2, 66 row1: '3', 67 row2: 'DEF', 68 value: 3, 69 bkg: false 70 } as NumKeyBoardItem, 71 { 72 index: 3, 73 row1: '4', 74 row2: 'GHI', 75 value: 4, 76 bkg: false 77 } as NumKeyBoardItem, 78 { 79 index: 4, 80 row1: '5', 81 row2: 'JKL', 82 value: 5, 83 bkg: false 84 } as NumKeyBoardItem, 85 { 86 index: 5, 87 row1: '6', 88 row2: 'MNO', 89 value: 6, 90 bkg: false 91 } as NumKeyBoardItem, 92 { 93 index: 6, 94 row1: '7', 95 row2: 'PQRS', 96 value: 7, 97 bkg: false 98 } as NumKeyBoardItem, 99 { 100 index: 7, 101 row1: '8', 102 row2: 'TUV', 103 value: 8, 104 bkg: false 105 } as NumKeyBoardItem, 106 { 107 index: 8, 108 row1: '9', 109 row2: 'WXYZ', 110 value: 9, 111 bkg: false 112 } as NumKeyBoardItem, 113 { 114 index: 9, 115 row1: $r('app.string.unified_authwidget_notarize'), 116 row2: ' ', 117 value: -1, 118 bkg: false 119 } as NumKeyBoardItem, 120 { 121 index: 10, 122 row1: '0', 123 row2: '+', 124 value: 0, 125 bkg: false 126 } as NumKeyBoardItem, 127 { 128 index: 11, 129 row1: $r('app.string.unified_authwidget_back'), 130 row2: ' ', 131 value: -3, 132 bkg: false 133 } as NumKeyBoardItem]; 134} 135 136export interface FingerPosition { 137 sensorType: string, 138 udSensorCenterXInThousandth?: number, 139 udSensorCenterYInThousandth?: number, 140 udSensorRadiusInPx?: number, 141 outOfScreenSensorType?: string 142} 143 144export interface CmdData { 145 type: string, 146 remainAttempts: number, 147 lockoutDuration: number, 148 result: number, 149 sensorInfo?: string 150} 151 152export interface CmdType { 153 event: string, 154 payload: CmdData, 155} 156 157export interface NumKeyBoardItem { 158 index: number, 159 row1: string | resourceManager.Resource, 160 row2: string, 161 value: number, 162 bkg: boolean 163} 164 165export interface WantParams { 166 widgetContextId: number, 167 type: string[], 168 title: string, 169 pinSubType: string, 170 navigationButtonText?: string, 171 windowModeType: string, 172 cmd: CmdType[], 173} 174 175export interface WidgetCommand { 176 cmd:Array<CmdType>, 177 pinSubType:string 178}