@@ -8,46 +8,34 @@ export enum FlagshipRoutes {
8
8
Stack = 'stack'
9
9
}
10
10
11
- export enum BiometryType {
12
- Face = 'Face' ,
13
- FaceID = 'FaceID' ,
14
- Fingerprint = 'Fingerprint' ,
15
- Iris = 'Iris' ,
16
- TouchID = 'TouchID'
17
- }
11
+ export type BiometryType = 'TouchID' | 'FaceID' | 'Biometrics'
18
12
19
13
export interface FlagshipMetadata {
20
- capabilities ?: {
21
- biometryType ?: BiometryType
22
- }
23
- hasBiometry ?: boolean
14
+ biometry_available ?: boolean
15
+ biometry_type ?: BiometryType
24
16
immersive ?: boolean
25
17
navbarHeight ?: number
26
18
platform ?: Record < string , unknown >
27
19
route ?: FlagshipRoutes
28
- settings ?: {
29
- PINEnabled ?: boolean
30
- autoLockDelay ?: number
31
- autoLockEnabled ?: boolean
32
- biometryEnabled ?: boolean
33
- }
20
+ settings_PINEnabled ?: boolean
21
+ settings_autoLockDelay ?: number
22
+ settings_autoLockEnabled ?: boolean
23
+ settings_biometryEnabled ?: boolean
34
24
statusBarHeight ?: number
35
25
version ?: string
36
26
}
37
27
38
- const getGlobalWindow = ( ) : Window => {
39
- if ( typeof window !== 'undefined' ) return window
40
- else {
41
- log (
42
- 'error' ,
43
- `"window" is not defined. This means that getGlobalWindow() shouldn't have been called and investigation should be done to prevent this call`
44
- )
45
- return undefined
46
- }
47
- }
28
+ const getGlobalWindow = ( ) : ( Window & typeof globalThis ) | undefined =>
29
+ typeof window !== 'undefined'
30
+ ? window
31
+ : ( log (
32
+ 'error' ,
33
+ `"window" is not defined. This means that getGlobalWindow() shouldn't have been called and investigation should be done to prevent this call`
34
+ ) ,
35
+ undefined )
48
36
49
37
export const getFlagshipMetadata = ( ) : FlagshipMetadata =>
50
- getGlobalWindow ( ) ?. cozy ?. flagship || { }
38
+ getGlobalWindow ( ) ?. cozy ?. flagship ?? { }
51
39
52
40
export const isFlagshipApp = ( ) : boolean =>
53
41
getGlobalWindow ( ) ?. cozy ?. flagship !== undefined
0 commit comments