@onairos/react-native 3.1.16 → 3.1.18
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/README.md +404 -0
- package/lib/commonjs/assets/images/Checkbox.svg +3 -3
- package/lib/commonjs/assets/images/EnochE.svg +19 -19
- package/lib/commonjs/assets/images/Personalityprofile.svg +3 -3
- package/lib/commonjs/assets/images/Personalitytraits.svg +3 -3
- package/lib/commonjs/assets/images/Userpreferences.svg +3 -3
- package/lib/commonjs/assets/images/arrow.svg +20 -20
- package/lib/commonjs/assets/images/basicproficon.svg +43 -43
- package/lib/commonjs/assets/images/basicprofile.svg +3 -3
- package/lib/commonjs/assets/images/checkmark.svg +4 -4
- package/lib/commonjs/assets/images/contentanalysis.svg +3 -3
- package/lib/commonjs/assets/images/contenticon.svg +23 -23
- package/lib/commonjs/assets/images/personalityicon.svg +18 -18
- package/lib/commonjs/assets/images/x-close.svg +3 -3
- package/lib/commonjs/components/ModalSheet.js +8 -2
- package/lib/commonjs/components/ModalSheet.js.map +1 -1
- package/lib/commonjs/components/OnairosButton.js +290 -0
- package/lib/commonjs/components/OnairosButton.js.map +1 -0
- package/lib/commonjs/components/OnairosSignInButton.js +32 -8
- package/lib/commonjs/components/OnairosSignInButton.js.map +1 -1
- package/lib/commonjs/components/UniversalOnboarding.js +4 -4
- package/lib/commonjs/components/WelcomeScreen.js +29 -13
- package/lib/commonjs/components/WelcomeScreen.js.map +1 -1
- package/lib/commonjs/config/api.js +2 -2
- package/lib/commonjs/hooks/useConnections.js +6 -6
- package/lib/commonjs/hooks/useUserConnections.js +10 -10
- package/lib/commonjs/index.js +13 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/services/apiClient.js +35 -35
- package/lib/commonjs/services/apiKeyService.js +99 -99
- package/lib/commonjs/services/authService.js +82 -82
- package/lib/commonjs/services/biometricPinService.js +10 -10
- package/lib/commonjs/services/connectedAccountsService.js +32 -32
- package/lib/commonjs/services/googleAuthService.js +15 -15
- package/lib/commonjs/services/imageCompressionService.js +15 -15
- package/lib/commonjs/services/jwtStorageService.js +59 -59
- package/lib/commonjs/services/mobileTrainingService.js +14 -14
- package/lib/commonjs/services/pinEncryptionService.js +10 -10
- package/lib/commonjs/services/pinStorageUtils.js +15 -15
- package/lib/commonjs/services/platformAuthService.js +47 -47
- package/lib/commonjs/services/storageService.js +31 -31
- package/lib/commonjs/services/trainingApiHelpers.js +33 -33
- package/lib/commonjs/services/userConnectionsService.js +24 -24
- package/lib/commonjs/utils/Portal.js +4 -4
- package/lib/commonjs/utils/api.js +24 -24
- package/lib/commonjs/utils/auth.js +18 -18
- package/lib/commonjs/utils/crypto.js +13 -13
- package/lib/commonjs/utils/encryption.js +12 -12
- package/lib/commonjs/utils/eventUtils.js +52 -52
- package/lib/commonjs/utils/programmaticFlow.js +16 -16
- package/lib/commonjs/utils/retryHelper.js +27 -27
- package/lib/module/assets/images/Checkbox.svg +3 -3
- package/lib/module/assets/images/EnochE.svg +19 -19
- package/lib/module/assets/images/Personalityprofile.svg +3 -3
- package/lib/module/assets/images/Personalitytraits.svg +3 -3
- package/lib/module/assets/images/Userpreferences.svg +3 -3
- package/lib/module/assets/images/arrow.svg +20 -20
- package/lib/module/assets/images/basicproficon.svg +43 -43
- package/lib/module/assets/images/basicprofile.svg +3 -3
- package/lib/module/assets/images/checkmark.svg +4 -4
- package/lib/module/assets/images/contentanalysis.svg +3 -3
- package/lib/module/assets/images/contenticon.svg +23 -23
- package/lib/module/assets/images/personalityicon.svg +18 -18
- package/lib/module/assets/images/x-close.svg +3 -3
- package/lib/module/components/ModalSheet.js +7 -2
- package/lib/module/components/ModalSheet.js.map +1 -1
- package/lib/module/components/OnairosButton.js +282 -0
- package/lib/module/components/OnairosButton.js.map +1 -0
- package/lib/module/components/OnairosSignInButton.js +32 -8
- package/lib/module/components/OnairosSignInButton.js.map +1 -1
- package/lib/module/components/UniversalOnboarding.js +4 -4
- package/lib/module/components/WelcomeScreen.js +25 -10
- package/lib/module/components/WelcomeScreen.js.map +1 -1
- package/lib/module/config/api.js +2 -2
- package/lib/module/hooks/useConnections.js +6 -6
- package/lib/module/hooks/useUserConnections.js +10 -10
- package/lib/module/index.js +11 -11
- package/lib/module/index.js.map +1 -1
- package/lib/module/services/apiClient.js +35 -35
- package/lib/module/services/apiKeyService.js +99 -99
- package/lib/module/services/authService.js +82 -82
- package/lib/module/services/biometricPinService.js +10 -10
- package/lib/module/services/connectedAccountsService.js +32 -32
- package/lib/module/services/googleAuthService.js +15 -15
- package/lib/module/services/imageCompressionService.js +15 -15
- package/lib/module/services/jwtStorageService.js +59 -59
- package/lib/module/services/mobileTrainingService.js +14 -14
- package/lib/module/services/pinEncryptionService.js +10 -10
- package/lib/module/services/pinStorageUtils.js +15 -15
- package/lib/module/services/platformAuthService.js +47 -47
- package/lib/module/services/storageService.js +31 -31
- package/lib/module/services/trainingApiHelpers.js +33 -33
- package/lib/module/services/userConnectionsService.js +24 -24
- package/lib/module/utils/Portal.js +4 -4
- package/lib/module/utils/api.js +24 -24
- package/lib/module/utils/auth.js +18 -18
- package/lib/module/utils/crypto.js +13 -13
- package/lib/module/utils/encryption.js +12 -12
- package/lib/module/utils/eventUtils.js +52 -52
- package/lib/module/utils/programmaticFlow.js +16 -16
- package/lib/module/utils/retryHelper.js +27 -27
- package/lib/typescript/components/ModalSheet.d.ts.map +1 -1
- package/lib/typescript/components/OnairosButton.d.ts +37 -0
- package/lib/typescript/components/OnairosButton.d.ts.map +1 -0
- package/lib/typescript/components/OnairosSignInButton.d.ts.map +1 -1
- package/lib/typescript/components/WelcomeScreen.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +3 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +145 -163
- package/src/api/index.ts +151 -151
- package/src/assets/images/Checkbox.svg +3 -3
- package/src/assets/images/EnochE.svg +19 -19
- package/src/assets/images/Personalityprofile.svg +3 -3
- package/src/assets/images/Personalitytraits.svg +3 -3
- package/src/assets/images/Userpreferences.svg +3 -3
- package/src/assets/images/arrow.svg +20 -20
- package/src/assets/images/basicproficon.svg +43 -43
- package/src/assets/images/basicprofile.svg +3 -3
- package/src/assets/images/checkmark.svg +4 -4
- package/src/assets/images/contentanalysis.svg +3 -3
- package/src/assets/images/contenticon.svg +23 -23
- package/src/assets/images/personalityicon.svg +18 -18
- package/src/assets/images/x-close.svg +3 -3
- package/src/components/BodyText.tsx +33 -33
- package/src/components/BrandMark.tsx +62 -62
- package/src/components/CodeInput.tsx +32 -32
- package/src/components/DataRequestScreen.tsx +355 -355
- package/src/components/EmailInput.tsx +31 -31
- package/src/components/EmailVerificationModal.tsx +363 -363
- package/src/components/ExistingUserDataConfirmation.tsx +506 -506
- package/src/components/GoogleButton.tsx +55 -55
- package/src/components/HeadingGroup.tsx +49 -49
- package/src/components/ModalHeader.tsx +125 -125
- package/src/components/ModalSheet.tsx +59 -57
- package/src/components/Onairos.tsx +422 -422
- package/src/components/OnairosButton.tsx +339 -0
- package/src/components/OnairosSignInButton.tsx +31 -9
- package/src/components/Overlay.tsx +506 -506
- package/src/components/PersonaImage.tsx +79 -79
- package/src/components/PersonaLoadingScreen.tsx +201 -201
- package/src/components/PersonalizationConsentScreen.tsx +410 -410
- package/src/components/PinCreationScreen.tsx +492 -492
- package/src/components/PinInput.tsx +555 -555
- package/src/components/PlatformConnectorsStep.tsx +891 -891
- package/src/components/PlatformList.tsx +144 -144
- package/src/components/PlatformToggle.tsx +226 -226
- package/src/components/PrimaryButton.tsx +213 -213
- package/src/components/SignInMatchAnimation.tsx +225 -225
- package/src/components/SignInStep.tsx +217 -217
- package/src/components/TrainingModal.tsx +1047 -1047
- package/src/components/UniversalOnboarding.tsx +2887 -2887
- package/src/components/VerificationStep.tsx +198 -198
- package/src/components/WelcomeScreen.tsx +490 -473
- package/src/components/icons/Basicproficon.tsx +30 -30
- package/src/components/icons/Basicprofile.tsx +17 -17
- package/src/components/icons/Checkbox.tsx +17 -17
- package/src/components/icons/Checkmark.tsx +24 -24
- package/src/components/icons/Contentanalysis.tsx +17 -17
- package/src/components/icons/Contenticon.tsx +30 -30
- package/src/components/icons/EnochE.tsx +39 -39
- package/src/components/icons/Personalityicon.tsx +22 -22
- package/src/components/icons/Personalityprofile.tsx +17 -17
- package/src/components/icons/Personalitytraits.tsx +17 -17
- package/src/components/icons/Userpreferences.tsx +17 -17
- package/src/components/icons/index.ts +12 -12
- package/src/components/onboarding/OAuthWebView.tsx +232 -232
- package/src/config/api.ts +25 -25
- package/src/context/AuthContext.tsx +393 -393
- package/src/hooks/useConnectedAccounts.ts +138 -138
- package/src/hooks/useConnections.ts +161 -161
- package/src/hooks/useCredentials.ts +174 -174
- package/src/hooks/useUserConnections.ts +165 -165
- package/src/index.js +14 -0
- package/src/index.ts +99 -96
- package/src/services/apiClient.ts +336 -336
- package/src/services/apiKeyService.ts +919 -919
- package/src/services/authService.ts +1008 -1008
- package/src/services/biometricPinService.ts +192 -192
- package/src/services/connectedAccountsService.ts +289 -289
- package/src/services/googleAuthService.ts +279 -279
- package/src/services/imageCompressionService.ts +302 -302
- package/src/services/jwtStorageService.ts +256 -256
- package/src/services/mobileTrainingService.ts +203 -203
- package/src/services/pinEncryptionService.ts +75 -75
- package/src/services/pinStorageUtils.ts +96 -96
- package/src/services/platformAuthService.ts +1346 -1346
- package/src/services/storageService.ts +451 -451
- package/src/services/trainingApiHelpers.ts +66 -66
- package/src/services/userConnectionsService.ts +556 -556
- package/src/services/youtubeMigrationService.ts +453 -453
- package/src/theme/index.ts +239 -239
- package/src/types/ambient.d.ts +28 -28
- package/src/types/index.ts +265 -265
- package/src/types/node-fix.d.ts +18 -18
- package/src/types/node-override.d.ts +23 -23
- package/src/types/opacity.d.ts +15 -15
- package/src/types/types.d.ts +17 -17
- package/src/utils/Portal.tsx +82 -82
- package/src/utils/api.js +111 -111
- package/src/utils/auth.js +103 -103
- package/src/utils/crypto.js +59 -59
- package/src/utils/encryption.ts +68 -68
- package/src/utils/eventUtils.ts +302 -302
- package/src/utils/haptics.ts +58 -58
- package/src/utils/imagePreloader.ts +2 -2
- package/src/utils/programmaticFlow.ts +112 -112
- package/src/utils/retryHelper.ts +274 -274
|
@@ -1,492 +1,492 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
View,
|
|
4
|
-
Text,
|
|
5
|
-
StyleSheet,
|
|
6
|
-
TouchableOpacity,
|
|
7
|
-
TextInput,
|
|
8
|
-
Alert,
|
|
9
|
-
ActivityIndicator,
|
|
10
|
-
} from 'react-native';
|
|
11
|
-
import { COLORS } from '../theme';
|
|
12
|
-
import { triggerHaptic, HapticType } from '../utils/haptics';
|
|
13
|
-
import { biometricPinService } from '../services/biometricPinService';
|
|
14
|
-
import { setTemporaryPin } from '../services/pinStorageUtils';
|
|
15
|
-
|
|
16
|
-
interface PinCreationScreenProps {
|
|
17
|
-
visible: boolean;
|
|
18
|
-
onComplete: (pin: string) => void;
|
|
19
|
-
onBack: () => void;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const PinCreationScreen: React.FC<PinCreationScreenProps> = ({
|
|
23
|
-
visible,
|
|
24
|
-
onComplete,
|
|
25
|
-
onBack,
|
|
26
|
-
}) => {
|
|
27
|
-
const [pin, setPin] = useState('');
|
|
28
|
-
const [requirements, setRequirements] = useState({
|
|
29
|
-
length: false,
|
|
30
|
-
uppercase: false,
|
|
31
|
-
number: false,
|
|
32
|
-
});
|
|
33
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
34
|
-
const [biometricAvailable, setBiometricAvailable] = useState(false);
|
|
35
|
-
const [biometricStatus, setBiometricStatus] = useState<'checking' | 'available' | 'unavailable' | 'storing' | 'success' | 'error'>('checking');
|
|
36
|
-
|
|
37
|
-
const validatePin = (pinText: string) => {
|
|
38
|
-
const newRequirements = {
|
|
39
|
-
length: pinText.length >= 6,
|
|
40
|
-
uppercase: /[A-Z]/.test(pinText),
|
|
41
|
-
number: /[0-9]/.test(pinText),
|
|
42
|
-
};
|
|
43
|
-
setRequirements(newRequirements);
|
|
44
|
-
return Object.values(newRequirements).every(req => req);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const handlePinChange = (text: string) => {
|
|
48
|
-
setPin(text);
|
|
49
|
-
validatePin(text);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const handleContinue = async () => {
|
|
53
|
-
if (!validatePin(pin)) {
|
|
54
|
-
triggerHaptic(HapticType.ERROR);
|
|
55
|
-
Alert.alert('Invalid PIN', 'Please ensure your PIN meets all requirements.');
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
60
|
-
setIsLoading(true);
|
|
61
|
-
|
|
62
|
-
try {
|
|
63
|
-
console.log('🔐 Starting PIN creation process...');
|
|
64
|
-
|
|
65
|
-
// Store PIN temporarily for the onboarding flow first
|
|
66
|
-
setTemporaryPin(pin);
|
|
67
|
-
console.log('📝 PIN stored temporarily for onboarding');
|
|
68
|
-
|
|
69
|
-
// If biometric is available, immediately trigger Face ID authentication
|
|
70
|
-
if (biometricAvailable) {
|
|
71
|
-
setBiometricStatus('storing');
|
|
72
|
-
console.log('🔐 [PIN CREATION] Biometric storage enabled, starting biometric flow...');
|
|
73
|
-
|
|
74
|
-
// Double-check biometric availability right before triggering
|
|
75
|
-
const biometricStillAvailable = await biometricPinService.isBiometricAvailable();
|
|
76
|
-
console.log('📱 [PIN CREATION] Biometric available before storage:', biometricStillAvailable);
|
|
77
|
-
|
|
78
|
-
if (!biometricStillAvailable) {
|
|
79
|
-
console.error('❌ [PIN CREATION] Face ID not available on this device');
|
|
80
|
-
setBiometricStatus('unavailable');
|
|
81
|
-
setIsLoading(false);
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Immediately attempt to store PIN with biometric authentication
|
|
86
|
-
console.log('🔐 [PIN CREATION] Triggering biometric authentication for PIN storage...');
|
|
87
|
-
|
|
88
|
-
// This will immediately show the Face ID prompt
|
|
89
|
-
const stored = await biometricPinService.storePinWithBiometric(pin);
|
|
90
|
-
|
|
91
|
-
if (stored) {
|
|
92
|
-
console.log('✅ PIN stored successfully with Face ID');
|
|
93
|
-
|
|
94
|
-
// Verify the PIN was actually stored by checking if it can be retrieved
|
|
95
|
-
const isStored = await biometricPinService.isPinStored();
|
|
96
|
-
if (isStored) {
|
|
97
|
-
console.log('✅ PIN storage verified - proceeding with onboarding');
|
|
98
|
-
setBiometricStatus('success');
|
|
99
|
-
triggerHaptic(HapticType.SUCCESS);
|
|
100
|
-
|
|
101
|
-
// Brief success state, then continue
|
|
102
|
-
setTimeout(() => {
|
|
103
|
-
setIsLoading(false);
|
|
104
|
-
onComplete(pin);
|
|
105
|
-
}, 800);
|
|
106
|
-
} else {
|
|
107
|
-
console.error('❌ PIN storage verification failed');
|
|
108
|
-
setBiometricStatus('error');
|
|
109
|
-
setIsLoading(false);
|
|
110
|
-
triggerHaptic(HapticType.ERROR);
|
|
111
|
-
Alert.alert(
|
|
112
|
-
'PIN Storage Error',
|
|
113
|
-
'PIN storage verification failed. Please try again.',
|
|
114
|
-
[{ text: 'OK' }]
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
} else {
|
|
118
|
-
console.log('⚠️ Face ID authentication was cancelled or failed');
|
|
119
|
-
setBiometricStatus('error');
|
|
120
|
-
triggerHaptic(HapticType.ERROR);
|
|
121
|
-
|
|
122
|
-
// Show error but still allow continuation
|
|
123
|
-
Alert.alert(
|
|
124
|
-
'Face ID Setup',
|
|
125
|
-
'Face ID authentication was cancelled or failed. Your PIN is still saved securely.',
|
|
126
|
-
[
|
|
127
|
-
{
|
|
128
|
-
text: 'Try Again',
|
|
129
|
-
onPress: () => {
|
|
130
|
-
setIsLoading(false);
|
|
131
|
-
setBiometricStatus('available');
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
text: 'Continue Without Face ID',
|
|
136
|
-
onPress: () => {
|
|
137
|
-
setIsLoading(false);
|
|
138
|
-
onComplete(pin);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
]
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
} else {
|
|
145
|
-
console.log('📱 Biometric not available, continuing without Face ID');
|
|
146
|
-
setBiometricStatus('unavailable');
|
|
147
|
-
setIsLoading(false);
|
|
148
|
-
onComplete(pin);
|
|
149
|
-
}
|
|
150
|
-
} catch (error) {
|
|
151
|
-
console.error('❌ Error in PIN creation process:', error);
|
|
152
|
-
setBiometricStatus('error');
|
|
153
|
-
setIsLoading(false);
|
|
154
|
-
triggerHaptic(HapticType.ERROR);
|
|
155
|
-
Alert.alert(
|
|
156
|
-
'PIN Creation Error',
|
|
157
|
-
'There was an issue creating your PIN. Please try again.',
|
|
158
|
-
[{ text: 'OK' }]
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
const handleBack = () => {
|
|
164
|
-
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
165
|
-
onBack();
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
// Check biometric availability on component mount
|
|
169
|
-
useEffect(() => {
|
|
170
|
-
const checkBiometric = async () => {
|
|
171
|
-
try {
|
|
172
|
-
setBiometricStatus('checking');
|
|
173
|
-
const available = await biometricPinService.isBiometricAvailable();
|
|
174
|
-
setBiometricAvailable(available);
|
|
175
|
-
setBiometricStatus(available ? 'available' : 'unavailable');
|
|
176
|
-
console.log('📱 Biometric availability check:', available);
|
|
177
|
-
} catch (error) {
|
|
178
|
-
console.error('❌ Error checking biometric availability:', error);
|
|
179
|
-
setBiometricAvailable(false);
|
|
180
|
-
setBiometricStatus('unavailable');
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
if (visible) {
|
|
185
|
-
checkBiometric();
|
|
186
|
-
}
|
|
187
|
-
}, [visible]);
|
|
188
|
-
|
|
189
|
-
const allRequirementsMet = Object.values(requirements).every(req => req);
|
|
190
|
-
|
|
191
|
-
if (!visible) return null;
|
|
192
|
-
|
|
193
|
-
return (
|
|
194
|
-
<View style={styles.container}>
|
|
195
|
-
{/* Title */}
|
|
196
|
-
<View style={styles.titleContainer}>
|
|
197
|
-
<Text style={styles.title}>Create a PIN</Text>
|
|
198
|
-
<Text style={styles.subtitle}>A PIN so only you have access to your data.</Text>
|
|
199
|
-
</View>
|
|
200
|
-
|
|
201
|
-
{/* PIN Input */}
|
|
202
|
-
<View style={styles.pinContainer}>
|
|
203
|
-
<TextInput
|
|
204
|
-
style={styles.pinInput}
|
|
205
|
-
value={pin}
|
|
206
|
-
onChangeText={handlePinChange}
|
|
207
|
-
placeholder="Enter your PIN"
|
|
208
|
-
secureTextEntry
|
|
209
|
-
autoFocus
|
|
210
|
-
maxLength={20}
|
|
211
|
-
/>
|
|
212
|
-
</View>
|
|
213
|
-
|
|
214
|
-
{/* Requirements */}
|
|
215
|
-
<View style={styles.requirementsContainer}>
|
|
216
|
-
<Text style={styles.requirementsTitle}>Your PIN must:</Text>
|
|
217
|
-
|
|
218
|
-
<View style={styles.requirementItem}>
|
|
219
|
-
<View style={[styles.checkbox, requirements.length && styles.checkboxChecked]}>
|
|
220
|
-
{requirements.length && <Text style={styles.checkmark}>✓</Text>}
|
|
221
|
-
</View>
|
|
222
|
-
<Text style={[styles.requirementText, requirements.length && styles.requirementTextMet]}>
|
|
223
|
-
Be at least 6 characters in length.
|
|
224
|
-
</Text>
|
|
225
|
-
</View>
|
|
226
|
-
|
|
227
|
-
<View style={styles.requirementItem}>
|
|
228
|
-
<View style={[styles.checkbox, requirements.uppercase && styles.checkboxChecked]}>
|
|
229
|
-
{requirements.uppercase && <Text style={styles.checkmark}>✓</Text>}
|
|
230
|
-
</View>
|
|
231
|
-
<Text style={[styles.requirementText, requirements.uppercase && styles.requirementTextMet]}>
|
|
232
|
-
Contain an uppercase letter.
|
|
233
|
-
</Text>
|
|
234
|
-
</View>
|
|
235
|
-
|
|
236
|
-
<View style={styles.requirementItem}>
|
|
237
|
-
<View style={[styles.checkbox, requirements.number && styles.checkboxChecked]}>
|
|
238
|
-
{requirements.number && <Text style={styles.checkmark}>✓</Text>}
|
|
239
|
-
</View>
|
|
240
|
-
<Text style={[styles.requirementText, requirements.number && styles.requirementTextMet]}>
|
|
241
|
-
Contain a number.
|
|
242
|
-
</Text>
|
|
243
|
-
</View>
|
|
244
|
-
</View>
|
|
245
|
-
|
|
246
|
-
{/* FaceID Security Card */}
|
|
247
|
-
<View style={[
|
|
248
|
-
styles.securityCard,
|
|
249
|
-
biometricStatus === 'success' && styles.securityCardSuccess,
|
|
250
|
-
biometricStatus === 'error' && styles.securityCardError
|
|
251
|
-
]}>
|
|
252
|
-
<View style={styles.securityIconContainer}>
|
|
253
|
-
{biometricStatus === 'checking' && (
|
|
254
|
-
<ActivityIndicator size="small" color={COLORS.grey600} />
|
|
255
|
-
)}
|
|
256
|
-
{biometricStatus === 'storing' && (
|
|
257
|
-
<ActivityIndicator size="small" color="#D4A536" />
|
|
258
|
-
)}
|
|
259
|
-
{biometricStatus === 'available' && (
|
|
260
|
-
<Text style={styles.securityIcon}>🔐</Text>
|
|
261
|
-
)}
|
|
262
|
-
{biometricStatus === 'unavailable' && (
|
|
263
|
-
<Text style={styles.securityIcon}>⚠️</Text>
|
|
264
|
-
)}
|
|
265
|
-
{biometricStatus === 'success' && (
|
|
266
|
-
<Text style={styles.securityIcon}>✅</Text>
|
|
267
|
-
)}
|
|
268
|
-
{biometricStatus === 'error' && (
|
|
269
|
-
<Text style={styles.securityIcon}>❌</Text>
|
|
270
|
-
)}
|
|
271
|
-
</View>
|
|
272
|
-
<View style={styles.securityTextContainer}>
|
|
273
|
-
<Text style={styles.securityTitle}>
|
|
274
|
-
{biometricStatus === 'checking' && 'Checking Face ID...'}
|
|
275
|
-
{biometricStatus === 'available' && 'Enhanced Security'}
|
|
276
|
-
{biometricStatus === 'unavailable' && 'Face ID Unavailable'}
|
|
277
|
-
{biometricStatus === 'storing' && 'Securing with Face ID...'}
|
|
278
|
-
{biometricStatus === 'success' && 'PIN Secured with Face ID'}
|
|
279
|
-
{biometricStatus === 'error' && 'Face ID Setup Failed'}
|
|
280
|
-
</Text>
|
|
281
|
-
<Text style={styles.securityDescription}>
|
|
282
|
-
{biometricStatus === 'checking' && 'Verifying Face ID availability on your device.'}
|
|
283
|
-
{biometricStatus === 'available' && 'We use Face ID to ensure only you can access your data.'}
|
|
284
|
-
{biometricStatus === 'unavailable' && 'Face ID is not available on this device. Your PIN will be stored securely.'}
|
|
285
|
-
{biometricStatus === 'storing' && 'Please authenticate with Face ID to secure your PIN.'}
|
|
286
|
-
{biometricStatus === 'success' && 'Your PIN is now protected with Face ID authentication.'}
|
|
287
|
-
{biometricStatus === 'error' && 'Face ID setup failed, but your PIN is stored securely.'}
|
|
288
|
-
</Text>
|
|
289
|
-
</View>
|
|
290
|
-
</View>
|
|
291
|
-
|
|
292
|
-
{/* Continue Button */}
|
|
293
|
-
<View style={styles.buttonContainer}>
|
|
294
|
-
<TouchableOpacity
|
|
295
|
-
style={[
|
|
296
|
-
styles.continueButton,
|
|
297
|
-
allRequirementsMet && styles.continueButtonActive
|
|
298
|
-
]}
|
|
299
|
-
onPress={handleContinue}
|
|
300
|
-
disabled={!allRequirementsMet || isLoading}
|
|
301
|
-
>
|
|
302
|
-
{isLoading ? (
|
|
303
|
-
<ActivityIndicator size="small" color="#FFFFFF" />
|
|
304
|
-
) : (
|
|
305
|
-
<Text style={[
|
|
306
|
-
styles.continueButtonText,
|
|
307
|
-
allRequirementsMet && styles.continueButtonTextActive
|
|
308
|
-
]}>
|
|
309
|
-
Continue
|
|
310
|
-
</Text>
|
|
311
|
-
)}
|
|
312
|
-
</TouchableOpacity>
|
|
313
|
-
</View>
|
|
314
|
-
</View>
|
|
315
|
-
);
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
const styles = StyleSheet.create({
|
|
319
|
-
container: {
|
|
320
|
-
flex: 1,
|
|
321
|
-
backgroundColor: COLORS.surface,
|
|
322
|
-
paddingHorizontal: 24,
|
|
323
|
-
paddingTop: 0,
|
|
324
|
-
},
|
|
325
|
-
|
|
326
|
-
titleContainer: {
|
|
327
|
-
alignItems: 'center',
|
|
328
|
-
marginBottom: 15,
|
|
329
|
-
paddingTop: -10,
|
|
330
|
-
marginTop: -15,
|
|
331
|
-
},
|
|
332
|
-
|
|
333
|
-
title: {
|
|
334
|
-
fontSize: 24,
|
|
335
|
-
fontWeight: '700',
|
|
336
|
-
color: COLORS.grey800,
|
|
337
|
-
marginBottom: 8,
|
|
338
|
-
fontFamily: 'IBM Plex Sans',
|
|
339
|
-
},
|
|
340
|
-
|
|
341
|
-
subtitle: {
|
|
342
|
-
fontSize: 16,
|
|
343
|
-
color: COLORS.grey600,
|
|
344
|
-
lineHeight: 24,
|
|
345
|
-
fontFamily: 'Inter',
|
|
346
|
-
},
|
|
347
|
-
|
|
348
|
-
pinContainer: {
|
|
349
|
-
marginBottom: 32,
|
|
350
|
-
},
|
|
351
|
-
|
|
352
|
-
pinInput: {
|
|
353
|
-
backgroundColor: '#F8F9FA',
|
|
354
|
-
borderRadius: 12,
|
|
355
|
-
paddingVertical: 16,
|
|
356
|
-
paddingHorizontal: 16,
|
|
357
|
-
fontSize: 16,
|
|
358
|
-
fontFamily: 'Inter',
|
|
359
|
-
borderWidth: 1,
|
|
360
|
-
borderColor: '#E5E5E5',
|
|
361
|
-
},
|
|
362
|
-
|
|
363
|
-
requirementsContainer: {
|
|
364
|
-
marginBottom: 32,
|
|
365
|
-
},
|
|
366
|
-
|
|
367
|
-
requirementsTitle: {
|
|
368
|
-
fontSize: 16,
|
|
369
|
-
fontWeight: '600',
|
|
370
|
-
color: COLORS.grey800,
|
|
371
|
-
marginBottom: 16,
|
|
372
|
-
fontFamily: 'Inter',
|
|
373
|
-
},
|
|
374
|
-
|
|
375
|
-
requirementItem: {
|
|
376
|
-
flexDirection: 'row',
|
|
377
|
-
alignItems: 'center',
|
|
378
|
-
marginBottom: 12,
|
|
379
|
-
},
|
|
380
|
-
|
|
381
|
-
checkbox: {
|
|
382
|
-
width: 20,
|
|
383
|
-
height: 20,
|
|
384
|
-
borderRadius: 10,
|
|
385
|
-
borderWidth: 2,
|
|
386
|
-
borderColor: '#E5E5E5',
|
|
387
|
-
marginRight: 12,
|
|
388
|
-
alignItems: 'center',
|
|
389
|
-
justifyContent: 'center',
|
|
390
|
-
},
|
|
391
|
-
|
|
392
|
-
checkboxChecked: {
|
|
393
|
-
borderColor: '#4CD964',
|
|
394
|
-
backgroundColor: '#4CD964',
|
|
395
|
-
},
|
|
396
|
-
|
|
397
|
-
checkmark: {
|
|
398
|
-
color: '#FFFFFF',
|
|
399
|
-
fontSize: 12,
|
|
400
|
-
fontWeight: 'bold',
|
|
401
|
-
},
|
|
402
|
-
|
|
403
|
-
requirementText: {
|
|
404
|
-
fontSize: 14,
|
|
405
|
-
color: COLORS.grey600,
|
|
406
|
-
fontFamily: 'Inter',
|
|
407
|
-
flex: 1,
|
|
408
|
-
},
|
|
409
|
-
|
|
410
|
-
requirementTextMet: {
|
|
411
|
-
color: COLORS.grey800,
|
|
412
|
-
},
|
|
413
|
-
|
|
414
|
-
securityCard: {
|
|
415
|
-
backgroundColor: '#F8F9FA',
|
|
416
|
-
borderRadius: 12,
|
|
417
|
-
padding: 16,
|
|
418
|
-
flexDirection: 'row',
|
|
419
|
-
alignItems: 'center',
|
|
420
|
-
marginBottom: 24,
|
|
421
|
-
borderWidth: 1,
|
|
422
|
-
borderColor: '#E5E5E5',
|
|
423
|
-
},
|
|
424
|
-
|
|
425
|
-
securityCardSuccess: {
|
|
426
|
-
backgroundColor: '#F0FDF4',
|
|
427
|
-
borderColor: '#22C55E',
|
|
428
|
-
},
|
|
429
|
-
|
|
430
|
-
securityCardError: {
|
|
431
|
-
backgroundColor: '#FEF2F2',
|
|
432
|
-
borderColor: '#EF4444',
|
|
433
|
-
},
|
|
434
|
-
|
|
435
|
-
securityIconContainer: {
|
|
436
|
-
marginRight: 12,
|
|
437
|
-
},
|
|
438
|
-
|
|
439
|
-
securityIcon: {
|
|
440
|
-
fontSize: 24,
|
|
441
|
-
},
|
|
442
|
-
|
|
443
|
-
securityTextContainer: {
|
|
444
|
-
flex: 1,
|
|
445
|
-
},
|
|
446
|
-
|
|
447
|
-
securityTitle: {
|
|
448
|
-
fontSize: 14,
|
|
449
|
-
fontWeight: '600',
|
|
450
|
-
color: COLORS.grey800,
|
|
451
|
-
marginBottom: 4,
|
|
452
|
-
fontFamily: 'Inter',
|
|
453
|
-
},
|
|
454
|
-
|
|
455
|
-
securityDescription: {
|
|
456
|
-
fontSize: 13,
|
|
457
|
-
color: COLORS.grey600,
|
|
458
|
-
lineHeight: 18,
|
|
459
|
-
fontFamily: 'Inter',
|
|
460
|
-
},
|
|
461
|
-
|
|
462
|
-
buttonContainer: {
|
|
463
|
-
marginTop: 'auto',
|
|
464
|
-
paddingBottom: 34,
|
|
465
|
-
},
|
|
466
|
-
|
|
467
|
-
continueButton: {
|
|
468
|
-
backgroundColor: '#E5E5E5',
|
|
469
|
-
borderRadius: 25,
|
|
470
|
-
paddingVertical: 16,
|
|
471
|
-
alignItems: 'center',
|
|
472
|
-
justifyContent: 'center',
|
|
473
|
-
},
|
|
474
|
-
|
|
475
|
-
continueButtonActive: {
|
|
476
|
-
backgroundColor: '#2D3436',
|
|
477
|
-
},
|
|
478
|
-
|
|
479
|
-
continueButtonText: {
|
|
480
|
-
fontSize: 16,
|
|
481
|
-
fontWeight: '600',
|
|
482
|
-
color: '#999999',
|
|
483
|
-
fontFamily: 'Inter',
|
|
484
|
-
},
|
|
485
|
-
|
|
486
|
-
continueButtonTextActive: {
|
|
487
|
-
color: '#FFFFFF',
|
|
488
|
-
},
|
|
489
|
-
});
|
|
490
|
-
|
|
491
|
-
export { PinCreationScreen };
|
|
492
|
-
export default PinCreationScreen;
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
TextInput,
|
|
8
|
+
Alert,
|
|
9
|
+
ActivityIndicator,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
import { COLORS } from '../theme';
|
|
12
|
+
import { triggerHaptic, HapticType } from '../utils/haptics';
|
|
13
|
+
import { biometricPinService } from '../services/biometricPinService';
|
|
14
|
+
import { setTemporaryPin } from '../services/pinStorageUtils';
|
|
15
|
+
|
|
16
|
+
interface PinCreationScreenProps {
|
|
17
|
+
visible: boolean;
|
|
18
|
+
onComplete: (pin: string) => void;
|
|
19
|
+
onBack: () => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const PinCreationScreen: React.FC<PinCreationScreenProps> = ({
|
|
23
|
+
visible,
|
|
24
|
+
onComplete,
|
|
25
|
+
onBack,
|
|
26
|
+
}) => {
|
|
27
|
+
const [pin, setPin] = useState('');
|
|
28
|
+
const [requirements, setRequirements] = useState({
|
|
29
|
+
length: false,
|
|
30
|
+
uppercase: false,
|
|
31
|
+
number: false,
|
|
32
|
+
});
|
|
33
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
34
|
+
const [biometricAvailable, setBiometricAvailable] = useState(false);
|
|
35
|
+
const [biometricStatus, setBiometricStatus] = useState<'checking' | 'available' | 'unavailable' | 'storing' | 'success' | 'error'>('checking');
|
|
36
|
+
|
|
37
|
+
const validatePin = (pinText: string) => {
|
|
38
|
+
const newRequirements = {
|
|
39
|
+
length: pinText.length >= 6,
|
|
40
|
+
uppercase: /[A-Z]/.test(pinText),
|
|
41
|
+
number: /[0-9]/.test(pinText),
|
|
42
|
+
};
|
|
43
|
+
setRequirements(newRequirements);
|
|
44
|
+
return Object.values(newRequirements).every(req => req);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const handlePinChange = (text: string) => {
|
|
48
|
+
setPin(text);
|
|
49
|
+
validatePin(text);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const handleContinue = async () => {
|
|
53
|
+
if (!validatePin(pin)) {
|
|
54
|
+
triggerHaptic(HapticType.ERROR);
|
|
55
|
+
Alert.alert('Invalid PIN', 'Please ensure your PIN meets all requirements.');
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
60
|
+
setIsLoading(true);
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
console.log('🔐 Starting PIN creation process...');
|
|
64
|
+
|
|
65
|
+
// Store PIN temporarily for the onboarding flow first
|
|
66
|
+
setTemporaryPin(pin);
|
|
67
|
+
console.log('📝 PIN stored temporarily for onboarding');
|
|
68
|
+
|
|
69
|
+
// If biometric is available, immediately trigger Face ID authentication
|
|
70
|
+
if (biometricAvailable) {
|
|
71
|
+
setBiometricStatus('storing');
|
|
72
|
+
console.log('🔐 [PIN CREATION] Biometric storage enabled, starting biometric flow...');
|
|
73
|
+
|
|
74
|
+
// Double-check biometric availability right before triggering
|
|
75
|
+
const biometricStillAvailable = await biometricPinService.isBiometricAvailable();
|
|
76
|
+
console.log('📱 [PIN CREATION] Biometric available before storage:', biometricStillAvailable);
|
|
77
|
+
|
|
78
|
+
if (!biometricStillAvailable) {
|
|
79
|
+
console.error('❌ [PIN CREATION] Face ID not available on this device');
|
|
80
|
+
setBiometricStatus('unavailable');
|
|
81
|
+
setIsLoading(false);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Immediately attempt to store PIN with biometric authentication
|
|
86
|
+
console.log('🔐 [PIN CREATION] Triggering biometric authentication for PIN storage...');
|
|
87
|
+
|
|
88
|
+
// This will immediately show the Face ID prompt
|
|
89
|
+
const stored = await biometricPinService.storePinWithBiometric(pin);
|
|
90
|
+
|
|
91
|
+
if (stored) {
|
|
92
|
+
console.log('✅ PIN stored successfully with Face ID');
|
|
93
|
+
|
|
94
|
+
// Verify the PIN was actually stored by checking if it can be retrieved
|
|
95
|
+
const isStored = await biometricPinService.isPinStored();
|
|
96
|
+
if (isStored) {
|
|
97
|
+
console.log('✅ PIN storage verified - proceeding with onboarding');
|
|
98
|
+
setBiometricStatus('success');
|
|
99
|
+
triggerHaptic(HapticType.SUCCESS);
|
|
100
|
+
|
|
101
|
+
// Brief success state, then continue
|
|
102
|
+
setTimeout(() => {
|
|
103
|
+
setIsLoading(false);
|
|
104
|
+
onComplete(pin);
|
|
105
|
+
}, 800);
|
|
106
|
+
} else {
|
|
107
|
+
console.error('❌ PIN storage verification failed');
|
|
108
|
+
setBiometricStatus('error');
|
|
109
|
+
setIsLoading(false);
|
|
110
|
+
triggerHaptic(HapticType.ERROR);
|
|
111
|
+
Alert.alert(
|
|
112
|
+
'PIN Storage Error',
|
|
113
|
+
'PIN storage verification failed. Please try again.',
|
|
114
|
+
[{ text: 'OK' }]
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
console.log('⚠️ Face ID authentication was cancelled or failed');
|
|
119
|
+
setBiometricStatus('error');
|
|
120
|
+
triggerHaptic(HapticType.ERROR);
|
|
121
|
+
|
|
122
|
+
// Show error but still allow continuation
|
|
123
|
+
Alert.alert(
|
|
124
|
+
'Face ID Setup',
|
|
125
|
+
'Face ID authentication was cancelled or failed. Your PIN is still saved securely.',
|
|
126
|
+
[
|
|
127
|
+
{
|
|
128
|
+
text: 'Try Again',
|
|
129
|
+
onPress: () => {
|
|
130
|
+
setIsLoading(false);
|
|
131
|
+
setBiometricStatus('available');
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
text: 'Continue Without Face ID',
|
|
136
|
+
onPress: () => {
|
|
137
|
+
setIsLoading(false);
|
|
138
|
+
onComplete(pin);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
} else {
|
|
145
|
+
console.log('📱 Biometric not available, continuing without Face ID');
|
|
146
|
+
setBiometricStatus('unavailable');
|
|
147
|
+
setIsLoading(false);
|
|
148
|
+
onComplete(pin);
|
|
149
|
+
}
|
|
150
|
+
} catch (error) {
|
|
151
|
+
console.error('❌ Error in PIN creation process:', error);
|
|
152
|
+
setBiometricStatus('error');
|
|
153
|
+
setIsLoading(false);
|
|
154
|
+
triggerHaptic(HapticType.ERROR);
|
|
155
|
+
Alert.alert(
|
|
156
|
+
'PIN Creation Error',
|
|
157
|
+
'There was an issue creating your PIN. Please try again.',
|
|
158
|
+
[{ text: 'OK' }]
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const handleBack = () => {
|
|
164
|
+
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
165
|
+
onBack();
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// Check biometric availability on component mount
|
|
169
|
+
useEffect(() => {
|
|
170
|
+
const checkBiometric = async () => {
|
|
171
|
+
try {
|
|
172
|
+
setBiometricStatus('checking');
|
|
173
|
+
const available = await biometricPinService.isBiometricAvailable();
|
|
174
|
+
setBiometricAvailable(available);
|
|
175
|
+
setBiometricStatus(available ? 'available' : 'unavailable');
|
|
176
|
+
console.log('📱 Biometric availability check:', available);
|
|
177
|
+
} catch (error) {
|
|
178
|
+
console.error('❌ Error checking biometric availability:', error);
|
|
179
|
+
setBiometricAvailable(false);
|
|
180
|
+
setBiometricStatus('unavailable');
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
if (visible) {
|
|
185
|
+
checkBiometric();
|
|
186
|
+
}
|
|
187
|
+
}, [visible]);
|
|
188
|
+
|
|
189
|
+
const allRequirementsMet = Object.values(requirements).every(req => req);
|
|
190
|
+
|
|
191
|
+
if (!visible) return null;
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
<View style={styles.container}>
|
|
195
|
+
{/* Title */}
|
|
196
|
+
<View style={styles.titleContainer}>
|
|
197
|
+
<Text style={styles.title}>Create a PIN</Text>
|
|
198
|
+
<Text style={styles.subtitle}>A PIN so only you have access to your data.</Text>
|
|
199
|
+
</View>
|
|
200
|
+
|
|
201
|
+
{/* PIN Input */}
|
|
202
|
+
<View style={styles.pinContainer}>
|
|
203
|
+
<TextInput
|
|
204
|
+
style={styles.pinInput}
|
|
205
|
+
value={pin}
|
|
206
|
+
onChangeText={handlePinChange}
|
|
207
|
+
placeholder="Enter your PIN"
|
|
208
|
+
secureTextEntry
|
|
209
|
+
autoFocus
|
|
210
|
+
maxLength={20}
|
|
211
|
+
/>
|
|
212
|
+
</View>
|
|
213
|
+
|
|
214
|
+
{/* Requirements */}
|
|
215
|
+
<View style={styles.requirementsContainer}>
|
|
216
|
+
<Text style={styles.requirementsTitle}>Your PIN must:</Text>
|
|
217
|
+
|
|
218
|
+
<View style={styles.requirementItem}>
|
|
219
|
+
<View style={[styles.checkbox, requirements.length && styles.checkboxChecked]}>
|
|
220
|
+
{requirements.length && <Text style={styles.checkmark}>✓</Text>}
|
|
221
|
+
</View>
|
|
222
|
+
<Text style={[styles.requirementText, requirements.length && styles.requirementTextMet]}>
|
|
223
|
+
Be at least 6 characters in length.
|
|
224
|
+
</Text>
|
|
225
|
+
</View>
|
|
226
|
+
|
|
227
|
+
<View style={styles.requirementItem}>
|
|
228
|
+
<View style={[styles.checkbox, requirements.uppercase && styles.checkboxChecked]}>
|
|
229
|
+
{requirements.uppercase && <Text style={styles.checkmark}>✓</Text>}
|
|
230
|
+
</View>
|
|
231
|
+
<Text style={[styles.requirementText, requirements.uppercase && styles.requirementTextMet]}>
|
|
232
|
+
Contain an uppercase letter.
|
|
233
|
+
</Text>
|
|
234
|
+
</View>
|
|
235
|
+
|
|
236
|
+
<View style={styles.requirementItem}>
|
|
237
|
+
<View style={[styles.checkbox, requirements.number && styles.checkboxChecked]}>
|
|
238
|
+
{requirements.number && <Text style={styles.checkmark}>✓</Text>}
|
|
239
|
+
</View>
|
|
240
|
+
<Text style={[styles.requirementText, requirements.number && styles.requirementTextMet]}>
|
|
241
|
+
Contain a number.
|
|
242
|
+
</Text>
|
|
243
|
+
</View>
|
|
244
|
+
</View>
|
|
245
|
+
|
|
246
|
+
{/* FaceID Security Card */}
|
|
247
|
+
<View style={[
|
|
248
|
+
styles.securityCard,
|
|
249
|
+
biometricStatus === 'success' && styles.securityCardSuccess,
|
|
250
|
+
biometricStatus === 'error' && styles.securityCardError
|
|
251
|
+
]}>
|
|
252
|
+
<View style={styles.securityIconContainer}>
|
|
253
|
+
{biometricStatus === 'checking' && (
|
|
254
|
+
<ActivityIndicator size="small" color={COLORS.grey600} />
|
|
255
|
+
)}
|
|
256
|
+
{biometricStatus === 'storing' && (
|
|
257
|
+
<ActivityIndicator size="small" color="#D4A536" />
|
|
258
|
+
)}
|
|
259
|
+
{biometricStatus === 'available' && (
|
|
260
|
+
<Text style={styles.securityIcon}>🔐</Text>
|
|
261
|
+
)}
|
|
262
|
+
{biometricStatus === 'unavailable' && (
|
|
263
|
+
<Text style={styles.securityIcon}>⚠️</Text>
|
|
264
|
+
)}
|
|
265
|
+
{biometricStatus === 'success' && (
|
|
266
|
+
<Text style={styles.securityIcon}>✅</Text>
|
|
267
|
+
)}
|
|
268
|
+
{biometricStatus === 'error' && (
|
|
269
|
+
<Text style={styles.securityIcon}>❌</Text>
|
|
270
|
+
)}
|
|
271
|
+
</View>
|
|
272
|
+
<View style={styles.securityTextContainer}>
|
|
273
|
+
<Text style={styles.securityTitle}>
|
|
274
|
+
{biometricStatus === 'checking' && 'Checking Face ID...'}
|
|
275
|
+
{biometricStatus === 'available' && 'Enhanced Security'}
|
|
276
|
+
{biometricStatus === 'unavailable' && 'Face ID Unavailable'}
|
|
277
|
+
{biometricStatus === 'storing' && 'Securing with Face ID...'}
|
|
278
|
+
{biometricStatus === 'success' && 'PIN Secured with Face ID'}
|
|
279
|
+
{biometricStatus === 'error' && 'Face ID Setup Failed'}
|
|
280
|
+
</Text>
|
|
281
|
+
<Text style={styles.securityDescription}>
|
|
282
|
+
{biometricStatus === 'checking' && 'Verifying Face ID availability on your device.'}
|
|
283
|
+
{biometricStatus === 'available' && 'We use Face ID to ensure only you can access your data.'}
|
|
284
|
+
{biometricStatus === 'unavailable' && 'Face ID is not available on this device. Your PIN will be stored securely.'}
|
|
285
|
+
{biometricStatus === 'storing' && 'Please authenticate with Face ID to secure your PIN.'}
|
|
286
|
+
{biometricStatus === 'success' && 'Your PIN is now protected with Face ID authentication.'}
|
|
287
|
+
{biometricStatus === 'error' && 'Face ID setup failed, but your PIN is stored securely.'}
|
|
288
|
+
</Text>
|
|
289
|
+
</View>
|
|
290
|
+
</View>
|
|
291
|
+
|
|
292
|
+
{/* Continue Button */}
|
|
293
|
+
<View style={styles.buttonContainer}>
|
|
294
|
+
<TouchableOpacity
|
|
295
|
+
style={[
|
|
296
|
+
styles.continueButton,
|
|
297
|
+
allRequirementsMet && styles.continueButtonActive
|
|
298
|
+
]}
|
|
299
|
+
onPress={handleContinue}
|
|
300
|
+
disabled={!allRequirementsMet || isLoading}
|
|
301
|
+
>
|
|
302
|
+
{isLoading ? (
|
|
303
|
+
<ActivityIndicator size="small" color="#FFFFFF" />
|
|
304
|
+
) : (
|
|
305
|
+
<Text style={[
|
|
306
|
+
styles.continueButtonText,
|
|
307
|
+
allRequirementsMet && styles.continueButtonTextActive
|
|
308
|
+
]}>
|
|
309
|
+
Continue
|
|
310
|
+
</Text>
|
|
311
|
+
)}
|
|
312
|
+
</TouchableOpacity>
|
|
313
|
+
</View>
|
|
314
|
+
</View>
|
|
315
|
+
);
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
const styles = StyleSheet.create({
|
|
319
|
+
container: {
|
|
320
|
+
flex: 1,
|
|
321
|
+
backgroundColor: COLORS.surface,
|
|
322
|
+
paddingHorizontal: 24,
|
|
323
|
+
paddingTop: 0,
|
|
324
|
+
},
|
|
325
|
+
|
|
326
|
+
titleContainer: {
|
|
327
|
+
alignItems: 'center',
|
|
328
|
+
marginBottom: 15,
|
|
329
|
+
paddingTop: -10,
|
|
330
|
+
marginTop: -15,
|
|
331
|
+
},
|
|
332
|
+
|
|
333
|
+
title: {
|
|
334
|
+
fontSize: 24,
|
|
335
|
+
fontWeight: '700',
|
|
336
|
+
color: COLORS.grey800,
|
|
337
|
+
marginBottom: 8,
|
|
338
|
+
fontFamily: 'IBM Plex Sans',
|
|
339
|
+
},
|
|
340
|
+
|
|
341
|
+
subtitle: {
|
|
342
|
+
fontSize: 16,
|
|
343
|
+
color: COLORS.grey600,
|
|
344
|
+
lineHeight: 24,
|
|
345
|
+
fontFamily: 'Inter',
|
|
346
|
+
},
|
|
347
|
+
|
|
348
|
+
pinContainer: {
|
|
349
|
+
marginBottom: 32,
|
|
350
|
+
},
|
|
351
|
+
|
|
352
|
+
pinInput: {
|
|
353
|
+
backgroundColor: '#F8F9FA',
|
|
354
|
+
borderRadius: 12,
|
|
355
|
+
paddingVertical: 16,
|
|
356
|
+
paddingHorizontal: 16,
|
|
357
|
+
fontSize: 16,
|
|
358
|
+
fontFamily: 'Inter',
|
|
359
|
+
borderWidth: 1,
|
|
360
|
+
borderColor: '#E5E5E5',
|
|
361
|
+
},
|
|
362
|
+
|
|
363
|
+
requirementsContainer: {
|
|
364
|
+
marginBottom: 32,
|
|
365
|
+
},
|
|
366
|
+
|
|
367
|
+
requirementsTitle: {
|
|
368
|
+
fontSize: 16,
|
|
369
|
+
fontWeight: '600',
|
|
370
|
+
color: COLORS.grey800,
|
|
371
|
+
marginBottom: 16,
|
|
372
|
+
fontFamily: 'Inter',
|
|
373
|
+
},
|
|
374
|
+
|
|
375
|
+
requirementItem: {
|
|
376
|
+
flexDirection: 'row',
|
|
377
|
+
alignItems: 'center',
|
|
378
|
+
marginBottom: 12,
|
|
379
|
+
},
|
|
380
|
+
|
|
381
|
+
checkbox: {
|
|
382
|
+
width: 20,
|
|
383
|
+
height: 20,
|
|
384
|
+
borderRadius: 10,
|
|
385
|
+
borderWidth: 2,
|
|
386
|
+
borderColor: '#E5E5E5',
|
|
387
|
+
marginRight: 12,
|
|
388
|
+
alignItems: 'center',
|
|
389
|
+
justifyContent: 'center',
|
|
390
|
+
},
|
|
391
|
+
|
|
392
|
+
checkboxChecked: {
|
|
393
|
+
borderColor: '#4CD964',
|
|
394
|
+
backgroundColor: '#4CD964',
|
|
395
|
+
},
|
|
396
|
+
|
|
397
|
+
checkmark: {
|
|
398
|
+
color: '#FFFFFF',
|
|
399
|
+
fontSize: 12,
|
|
400
|
+
fontWeight: 'bold',
|
|
401
|
+
},
|
|
402
|
+
|
|
403
|
+
requirementText: {
|
|
404
|
+
fontSize: 14,
|
|
405
|
+
color: COLORS.grey600,
|
|
406
|
+
fontFamily: 'Inter',
|
|
407
|
+
flex: 1,
|
|
408
|
+
},
|
|
409
|
+
|
|
410
|
+
requirementTextMet: {
|
|
411
|
+
color: COLORS.grey800,
|
|
412
|
+
},
|
|
413
|
+
|
|
414
|
+
securityCard: {
|
|
415
|
+
backgroundColor: '#F8F9FA',
|
|
416
|
+
borderRadius: 12,
|
|
417
|
+
padding: 16,
|
|
418
|
+
flexDirection: 'row',
|
|
419
|
+
alignItems: 'center',
|
|
420
|
+
marginBottom: 24,
|
|
421
|
+
borderWidth: 1,
|
|
422
|
+
borderColor: '#E5E5E5',
|
|
423
|
+
},
|
|
424
|
+
|
|
425
|
+
securityCardSuccess: {
|
|
426
|
+
backgroundColor: '#F0FDF4',
|
|
427
|
+
borderColor: '#22C55E',
|
|
428
|
+
},
|
|
429
|
+
|
|
430
|
+
securityCardError: {
|
|
431
|
+
backgroundColor: '#FEF2F2',
|
|
432
|
+
borderColor: '#EF4444',
|
|
433
|
+
},
|
|
434
|
+
|
|
435
|
+
securityIconContainer: {
|
|
436
|
+
marginRight: 12,
|
|
437
|
+
},
|
|
438
|
+
|
|
439
|
+
securityIcon: {
|
|
440
|
+
fontSize: 24,
|
|
441
|
+
},
|
|
442
|
+
|
|
443
|
+
securityTextContainer: {
|
|
444
|
+
flex: 1,
|
|
445
|
+
},
|
|
446
|
+
|
|
447
|
+
securityTitle: {
|
|
448
|
+
fontSize: 14,
|
|
449
|
+
fontWeight: '600',
|
|
450
|
+
color: COLORS.grey800,
|
|
451
|
+
marginBottom: 4,
|
|
452
|
+
fontFamily: 'Inter',
|
|
453
|
+
},
|
|
454
|
+
|
|
455
|
+
securityDescription: {
|
|
456
|
+
fontSize: 13,
|
|
457
|
+
color: COLORS.grey600,
|
|
458
|
+
lineHeight: 18,
|
|
459
|
+
fontFamily: 'Inter',
|
|
460
|
+
},
|
|
461
|
+
|
|
462
|
+
buttonContainer: {
|
|
463
|
+
marginTop: 'auto',
|
|
464
|
+
paddingBottom: 34,
|
|
465
|
+
},
|
|
466
|
+
|
|
467
|
+
continueButton: {
|
|
468
|
+
backgroundColor: '#E5E5E5',
|
|
469
|
+
borderRadius: 25,
|
|
470
|
+
paddingVertical: 16,
|
|
471
|
+
alignItems: 'center',
|
|
472
|
+
justifyContent: 'center',
|
|
473
|
+
},
|
|
474
|
+
|
|
475
|
+
continueButtonActive: {
|
|
476
|
+
backgroundColor: '#2D3436',
|
|
477
|
+
},
|
|
478
|
+
|
|
479
|
+
continueButtonText: {
|
|
480
|
+
fontSize: 16,
|
|
481
|
+
fontWeight: '600',
|
|
482
|
+
color: '#999999',
|
|
483
|
+
fontFamily: 'Inter',
|
|
484
|
+
},
|
|
485
|
+
|
|
486
|
+
continueButtonTextActive: {
|
|
487
|
+
color: '#FFFFFF',
|
|
488
|
+
},
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
export { PinCreationScreen };
|
|
492
|
+
export default PinCreationScreen;
|