@bifold/core 2.0.1 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/forms/WalletNameForm.js +152 -0
- package/lib/commonjs/components/forms/WalletNameForm.js.map +1 -0
- package/lib/commonjs/components/inputs/BiometryControl.js.map +1 -1
- package/lib/commonjs/components/misc/CredentialCard.js +3 -2
- package/lib/commonjs/components/misc/CredentialCard.js.map +1 -1
- package/lib/commonjs/components/misc/FauxHeader.js +89 -0
- package/lib/commonjs/components/misc/FauxHeader.js.map +1 -0
- package/lib/commonjs/components/misc/QRScanner.js +2 -2
- package/lib/commonjs/components/misc/QRScanner.js.map +1 -1
- package/lib/commonjs/components/modals/DeveloperModal.js +43 -0
- package/lib/commonjs/components/modals/DeveloperModal.js.map +1 -0
- package/lib/commonjs/components/views/PushNotificationsContent.js.map +1 -1
- package/lib/commonjs/components/views/PushNotificationsDisabledContent.js.map +1 -1
- package/lib/commonjs/contexts/auth.js +24 -3
- package/lib/commonjs/contexts/auth.js.map +1 -1
- package/lib/commonjs/hooks/chat-messages.js +1 -1
- package/lib/commonjs/hooks/chat-messages.js.map +1 -1
- package/lib/commonjs/hooks/developer-mode.js +31 -0
- package/lib/commonjs/hooks/developer-mode.js.map +1 -0
- package/lib/commonjs/hooks/lockout.js +80 -0
- package/lib/commonjs/hooks/lockout.js.map +1 -0
- package/lib/commonjs/hooks/onboarding.js +23 -0
- package/lib/commonjs/hooks/onboarding.js.map +1 -0
- package/lib/commonjs/index.js +24 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/localization/en/index.js +2 -1
- package/lib/commonjs/localization/en/index.js.map +1 -1
- package/lib/commonjs/localization/fr/index.js +2 -1
- package/lib/commonjs/localization/fr/index.js.map +1 -1
- package/lib/commonjs/localization/pt-br/index.js +2 -1
- package/lib/commonjs/localization/pt-br/index.js.map +1 -1
- package/lib/commonjs/modules/openid/components/OpenIDCredentialCard.js +4 -5
- package/lib/commonjs/modules/openid/components/OpenIDCredentialCard.js.map +1 -1
- package/lib/commonjs/modules/openid/display.js +6 -3
- package/lib/commonjs/modules/openid/display.js.map +1 -1
- package/lib/commonjs/modules/openid/metadata.js +2 -1
- package/lib/commonjs/modules/openid/metadata.js.map +1 -1
- package/lib/commonjs/modules/openid/screens/OpenIDProofChangeCredential.js +128 -0
- package/lib/commonjs/modules/openid/screens/OpenIDProofChangeCredential.js.map +1 -0
- package/lib/commonjs/modules/openid/screens/OpenIDProofPresentation.js +99 -44
- package/lib/commonjs/modules/openid/screens/OpenIDProofPresentation.js.map +1 -1
- package/lib/commonjs/modules/openid/types.js.map +1 -1
- package/lib/commonjs/modules/openid/utils/utils.js +0 -14
- package/lib/commonjs/modules/openid/utils/utils.js.map +1 -1
- package/lib/commonjs/navigators/ConnectStack.js +4 -4
- package/lib/commonjs/navigators/ConnectStack.js.map +1 -1
- package/lib/commonjs/navigators/DeliveryStack.js +8 -0
- package/lib/commonjs/navigators/DeliveryStack.js.map +1 -1
- package/lib/commonjs/navigators/OnboardingScreens.js +0 -8
- package/lib/commonjs/navigators/OnboardingScreens.js.map +1 -1
- package/lib/commonjs/navigators/OnboardingStack.js +3 -4
- package/lib/commonjs/navigators/OnboardingStack.js.map +1 -1
- package/lib/commonjs/navigators/SettingStack.js +4 -4
- package/lib/commonjs/navigators/SettingStack.js.map +1 -1
- package/lib/commonjs/navigators/TabStack.js +11 -4
- package/lib/commonjs/navigators/TabStack.js.map +1 -1
- package/lib/commonjs/navigators/defaultStackOptions.js +6 -1
- package/lib/commonjs/navigators/defaultStackOptions.js.map +1 -1
- package/lib/commonjs/screens/Biometry.js.map +1 -1
- package/lib/commonjs/screens/NameWallet.js +3 -149
- package/lib/commonjs/screens/NameWallet.js.map +1 -1
- package/lib/commonjs/screens/OnboardingPages.js +8 -38
- package/lib/commonjs/screens/OnboardingPages.js.map +1 -1
- package/lib/commonjs/screens/PINChange.js +5 -1
- package/lib/commonjs/screens/PINChange.js.map +1 -1
- package/lib/commonjs/screens/PINCreate.js +4 -1
- package/lib/commonjs/screens/PINCreate.js.map +1 -1
- package/lib/commonjs/screens/PINEnter.js +114 -292
- package/lib/commonjs/screens/PINEnter.js.map +1 -1
- package/lib/commonjs/screens/PINVerify.js +181 -0
- package/lib/commonjs/screens/PINVerify.js.map +1 -0
- package/lib/commonjs/screens/ProofRequest.js +9 -9
- package/lib/commonjs/screens/ProofRequest.js.map +1 -1
- package/lib/commonjs/screens/PushNotifications.js.map +1 -1
- package/lib/commonjs/screens/RenameWallet.js +33 -0
- package/lib/commonjs/screens/RenameWallet.js.map +1 -0
- package/lib/commonjs/screens/Settings.js +13 -19
- package/lib/commonjs/screens/Settings.js.map +1 -1
- package/lib/commonjs/screens/ToggleBiometry.js +16 -24
- package/lib/commonjs/screens/ToggleBiometry.js.map +1 -1
- package/lib/commonjs/theme.js +2 -1
- package/lib/commonjs/theme.js.map +1 -1
- package/lib/commonjs/types/navigators.js +2 -0
- package/lib/commonjs/types/navigators.js.map +1 -1
- package/lib/commonjs/utils/oca.js +46 -17
- package/lib/commonjs/utils/oca.js.map +1 -1
- package/lib/module/components/forms/WalletNameForm.js +143 -0
- package/lib/module/components/forms/WalletNameForm.js.map +1 -0
- package/lib/module/components/inputs/BiometryControl.js.map +1 -1
- package/lib/module/components/misc/CredentialCard.js +3 -2
- package/lib/module/components/misc/CredentialCard.js.map +1 -1
- package/lib/module/components/misc/FauxHeader.js +80 -0
- package/lib/module/components/misc/FauxHeader.js.map +1 -0
- package/lib/module/components/misc/QRScanner.js +2 -2
- package/lib/module/components/misc/QRScanner.js.map +1 -1
- package/lib/module/components/modals/DeveloperModal.js +36 -0
- package/lib/module/components/modals/DeveloperModal.js.map +1 -0
- package/lib/module/components/views/PushNotificationsContent.js.map +1 -1
- package/lib/module/components/views/PushNotificationsDisabledContent.js.map +1 -1
- package/lib/module/contexts/auth.js +22 -1
- package/lib/module/contexts/auth.js.map +1 -1
- package/lib/module/hooks/chat-messages.js +1 -1
- package/lib/module/hooks/chat-messages.js.map +1 -1
- package/lib/module/hooks/developer-mode.js +24 -0
- package/lib/module/hooks/developer-mode.js.map +1 -0
- package/lib/module/hooks/lockout.js +70 -0
- package/lib/module/hooks/lockout.js.map +1 -0
- package/lib/module/hooks/onboarding.js +16 -0
- package/lib/module/hooks/onboarding.js.map +1 -0
- package/lib/module/index.js +4 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/localization/en/index.js +2 -1
- package/lib/module/localization/en/index.js.map +1 -1
- package/lib/module/localization/fr/index.js +2 -1
- package/lib/module/localization/fr/index.js.map +1 -1
- package/lib/module/localization/pt-br/index.js +2 -1
- package/lib/module/localization/pt-br/index.js.map +1 -1
- package/lib/module/modules/openid/components/OpenIDCredentialCard.js +4 -4
- package/lib/module/modules/openid/components/OpenIDCredentialCard.js.map +1 -1
- package/lib/module/modules/openid/display.js +6 -3
- package/lib/module/modules/openid/display.js.map +1 -1
- package/lib/module/modules/openid/metadata.js +2 -1
- package/lib/module/modules/openid/metadata.js.map +1 -1
- package/lib/module/modules/openid/screens/OpenIDProofChangeCredential.js +121 -0
- package/lib/module/modules/openid/screens/OpenIDProofChangeCredential.js.map +1 -0
- package/lib/module/modules/openid/screens/OpenIDProofPresentation.js +100 -45
- package/lib/module/modules/openid/screens/OpenIDProofPresentation.js.map +1 -1
- package/lib/module/modules/openid/types.js.map +1 -1
- package/lib/module/modules/openid/utils/utils.js +1 -12
- package/lib/module/modules/openid/utils/utils.js.map +1 -1
- package/lib/module/navigators/ConnectStack.js +4 -4
- package/lib/module/navigators/ConnectStack.js.map +1 -1
- package/lib/module/navigators/DeliveryStack.js +8 -0
- package/lib/module/navigators/DeliveryStack.js.map +1 -1
- package/lib/module/navigators/OnboardingScreens.js +0 -8
- package/lib/module/navigators/OnboardingScreens.js.map +1 -1
- package/lib/module/navigators/OnboardingStack.js +4 -5
- package/lib/module/navigators/OnboardingStack.js.map +1 -1
- package/lib/module/navigators/SettingStack.js +4 -4
- package/lib/module/navigators/SettingStack.js.map +1 -1
- package/lib/module/navigators/TabStack.js +11 -4
- package/lib/module/navigators/TabStack.js.map +1 -1
- package/lib/module/navigators/defaultStackOptions.js +6 -1
- package/lib/module/navigators/defaultStackOptions.js.map +1 -1
- package/lib/module/screens/Biometry.js.map +1 -1
- package/lib/module/screens/NameWallet.js +3 -147
- package/lib/module/screens/NameWallet.js.map +1 -1
- package/lib/module/screens/OnboardingPages.js +8 -38
- package/lib/module/screens/OnboardingPages.js.map +1 -1
- package/lib/module/screens/PINChange.js +5 -1
- package/lib/module/screens/PINChange.js.map +1 -1
- package/lib/module/screens/PINCreate.js +4 -1
- package/lib/module/screens/PINCreate.js.map +1 -1
- package/lib/module/screens/PINEnter.js +116 -294
- package/lib/module/screens/PINEnter.js.map +1 -1
- package/lib/module/screens/PINVerify.js +172 -0
- package/lib/module/screens/PINVerify.js.map +1 -0
- package/lib/module/screens/ProofRequest.js +9 -9
- package/lib/module/screens/ProofRequest.js.map +1 -1
- package/lib/module/screens/PushNotifications.js.map +1 -1
- package/lib/module/screens/RenameWallet.js +24 -0
- package/lib/module/screens/RenameWallet.js.map +1 -0
- package/lib/module/screens/Settings.js +12 -18
- package/lib/module/screens/Settings.js.map +1 -1
- package/lib/module/screens/ToggleBiometry.js +15 -23
- package/lib/module/screens/ToggleBiometry.js.map +1 -1
- package/lib/module/theme.js +2 -1
- package/lib/module/theme.js.map +1 -1
- package/lib/module/types/navigators.js +2 -0
- package/lib/module/types/navigators.js.map +1 -1
- package/lib/module/utils/oca.js +43 -15
- package/lib/module/utils/oca.js.map +1 -1
- package/lib/typescript/src/components/forms/WalletNameForm.d.ts +9 -0
- package/lib/typescript/src/components/forms/WalletNameForm.d.ts.map +1 -0
- package/lib/typescript/src/components/inputs/BiometryControl.d.ts.map +1 -1
- package/lib/typescript/src/components/misc/CredentialCard.d.ts.map +1 -1
- package/lib/typescript/src/components/misc/FauxHeader.d.ts +8 -0
- package/lib/typescript/src/components/misc/FauxHeader.d.ts.map +1 -0
- package/lib/typescript/src/components/modals/DeveloperModal.d.ts +7 -0
- package/lib/typescript/src/components/modals/DeveloperModal.d.ts.map +1 -0
- package/lib/typescript/src/contexts/auth.d.ts +1 -0
- package/lib/typescript/src/contexts/auth.d.ts.map +1 -1
- package/lib/typescript/src/hooks/developer-mode.d.ts +4 -0
- package/lib/typescript/src/hooks/developer-mode.d.ts.map +1 -0
- package/lib/typescript/src/hooks/lockout.d.ts +9 -0
- package/lib/typescript/src/hooks/lockout.d.ts.map +1 -0
- package/lib/typescript/src/hooks/onboarding.d.ts +2 -0
- package/lib/typescript/src/hooks/onboarding.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +5 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/localization/en/index.d.ts +1 -0
- package/lib/typescript/src/localization/en/index.d.ts.map +1 -1
- package/lib/typescript/src/localization/fr/index.d.ts +1 -0
- package/lib/typescript/src/localization/fr/index.d.ts.map +1 -1
- package/lib/typescript/src/localization/pt-br/index.d.ts +1 -0
- package/lib/typescript/src/localization/pt-br/index.d.ts.map +1 -1
- package/lib/typescript/src/modules/openid/components/OpenIDCredentialCard.d.ts.map +1 -1
- package/lib/typescript/src/modules/openid/display.d.ts.map +1 -1
- package/lib/typescript/src/modules/openid/metadata.d.ts +8 -1
- package/lib/typescript/src/modules/openid/metadata.d.ts.map +1 -1
- package/lib/typescript/src/modules/openid/screens/OpenIDProofChangeCredential.d.ts +6 -0
- package/lib/typescript/src/modules/openid/screens/OpenIDProofChangeCredential.d.ts.map +1 -0
- package/lib/typescript/src/modules/openid/screens/OpenIDProofPresentation.d.ts.map +1 -1
- package/lib/typescript/src/modules/openid/types.d.ts +9 -0
- package/lib/typescript/src/modules/openid/types.d.ts.map +1 -1
- package/lib/typescript/src/modules/openid/utils/utils.d.ts +1 -3
- package/lib/typescript/src/modules/openid/utils/utils.d.ts.map +1 -1
- package/lib/typescript/src/navigators/DeliveryStack.d.ts.map +1 -1
- package/lib/typescript/src/navigators/OnboardingScreens.d.ts +0 -1
- package/lib/typescript/src/navigators/OnboardingScreens.d.ts.map +1 -1
- package/lib/typescript/src/navigators/OnboardingStack.d.ts.map +1 -1
- package/lib/typescript/src/navigators/TabStack.d.ts.map +1 -1
- package/lib/typescript/src/navigators/defaultStackOptions.d.ts.map +1 -1
- package/lib/typescript/src/screens/Biometry.d.ts.map +1 -1
- package/lib/typescript/src/screens/NameWallet.d.ts.map +1 -1
- package/lib/typescript/src/screens/OnboardingPages.d.ts +1 -1
- package/lib/typescript/src/screens/OnboardingPages.d.ts.map +1 -1
- package/lib/typescript/src/screens/PINChange.d.ts.map +1 -1
- package/lib/typescript/src/screens/PINCreate.d.ts.map +1 -1
- package/lib/typescript/src/screens/PINEnter.d.ts +0 -7
- package/lib/typescript/src/screens/PINEnter.d.ts.map +1 -1
- package/lib/typescript/src/screens/PINVerify.d.ts +13 -0
- package/lib/typescript/src/screens/PINVerify.d.ts.map +1 -0
- package/lib/typescript/src/screens/RenameWallet.d.ts +4 -0
- package/lib/typescript/src/screens/RenameWallet.d.ts.map +1 -0
- package/lib/typescript/src/screens/Settings.d.ts.map +1 -1
- package/lib/typescript/src/screens/ToggleBiometry.d.ts.map +1 -1
- package/lib/typescript/src/theme.d.ts +10 -25
- package/lib/typescript/src/theme.d.ts.map +1 -1
- package/lib/typescript/src/types/navigators.d.ts +17 -3
- package/lib/typescript/src/types/navigators.d.ts.map +1 -1
- package/lib/typescript/src/utils/oca.d.ts +7 -2
- package/lib/typescript/src/utils/oca.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/forms/WalletNameForm.tsx +148 -0
- package/src/components/inputs/BiometryControl.tsx +16 -13
- package/src/components/misc/CredentialCard.tsx +5 -2
- package/src/components/misc/FauxHeader.tsx +75 -0
- package/src/components/misc/QRScanner.tsx +2 -2
- package/src/components/modals/DeveloperModal.tsx +30 -0
- package/src/components/views/PushNotificationsContent.tsx +15 -15
- package/src/components/views/PushNotificationsDisabledContent.tsx +10 -10
- package/src/contexts/auth.tsx +33 -1
- package/src/hooks/chat-messages.tsx +1 -1
- package/src/hooks/developer-mode.ts +25 -0
- package/src/hooks/lockout.ts +77 -0
- package/src/hooks/onboarding.ts +16 -0
- package/src/hooks/usePINValidation.ts +3 -3
- package/src/index.ts +7 -0
- package/src/localization/en/index.ts +1 -0
- package/src/localization/fr/index.ts +1 -0
- package/src/localization/pt-br/index.ts +1 -0
- package/src/modules/openid/components/OpenIDCredentialCard.tsx +3 -4
- package/src/modules/openid/display.tsx +3 -0
- package/src/modules/openid/metadata.tsx +7 -1
- package/src/modules/openid/screens/OpenIDProofChangeCredential.tsx +132 -0
- package/src/modules/openid/screens/OpenIDProofPresentation.tsx +131 -59
- package/src/modules/openid/types.tsx +8 -0
- package/src/modules/openid/utils/utils.tsx +0 -14
- package/src/navigators/ConnectStack.tsx +4 -4
- package/src/navigators/DeliveryStack.tsx +9 -0
- package/src/navigators/OnboardingScreens.ts +0 -10
- package/src/navigators/OnboardingStack.tsx +2 -6
- package/src/navigators/RootStack.tsx +1 -1
- package/src/navigators/SettingStack.tsx +4 -4
- package/src/navigators/TabStack.tsx +3 -2
- package/src/navigators/defaultStackOptions.tsx +5 -0
- package/src/screens/Biometry.tsx +1 -4
- package/src/screens/NameWallet.tsx +3 -152
- package/src/screens/OnboardingPages.tsx +9 -61
- package/src/screens/PINChange.tsx +6 -9
- package/src/screens/PINCreate.tsx +7 -18
- package/src/screens/PINEnter.tsx +114 -361
- package/src/screens/PINVerify.tsx +193 -0
- package/src/screens/ProofRequest.tsx +9 -9
- package/src/screens/PushNotifications.tsx +2 -2
- package/src/screens/RenameWallet.tsx +25 -0
- package/src/screens/Settings.tsx +11 -22
- package/src/screens/ToggleBiometry.tsx +20 -34
- package/src/theme.ts +34 -3
- package/src/types/navigators.ts +21 -3
- package/src/utils/oca.ts +60 -19
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { useTranslation } from 'react-i18next'
|
|
3
|
+
import { StyleSheet, View } from 'react-native'
|
|
4
|
+
|
|
5
|
+
import { DispatchAction } from '../../contexts/reducers/store'
|
|
6
|
+
import { useStore } from '../../contexts/store'
|
|
7
|
+
import { useTheme } from '../../contexts/theme'
|
|
8
|
+
import { generateRandomWalletName } from '../../utils/helpers'
|
|
9
|
+
import { testIdWithKey } from '../../utils/testable'
|
|
10
|
+
import ButtonLoading from '../animated/ButtonLoading'
|
|
11
|
+
import Button, { ButtonType } from '../buttons/Button'
|
|
12
|
+
import LimitedTextInput from '../inputs/LimitedTextInput'
|
|
13
|
+
import { InfoBoxType } from '../misc/InfoBox'
|
|
14
|
+
import PopupModal from '../modals/PopupModal'
|
|
15
|
+
import { ThemedText } from '../texts/ThemedText'
|
|
16
|
+
import KeyboardView from '../views/KeyboardView'
|
|
17
|
+
|
|
18
|
+
type ErrorState = {
|
|
19
|
+
visible: boolean
|
|
20
|
+
title: string
|
|
21
|
+
description: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface NameWalletProps {
|
|
25
|
+
isRenaming?: boolean
|
|
26
|
+
onSubmitSuccess?: (name: string) => void
|
|
27
|
+
onCancel?: () => void
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const NameWalletForm: React.FC<NameWalletProps> = ({ isRenaming, onSubmitSuccess, onCancel }) => {
|
|
31
|
+
const { t } = useTranslation()
|
|
32
|
+
const { ColorPallet, Assets, Spacing } = useTheme()
|
|
33
|
+
const [store, dispatch] = useStore()
|
|
34
|
+
const [loading, setLoading] = useState(false)
|
|
35
|
+
const [walletName, setWalletName] = useState(store.preferences.walletName ?? generateRandomWalletName())
|
|
36
|
+
const [errorState, setErrorState] = useState<ErrorState>({
|
|
37
|
+
visible: false,
|
|
38
|
+
title: '',
|
|
39
|
+
description: '',
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const styles = StyleSheet.create({
|
|
43
|
+
screenContainer: {
|
|
44
|
+
flex: 1,
|
|
45
|
+
backgroundColor: ColorPallet.brand.primaryBackground,
|
|
46
|
+
padding: Spacing.md,
|
|
47
|
+
justifyContent: 'space-between',
|
|
48
|
+
},
|
|
49
|
+
contentContainer: {
|
|
50
|
+
justifyContent: 'center',
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
width: '100%',
|
|
53
|
+
},
|
|
54
|
+
controlsContainer: {},
|
|
55
|
+
buttonContainer: {
|
|
56
|
+
width: '100%',
|
|
57
|
+
},
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
const handleChangeText = (text: string) => {
|
|
61
|
+
setWalletName(text)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const handleContinuePressed = () => {
|
|
65
|
+
if (walletName.length < 1) {
|
|
66
|
+
setErrorState({
|
|
67
|
+
title: t('NameWallet.EmptyNameTitle'),
|
|
68
|
+
description: t('NameWallet.EmptyNameDescription'),
|
|
69
|
+
visible: true,
|
|
70
|
+
})
|
|
71
|
+
} else if (walletName.length > 50) {
|
|
72
|
+
setErrorState({
|
|
73
|
+
title: t('NameWallet.CharCountTitle'),
|
|
74
|
+
description: t('NameWallet.CharCountDescription'),
|
|
75
|
+
visible: true,
|
|
76
|
+
})
|
|
77
|
+
} else {
|
|
78
|
+
setLoading(true)
|
|
79
|
+
dispatch({
|
|
80
|
+
type: DispatchAction.UPDATE_WALLET_NAME,
|
|
81
|
+
payload: [walletName],
|
|
82
|
+
})
|
|
83
|
+
dispatch({ type: DispatchAction.DID_NAME_WALLET })
|
|
84
|
+
onSubmitSuccess?.(walletName)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const handleDismissError = () => {
|
|
89
|
+
setErrorState((prev) => ({ ...prev, visible: false }))
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<KeyboardView>
|
|
94
|
+
<View style={styles.screenContainer}>
|
|
95
|
+
<View style={styles.contentContainer}>
|
|
96
|
+
<Assets.svg.contactBook height={100} style={{ marginVertical: Spacing.md }} />
|
|
97
|
+
<ThemedText style={{ width: '100%', marginBottom: Spacing.md }}>{t('NameWallet.ThisIsTheName')}</ThemedText>
|
|
98
|
+
<View style={{ width: '100%' }}>
|
|
99
|
+
<LimitedTextInput
|
|
100
|
+
defaultValue={walletName}
|
|
101
|
+
label={t('NameWallet.NameYourWallet')}
|
|
102
|
+
limit={50}
|
|
103
|
+
handleChangeText={handleChangeText}
|
|
104
|
+
accessibilityLabel={t('NameWallet.NameYourWallet')}
|
|
105
|
+
testID={testIdWithKey('NameInput')}
|
|
106
|
+
/>
|
|
107
|
+
</View>
|
|
108
|
+
</View>
|
|
109
|
+
<View style={styles.controlsContainer}>
|
|
110
|
+
<View style={styles.buttonContainer}>
|
|
111
|
+
<Button
|
|
112
|
+
title={isRenaming ? t('Global.Save') : t('Global.Continue')}
|
|
113
|
+
buttonType={ButtonType.Primary}
|
|
114
|
+
testID={isRenaming ? testIdWithKey('Save') : testIdWithKey('Continue')}
|
|
115
|
+
accessibilityLabel={isRenaming ? t('Global.Save') : t('Global.Continue')}
|
|
116
|
+
onPress={handleContinuePressed}
|
|
117
|
+
disabled={loading}
|
|
118
|
+
>
|
|
119
|
+
{loading && <ButtonLoading />}
|
|
120
|
+
</Button>
|
|
121
|
+
{isRenaming && (
|
|
122
|
+
<View style={{ marginTop: Spacing.sm }}>
|
|
123
|
+
<Button
|
|
124
|
+
title={t('Global.Cancel')}
|
|
125
|
+
buttonType={ButtonType.Secondary}
|
|
126
|
+
testID={testIdWithKey('Cancel')}
|
|
127
|
+
accessibilityLabel={t('Global.Cancel')}
|
|
128
|
+
onPress={onCancel}
|
|
129
|
+
/>
|
|
130
|
+
</View>
|
|
131
|
+
)}
|
|
132
|
+
</View>
|
|
133
|
+
</View>
|
|
134
|
+
</View>
|
|
135
|
+
{errorState.visible && (
|
|
136
|
+
<PopupModal
|
|
137
|
+
notificationType={InfoBoxType.Info}
|
|
138
|
+
onCallToActionLabel={t('Global.Okay')}
|
|
139
|
+
onCallToActionPressed={handleDismissError}
|
|
140
|
+
title={errorState.title}
|
|
141
|
+
description={errorState.description}
|
|
142
|
+
/>
|
|
143
|
+
)}
|
|
144
|
+
</KeyboardView>
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export default NameWalletForm
|
|
@@ -57,18 +57,21 @@ const BiometryControl: React.FC<BiometryControlProps> = ({ biometryEnabled, onBi
|
|
|
57
57
|
setSettingsPopupConfig(null)
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
const onRequestSystemBiometrics = useCallback(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
const onRequestSystemBiometrics = useCallback(
|
|
61
|
+
async (newToggleValue: boolean) => {
|
|
62
|
+
const permissionResult: PermissionStatus = await request(BIOMETRY_PERMISSION)
|
|
63
|
+
switch (permissionResult) {
|
|
64
|
+
case RESULTS.GRANTED:
|
|
65
|
+
case RESULTS.LIMITED:
|
|
66
|
+
// Granted
|
|
67
|
+
onBiometryToggle(newToggleValue)
|
|
68
|
+
break
|
|
69
|
+
default:
|
|
70
|
+
break
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
[onBiometryToggle]
|
|
74
|
+
)
|
|
72
75
|
|
|
73
76
|
const onCheckSystemBiometrics = useCallback(async (): Promise<PermissionStatus> => {
|
|
74
77
|
if (Platform.OS === 'android') {
|
|
@@ -173,4 +176,4 @@ const BiometryControl: React.FC<BiometryControlProps> = ({ biometryEnabled, onBi
|
|
|
173
176
|
)
|
|
174
177
|
}
|
|
175
178
|
|
|
176
|
-
export default BiometryControl
|
|
179
|
+
export default BiometryControl
|
|
@@ -13,7 +13,7 @@ import { GenericCredentialExchangeRecord } from '../../types/credentials'
|
|
|
13
13
|
import { BrandingOverlay } from '@bifold/oca'
|
|
14
14
|
import { useOpenIDCredentials } from '../../modules/openid/context/OpenIDCredentialRecordProvider'
|
|
15
15
|
import { getCredentialForDisplay } from '../../modules/openid/display'
|
|
16
|
-
import { getAttributeField } from '../../
|
|
16
|
+
import { getAttributeField } from '../../utils/oca'
|
|
17
17
|
|
|
18
18
|
interface CredentialCardProps {
|
|
19
19
|
credential?: GenericCredentialExchangeRecord
|
|
@@ -70,7 +70,10 @@ const CredentialCard: React.FC<CredentialCardProps> = ({
|
|
|
70
70
|
resolveOverlay(credential)
|
|
71
71
|
const credentialDisplay = getCredentialForDisplay(credential)
|
|
72
72
|
if (credentialDisplay.display.primary_overlay_attribute) {
|
|
73
|
-
const attributeValue = getAttributeField(
|
|
73
|
+
const attributeValue = getAttributeField(
|
|
74
|
+
credentialDisplay,
|
|
75
|
+
credentialDisplay.display.primary_overlay_attribute
|
|
76
|
+
)?.field
|
|
74
77
|
setExtraOverlayAttribute(attributeValue)
|
|
75
78
|
}
|
|
76
79
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useTranslation } from 'react-i18next'
|
|
3
|
+
import { Platform, StyleSheet, View } from 'react-native'
|
|
4
|
+
|
|
5
|
+
import { useTheme } from '../../contexts/theme'
|
|
6
|
+
import { testIdWithKey } from '../../utils/testable'
|
|
7
|
+
import IconButton, { ButtonLocation } from '../buttons/IconButton'
|
|
8
|
+
import { ThemedText } from '../texts/ThemedText'
|
|
9
|
+
|
|
10
|
+
interface FauxHeaderProps {
|
|
11
|
+
title: string
|
|
12
|
+
onBackPressed: () => void
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Used for modals that we want to look like regular screens
|
|
16
|
+
const FauxHeader: React.FC<FauxHeaderProps> = ({ title, onBackPressed }) => {
|
|
17
|
+
const { ColorPallet, Spacing, NavigationTheme } = useTheme()
|
|
18
|
+
const { t } = useTranslation()
|
|
19
|
+
const styles = StyleSheet.create({
|
|
20
|
+
header: {
|
|
21
|
+
backgroundColor: NavigationTheme.colors.primary,
|
|
22
|
+
elevation: 0,
|
|
23
|
+
shadowOffset: { width: 0, height: 6 },
|
|
24
|
+
shadowRadius: 6,
|
|
25
|
+
shadowColor: ColorPallet.grayscale.black,
|
|
26
|
+
shadowOpacity: 0.15,
|
|
27
|
+
zIndex: 2,
|
|
28
|
+
borderWidth: 0,
|
|
29
|
+
flexDirection: 'row',
|
|
30
|
+
alignItems: 'stretch',
|
|
31
|
+
minHeight: Platform.OS === 'ios' ? 44 : 56,
|
|
32
|
+
},
|
|
33
|
+
left: {
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
alignItems: 'flex-start',
|
|
36
|
+
},
|
|
37
|
+
titleContainer: {
|
|
38
|
+
marginHorizontal: Spacing.md,
|
|
39
|
+
justifyContent: 'center',
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
flexShrink: 1,
|
|
42
|
+
maxWidth: '68%',
|
|
43
|
+
width: '100%',
|
|
44
|
+
},
|
|
45
|
+
title: {
|
|
46
|
+
textAlign: 'center',
|
|
47
|
+
},
|
|
48
|
+
right: {
|
|
49
|
+
justifyContent: 'center',
|
|
50
|
+
alignItems: 'flex-end',
|
|
51
|
+
},
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<View style={styles.header}>
|
|
56
|
+
<View style={styles.left}>
|
|
57
|
+
<IconButton
|
|
58
|
+
buttonLocation={ButtonLocation.Left}
|
|
59
|
+
accessibilityLabel={t('Global.Back')}
|
|
60
|
+
testID={testIdWithKey('BackButton')}
|
|
61
|
+
onPress={onBackPressed}
|
|
62
|
+
icon="chevron-left"
|
|
63
|
+
/>
|
|
64
|
+
</View>
|
|
65
|
+
<View style={styles.titleContainer}>
|
|
66
|
+
<ThemedText variant={'headerTitle'} numberOfLines={1} ellipsizeMode="tail" style={styles.title}>
|
|
67
|
+
{title}
|
|
68
|
+
</ThemedText>
|
|
69
|
+
</View>
|
|
70
|
+
<View style={styles.right}></View>
|
|
71
|
+
</View>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default FauxHeader
|
|
@@ -73,7 +73,7 @@ const QRScanner: React.FC<Props> = ({
|
|
|
73
73
|
},
|
|
74
74
|
bottomSafeArea: {
|
|
75
75
|
flex: 0,
|
|
76
|
-
backgroundColor:
|
|
76
|
+
backgroundColor: TabTheme.tabBarSecondaryBackgroundColor,
|
|
77
77
|
},
|
|
78
78
|
cameraViewContainer: {
|
|
79
79
|
flex: 1,
|
|
@@ -157,7 +157,7 @@ const QRScanner: React.FC<Props> = ({
|
|
|
157
157
|
}, [agent])
|
|
158
158
|
|
|
159
159
|
const handleEdit = useCallback(() => {
|
|
160
|
-
navigation.navigate(Screens.
|
|
160
|
+
navigation.navigate(Screens.RenameWallet)
|
|
161
161
|
}, [navigation])
|
|
162
162
|
|
|
163
163
|
useEffect(() => {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useTranslation } from 'react-i18next'
|
|
3
|
+
import { SafeAreaView } from 'react-native-safe-area-context'
|
|
4
|
+
|
|
5
|
+
import { TOKENS, useServices } from '../../container-api'
|
|
6
|
+
import FauxHeader from '../misc/FauxHeader'
|
|
7
|
+
import SafeAreaModal from './SafeAreaModal'
|
|
8
|
+
import { useTheme } from '../../contexts/theme'
|
|
9
|
+
|
|
10
|
+
interface DeveloperModalProps {
|
|
11
|
+
onBackPressed: () => void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const DeveloperModal: React.FC<DeveloperModalProps> = ({ onBackPressed }) => {
|
|
15
|
+
const { NavigationTheme, ColorPallet } = useTheme()
|
|
16
|
+
const [Developer] = useServices([TOKENS.SCREEN_DEVELOPER])
|
|
17
|
+
const { t } = useTranslation()
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<SafeAreaModal>
|
|
21
|
+
<SafeAreaView edges={['left', 'right', 'top']} style={{ flex: 1, backgroundColor: NavigationTheme.colors.primary }}>
|
|
22
|
+
<FauxHeader title={t('Screens.Developer')} onBackPressed={onBackPressed} />
|
|
23
|
+
<Developer />
|
|
24
|
+
</SafeAreaView>
|
|
25
|
+
<SafeAreaView edges={['bottom']} style={{ backgroundColor: ColorPallet.brand.primaryBackground }} />
|
|
26
|
+
</SafeAreaModal>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default DeveloperModal
|
|
@@ -15,24 +15,24 @@ const PushNotificationsContent: React.FC = () => {
|
|
|
15
15
|
]
|
|
16
16
|
|
|
17
17
|
const style = StyleSheet.create({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
image: {
|
|
19
|
+
height: 200,
|
|
20
|
+
marginBottom: 20,
|
|
21
|
+
},
|
|
22
|
+
heading: {
|
|
23
|
+
marginBottom: 20,
|
|
24
|
+
},
|
|
25
|
+
listItem: {
|
|
26
|
+
...TextTheme.normal,
|
|
27
|
+
flex: 1,
|
|
28
|
+
paddingLeft: 5,
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
33
|
<>
|
|
34
34
|
<View style={style.image}>
|
|
35
|
-
|
|
35
|
+
<Assets.svg.pushNotificationImg />
|
|
36
36
|
</View>
|
|
37
37
|
<ThemedText variant="headingThree" style={style.heading}>
|
|
38
38
|
{t('PushNotifications.EnableNotifications')}
|
|
@@ -48,4 +48,4 @@ const PushNotificationsContent: React.FC = () => {
|
|
|
48
48
|
)
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export default PushNotificationsContent
|
|
51
|
+
export default PushNotificationsContent
|
|
@@ -14,15 +14,15 @@ const PushNotificationsDisabledContent: React.FC = () => {
|
|
|
14
14
|
]
|
|
15
15
|
|
|
16
16
|
const style = StyleSheet.create({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
heading: {
|
|
18
|
+
marginBottom: 20,
|
|
19
|
+
},
|
|
20
|
+
listItem: {
|
|
21
|
+
...TextTheme.normal,
|
|
22
|
+
flex: 1,
|
|
23
|
+
paddingLeft: 5,
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
28
|
<>
|
|
@@ -44,4 +44,4 @@ const PushNotificationsDisabledContent: React.FC = () => {
|
|
|
44
44
|
)
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export default PushNotificationsDisabledContent
|
|
47
|
+
export default PushNotificationsDisabledContent
|
package/src/contexts/auth.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import '@hyperledger/aries-askar-react-native'
|
|
3
3
|
|
|
4
4
|
import 'reflect-metadata'
|
|
5
|
-
|
|
5
|
+
import { DeviceEventEmitter } from 'react-native'
|
|
6
6
|
import { AskarWallet } from '@credo-ts/askar'
|
|
7
7
|
import { Agent, ConsoleLogger, LogLevel, SigningProviderRegistry } from '@credo-ts/core'
|
|
8
8
|
import { agentDependencies } from '@credo-ts/react-native'
|
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
import { WalletSecret } from '../types/security'
|
|
23
23
|
import { hashPIN } from '../utils/crypto'
|
|
24
24
|
import { migrateToAskar } from '../utils/migration'
|
|
25
|
+
import { BifoldError } from '../types/error'
|
|
26
|
+
import { EventTypes } from '../constants'
|
|
25
27
|
|
|
26
28
|
export interface AuthContext {
|
|
27
29
|
lockOutUser: () => void
|
|
@@ -33,6 +35,7 @@ export interface AuthContext {
|
|
|
33
35
|
setPIN: (PIN: string) => Promise<void>
|
|
34
36
|
commitWalletToKeychain: (useBiometry: boolean) => Promise<boolean>
|
|
35
37
|
isBiometricsActive: () => Promise<boolean>
|
|
38
|
+
verifyPIN: (PIN: string) => Promise<boolean>
|
|
36
39
|
rekeyWallet: (agent: Agent, oldPin: string, newPin: string, useBiometry?: boolean) => Promise<boolean>
|
|
37
40
|
}
|
|
38
41
|
|
|
@@ -179,6 +182,34 @@ export const AuthProvider: React.FC<React.PropsWithChildren> = ({ children }) =>
|
|
|
179
182
|
[]
|
|
180
183
|
)
|
|
181
184
|
|
|
185
|
+
const verifyPIN = useCallback(
|
|
186
|
+
async (PIN: string) => {
|
|
187
|
+
try {
|
|
188
|
+
const credentials = await getWalletSecret()
|
|
189
|
+
if (!credentials) {
|
|
190
|
+
throw new Error('Get wallet credentials error')
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const key = await hashPIN(PIN, credentials.salt)
|
|
194
|
+
if (credentials.key !== key) {
|
|
195
|
+
return false
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return true
|
|
199
|
+
} catch (err: unknown) {
|
|
200
|
+
const error = new BifoldError(
|
|
201
|
+
t('Error.Title1042'),
|
|
202
|
+
t('Error.Message1042'),
|
|
203
|
+
(err as Error)?.message ?? err,
|
|
204
|
+
1042
|
|
205
|
+
)
|
|
206
|
+
DeviceEventEmitter.emit(EventTypes.ERROR_ADDED, error)
|
|
207
|
+
return false
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
[getWalletSecret, t]
|
|
211
|
+
)
|
|
212
|
+
|
|
182
213
|
return (
|
|
183
214
|
<AuthContext.Provider
|
|
184
215
|
value={{
|
|
@@ -192,6 +223,7 @@ export const AuthProvider: React.FC<React.PropsWithChildren> = ({ children }) =>
|
|
|
192
223
|
isBiometricsActive,
|
|
193
224
|
rekeyWallet,
|
|
194
225
|
walletSecret,
|
|
226
|
+
verifyPIN,
|
|
195
227
|
}}
|
|
196
228
|
>
|
|
197
229
|
{children}
|
|
@@ -153,7 +153,7 @@ export const useChatMessagesByConnection = (connection: ConnectionRecord): Exten
|
|
|
153
153
|
[CredentialState.Done]: () => {
|
|
154
154
|
navigation.navigate(Stacks.ContactStack as any, {
|
|
155
155
|
screen: Screens.CredentialDetails,
|
|
156
|
-
params: {
|
|
156
|
+
params: { credentialId: record.id },
|
|
157
157
|
})
|
|
158
158
|
},
|
|
159
159
|
[CredentialState.OfferReceived]: () => {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useCallback, useRef } from 'react'
|
|
2
|
+
import { DispatchAction } from '../contexts/reducers/store'
|
|
3
|
+
import { useStore } from '../contexts/store'
|
|
4
|
+
|
|
5
|
+
const TOUCH_COUNT_TO_ENABLE_DEVELOPER_MODE = 10
|
|
6
|
+
|
|
7
|
+
export const useDeveloperMode = (onDevModeTriggered?: () => void) => {
|
|
8
|
+
const developerOptionCount = useRef(0)
|
|
9
|
+
const [, dispatch] = useStore()
|
|
10
|
+
|
|
11
|
+
const incrementDeveloperMenuCounter = useCallback(() => {
|
|
12
|
+
if (developerOptionCount.current >= TOUCH_COUNT_TO_ENABLE_DEVELOPER_MODE) {
|
|
13
|
+
developerOptionCount.current = 0
|
|
14
|
+
dispatch({
|
|
15
|
+
type: DispatchAction.ENABLE_DEVELOPER_MODE,
|
|
16
|
+
payload: [true],
|
|
17
|
+
})
|
|
18
|
+
onDevModeTriggered?.()
|
|
19
|
+
} else {
|
|
20
|
+
developerOptionCount.current = developerOptionCount.current + 1
|
|
21
|
+
}
|
|
22
|
+
}, [dispatch, onDevModeTriggered])
|
|
23
|
+
|
|
24
|
+
return { incrementDeveloperMenuCounter }
|
|
25
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { useCallback } from 'react'
|
|
2
|
+
import { useNavigation, CommonActions } from '@react-navigation/native'
|
|
3
|
+
import { useStore } from '../contexts/store'
|
|
4
|
+
import { DispatchAction } from '../contexts/reducers/store'
|
|
5
|
+
import { Screens } from '../types/navigators'
|
|
6
|
+
import { TOKENS, useServices } from '../container-api'
|
|
7
|
+
import { attemptLockoutConfig } from '../constants'
|
|
8
|
+
|
|
9
|
+
export const useAttemptLockout = () => {
|
|
10
|
+
const [store, dispatch] = useStore()
|
|
11
|
+
const navigation = useNavigation()
|
|
12
|
+
// set the attempt lockout time
|
|
13
|
+
return useCallback(
|
|
14
|
+
async (penalty: number) => {
|
|
15
|
+
dispatch({
|
|
16
|
+
type: DispatchAction.ATTEMPT_UPDATED,
|
|
17
|
+
payload: [
|
|
18
|
+
{
|
|
19
|
+
loginAttempts: store.loginAttempt.loginAttempts + 1,
|
|
20
|
+
lockoutDate: Date.now() + penalty,
|
|
21
|
+
servedPenalty: false,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
})
|
|
25
|
+
navigation.dispatch(
|
|
26
|
+
CommonActions.reset({
|
|
27
|
+
index: 0,
|
|
28
|
+
routes: [{ name: Screens.AttemptLockout }],
|
|
29
|
+
})
|
|
30
|
+
)
|
|
31
|
+
},
|
|
32
|
+
[store, dispatch, navigation]
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const useGetLockoutPenalty = () => {
|
|
37
|
+
const [{ attemptLockoutConfig: { baseRules, thresholdRules } = attemptLockoutConfig }] = useServices([TOKENS.CONFIG])
|
|
38
|
+
return useCallback(
|
|
39
|
+
(attempts: number) => {
|
|
40
|
+
let penalty = baseRules[attempts]
|
|
41
|
+
if (!penalty && attempts >= thresholdRules.threshold && !(attempts % thresholdRules.increment)) {
|
|
42
|
+
penalty = thresholdRules.thresholdPenaltyDuration
|
|
43
|
+
}
|
|
44
|
+
return penalty
|
|
45
|
+
},
|
|
46
|
+
[baseRules, thresholdRules]
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// This method is used to notify the app that the user is able to receive
|
|
51
|
+
// another lockout penalty
|
|
52
|
+
export const useUnMarkServedPenalty = () => {
|
|
53
|
+
const [store, dispatch] = useStore()
|
|
54
|
+
return useCallback(() => {
|
|
55
|
+
dispatch({
|
|
56
|
+
type: DispatchAction.ATTEMPT_UPDATED,
|
|
57
|
+
payload: [
|
|
58
|
+
{
|
|
59
|
+
loginAttempts: store.loginAttempt.loginAttempts,
|
|
60
|
+
lockoutDate: undefined,
|
|
61
|
+
servedPenalty: undefined,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
})
|
|
65
|
+
}, [dispatch, store.loginAttempt.loginAttempts])
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export const useLockout = () => {
|
|
69
|
+
const getLockoutPenalty = useGetLockoutPenalty()
|
|
70
|
+
const attemptLockout = useAttemptLockout()
|
|
71
|
+
const unMarkServedPenalty = useUnMarkServedPenalty()
|
|
72
|
+
return {
|
|
73
|
+
getLockoutPenalty,
|
|
74
|
+
attemptLockout,
|
|
75
|
+
unMarkServedPenalty,
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useCallback } from 'react'
|
|
2
|
+
import { useNavigation } from '@react-navigation/core'
|
|
3
|
+
import { useStore } from '../contexts/store'
|
|
4
|
+
|
|
5
|
+
export const useGotoPostAuthScreens = () => {
|
|
6
|
+
const [store] = useStore()
|
|
7
|
+
const navigation = useNavigation()
|
|
8
|
+
return useCallback(() => {
|
|
9
|
+
if (store.onboarding.postAuthScreens.length) {
|
|
10
|
+
const screen = store.onboarding.postAuthScreens[0]
|
|
11
|
+
if (screen) {
|
|
12
|
+
navigation.navigate(screen as never)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}, [store.onboarding.postAuthScreens, navigation])
|
|
16
|
+
}
|
|
@@ -28,7 +28,7 @@ export const usePINValidation = (PIN: string, PINTwo: string) => {
|
|
|
28
28
|
const clearModal = useCallback(() => {
|
|
29
29
|
setModalState(initialModalState)
|
|
30
30
|
}, [])
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
const [PINValidations, setPINValidations] = useState<PINValidationsType[]>(
|
|
33
33
|
createPINValidations(PIN, PINSecurity.rules)
|
|
34
34
|
)
|
|
@@ -57,7 +57,7 @@ export const usePINValidation = (PIN: string, PINTwo: string) => {
|
|
|
57
57
|
visible: true,
|
|
58
58
|
title: title,
|
|
59
59
|
message: message,
|
|
60
|
-
onModalDismiss: clearModal
|
|
60
|
+
onModalDismiss: clearModal,
|
|
61
61
|
})
|
|
62
62
|
}
|
|
63
63
|
},
|
|
@@ -93,6 +93,6 @@ export const usePINValidation = (PIN: string, PINTwo: string) => {
|
|
|
93
93
|
modalState,
|
|
94
94
|
setModalState,
|
|
95
95
|
clearModal,
|
|
96
|
-
PINSecurity
|
|
96
|
+
PINSecurity,
|
|
97
97
|
}
|
|
98
98
|
}
|
package/src/index.ts
CHANGED
|
@@ -42,6 +42,9 @@ import { useTour } from './contexts/tour/tour-context'
|
|
|
42
42
|
import { TourProvider } from './contexts/tour/tour-provider'
|
|
43
43
|
import AttemptLockout from './screens/AttemptLockout'
|
|
44
44
|
import Developer from './screens/Developer'
|
|
45
|
+
import DeveloperModal from './components/modals/DeveloperModal'
|
|
46
|
+
import { useDeveloperMode } from './hooks/developer-mode'
|
|
47
|
+
import FauxHeader from './components/misc/FauxHeader'
|
|
45
48
|
import OnboardingPages from './screens/OnboardingPages'
|
|
46
49
|
import Preface from './screens/Preface'
|
|
47
50
|
import Splash from './screens/Splash'
|
|
@@ -107,6 +110,7 @@ export type {
|
|
|
107
110
|
IInlineInputMessage,
|
|
108
111
|
IInputs,
|
|
109
112
|
ITextTheme,
|
|
113
|
+
ITabTheme,
|
|
110
114
|
IBrandColors,
|
|
111
115
|
ISemanticColors,
|
|
112
116
|
INotificationColors,
|
|
@@ -193,6 +197,9 @@ export {
|
|
|
193
197
|
usePreventScreenCapture,
|
|
194
198
|
Splash,
|
|
195
199
|
Developer,
|
|
200
|
+
DeveloperModal,
|
|
201
|
+
useDeveloperMode,
|
|
202
|
+
FauxHeader,
|
|
196
203
|
Terms,
|
|
197
204
|
Preface,
|
|
198
205
|
UpdateAvailable,
|