• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  static noticeEventWidgetLoaded = 'EVENT_AUTH_WIDGET_LOADED';
49  static noticeEventWidgetReleased = 'EVENT_AUTH_WIDGET_RELEASED';
50  static noticeEventUserNavigation = 'EVENT_AUTH_USER_NAVIGATION';
51  static noticeEventProcessTerminate = 'EVENT_AUTH_PROCESS_TERMINATE';
52  static noticeEventAuthSendTip = 'EVENT_AUTH_SEND_TIP';
53
54  static numKeyBoard : NumKeyBoardItem[] = [
55    {
56      index: 0,
57      row1: '1',
58      row2: ' ',
59      value: 1,
60      bkg: false
61    } as NumKeyBoardItem,
62    {
63      index: 1,
64      row1: '2',
65      row2: 'ABC',
66      value: 2,
67      bkg: false
68    } as NumKeyBoardItem,
69    {
70      index: 2,
71      row1: '3',
72      row2: 'DEF',
73      value: 3,
74      bkg: false
75    } as NumKeyBoardItem,
76    {
77      index: 3,
78      row1: '4',
79      row2: 'GHI',
80      value: 4,
81      bkg: false
82    } as NumKeyBoardItem,
83    {
84      index: 4,
85      row1: '5',
86      row2: 'JKL',
87      value: 5,
88      bkg: false
89    } as NumKeyBoardItem,
90    {
91      index: 5,
92      row1: '6',
93      row2: 'MNO',
94      value: 6,
95      bkg: false
96    } as NumKeyBoardItem,
97    {
98      index: 6,
99      row1: '7',
100      row2: 'PQRS',
101      value: 7,
102      bkg: false
103    } as NumKeyBoardItem,
104    {
105      index: 7,
106      row1: '8',
107      row2: 'TUV',
108      value: 8,
109      bkg: false
110    } as NumKeyBoardItem,
111    {
112      index: 8,
113      row1: '9',
114      row2: 'WXYZ',
115      value: 9,
116      bkg: false
117    } as NumKeyBoardItem,
118    {
119      index: 9,
120      row1: $r('app.string.unified_authwidget_notarize'),
121      row2: ' ',
122      value: -1,
123      bkg: false
124    } as NumKeyBoardItem,
125    {
126      index: 10,
127      row1: '0',
128      row2: '+',
129      value: 0,
130      bkg: false
131    } as NumKeyBoardItem,
132    {
133      index: 11,
134      row1: $r('app.string.unified_authwidget_back'),
135      row2: ' ',
136      value: -3,
137      bkg: false
138    } as NumKeyBoardItem];
139}
140
141export interface FingerPosition {
142  sensorType: string,
143  udSensorCenterXInThousandth?: number,
144  udSensorCenterYInThousandth?: number,
145  udSensorRadiusInPx?: number,
146  outOfScreenSensorType?: string
147}
148
149export interface CmdData {
150  type: string,
151  remainAttempts: number,
152  lockoutDuration: number,
153  result: number,
154  sensorInfo?: string,
155  tipType?: number,
156  tipInfo?: Uint8Array
157}
158
159export interface CmdType {
160  event: string,
161  payload: CmdData,
162}
163
164export interface NumKeyBoardItem {
165  index: number,
166  row1: string | resourceManager.Resource,
167  row2: string,
168  value: number,
169  bkg: boolean
170}
171
172export interface WantParams {
173  widgetContextId: number,
174  type: string[],
175  title: string,
176  pinSubType: string,
177  navigationButtonText?: string,
178  windowModeType: string,
179  cmd: CmdType[],
180  widgetContextIdStr?: string,
181}
182
183export interface WidgetCommand {
184  cmd:Array<CmdType>,
185  pinSubType:string,
186  skipLockedBiometricAuth: boolean
187}
188
189export enum UserAuthTipType {
190  SINGLE_AUTH_RESULT = 10001
191}
192
193export enum CmdNotifyEvents {
194  CMD_NOTIFY_AUTH_START = 'CMD_NOTIFY_AUTH_START',
195  CMD_NOTIFY_AUTH_RESULT = 'CMD_NOTIFY_AUTH_RESULT',
196  CMD_NOTIFY_AUTH_TIP = 'CMD_NOTIFY_AUTH_TIP'
197}
198
199export enum TipCode {
200  NORMAL = -1,
201  // 超时
202  TIMEOUT = 2,
203  // 临时冻结
204  TEMPORARILY_LOCKED = 3,
205  // 永久冻结
206  PERMANENTLY_LOCKED = 4,
207}
208