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