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 48 static numKeyBoard : NumKeyBoardItem[]= [ 49 { 50 index: 0, 51 row1: '1', 52 row2: ' ', 53 value: 1, 54 bkg: false 55 } as NumKeyBoardItem, 56 { 57 index: 1, 58 row1: '2', 59 row2: 'ABC', 60 value: 2, 61 bkg: false 62 } as NumKeyBoardItem, 63 { 64 index: 2, 65 row1: '3', 66 row2: 'DEF', 67 value: 3, 68 bkg: false 69 } as NumKeyBoardItem, 70 { 71 index: 3, 72 row1: '4', 73 row2: 'GHI', 74 value: 4, 75 bkg: false 76 } as NumKeyBoardItem, 77 { 78 index: 4, 79 row1: '5', 80 row2: 'JKL', 81 value: 5, 82 bkg: false 83 } as NumKeyBoardItem, 84 { 85 index: 5, 86 row1: '6', 87 row2: 'MNO', 88 value: 6, 89 bkg: false 90 } as NumKeyBoardItem, 91 { 92 index: 6, 93 row1: '7', 94 row2: 'PQRS', 95 value: 7, 96 bkg: false 97 } as NumKeyBoardItem, 98 { 99 index: 7, 100 row1: '8', 101 row2: 'TUV', 102 value: 8, 103 bkg: false 104 } as NumKeyBoardItem, 105 { 106 index: 8, 107 row1: '9', 108 row2: 'WXYZ', 109 value: 9, 110 bkg: false 111 } as NumKeyBoardItem, 112 { 113 index: 9, 114 row1: $r('app.string.unified_authwidget_notarize'), 115 row2: ' ', 116 value: -1, 117 bkg: false 118 } as NumKeyBoardItem, 119 { 120 index: 10, 121 row1: '0', 122 row2: '+', 123 value: 0, 124 bkg: false 125 } as NumKeyBoardItem, 126 { 127 index: 11, 128 row1: $r('app.string.unified_authwidget_back'), 129 row2: ' ', 130 value: -3, 131 bkg: false 132 } as NumKeyBoardItem]; 133} 134 135export interface FingerPosition { 136 sensorType: string, 137 udSensorCenterXInThousandth?: number, 138 udSensorCenterYInThousandth?: number, 139 udSensorRadiusInPx?: number, 140 outOfScreenSensorType?: string 141} 142 143export interface CmdData { 144 type: string, 145 remainAttempts: number, 146 lockoutDuration: number, 147 result: number, 148 sensorInfo?: string 149} 150 151export interface CmdType { 152 event: string, 153 payload: CmdData, 154} 155 156export interface NumKeyBoardItem { 157 index: number, 158 row1: string | resourceManager.Resource, 159 row2: string, 160 value: number, 161 bkg: boolean 162} 163 164export interface WantParams { 165 widgetContextId: number, 166 type: string[], 167 title: string, 168 pinSubType: string, 169 navigationButtonText?: string, 170 windowModeType: string, 171 cmd: CmdType[], 172} 173 174export interface WidgetCommand { 175 cmd:Array<CmdType>, 176 pinSubType:string 177}