react-native-fpay 0.3.5 → 0.3.6
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/module/FountainPayProvider.js +106 -16
- package/lib/module/FountainPayProvider.js.map +1 -1
- package/lib/module/core/api/client.js +13 -1
- package/lib/module/core/api/client.js.map +1 -1
- package/lib/module/core/api/index.js +66 -24
- package/lib/module/core/api/index.js.map +1 -1
- package/lib/module/engine/BLEReceiverService.js.map +1 -1
- package/lib/module/engine/BLESenderService.js.map +1 -1
- package/lib/module/engine/FPEngine.js +164 -43
- package/lib/module/engine/FPEngine.js.map +1 -1
- package/lib/module/engine/NearbyUsersService.js +1 -1
- package/lib/module/engine/NearbyUsersService.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/store/FPStore.js +155 -0
- package/lib/module/store/FPStore.js.map +1 -0
- package/lib/module/ui/components/AnimatedDots.js +3 -3
- package/lib/module/ui/components/AnimatedDots.js.map +1 -1
- package/lib/module/ui/components/ConfirmScreen.js +137 -123
- package/lib/module/ui/components/ConfirmScreen.js.map +1 -1
- package/lib/module/ui/components/FPButton.js.map +1 -1
- package/lib/module/ui/components/LoadingAnimation/InLoading.js +3 -3
- package/lib/module/ui/components/LoadingAnimation/InLoading.js.map +1 -1
- package/lib/module/ui/components/LoadingAnimation/index.js +3 -3
- package/lib/module/ui/components/LoadingAnimation/index.js.map +1 -1
- package/lib/module/ui/components/OtpInput/OTPInputView.js +11 -11
- package/lib/module/ui/components/OtpInput/OTPInputView.js.map +1 -1
- package/lib/module/ui/components/OtpInput/Styles.js +1 -1
- package/lib/module/ui/components/OtpInput/helpers/codeToArray.js +1 -1
- package/lib/module/ui/components/OtpInput/helpers/device.js.map +1 -1
- package/lib/module/ui/components/OtpInput/helpers/styles.js.map +1 -1
- package/lib/module/ui/components/OtpInput/index.js +3 -1
- package/lib/module/ui/components/OtpInput/index.js.map +1 -1
- package/lib/module/ui/components/PulseAnimation.js +2 -2
- package/lib/module/ui/components/PulseAnimation.js.map +1 -1
- package/lib/module/ui/modals/FPPaymentRequestModal.js +8 -7
- package/lib/module/ui/modals/FPPaymentRequestModal.js.map +1 -1
- package/lib/module/ui/modals/FPShell.js +2 -0
- package/lib/module/ui/modals/FPShell.js.map +1 -1
- package/lib/module/ui/screens/ReceiveScreen.js +8 -9
- package/lib/module/ui/screens/ReceiveScreen.js.map +1 -1
- package/lib/module/ui/screens/SendScreen.js +43 -94
- package/lib/module/ui/screens/SendScreen.js.map +1 -1
- package/lib/module/ui/screens/styles.js +15 -3
- package/lib/module/ui/screens/styles.js.map +1 -1
- package/lib/module/ui/screens/sub/receivePayment/Nfc/index.js +4 -4
- package/lib/module/ui/screens/sub/receivePayment/Nfc/index.js.map +1 -1
- package/lib/module/ui/screens/sub/receivePayment/Qr/index.js +5 -5
- package/lib/module/ui/screens/sub/receivePayment/Qr/index.js.map +1 -1
- package/lib/module/ui/screens/sub/receivePayment/Transfer/index.js +10 -11
- package/lib/module/ui/screens/sub/receivePayment/Transfer/index.js.map +1 -1
- package/lib/module/ui/screens/sub/sendPayment/BluetoothSubScreen.js +31 -8
- package/lib/module/ui/screens/sub/sendPayment/BluetoothSubScreen.js.map +1 -1
- package/lib/module/ui/screens/sub/sendPayment/NFCSubScreen.js +12 -8
- package/lib/module/ui/screens/sub/sendPayment/NFCSubScreen.js.map +1 -1
- package/lib/module/ui/screens/sub/sendPayment/NQRSubScreen.js +17 -5
- package/lib/module/ui/screens/sub/sendPayment/NQRSubScreen.js.map +1 -1
- package/lib/module/ui/screens/sub/sendPayment/ProximitySubScreen.js +67 -35
- package/lib/module/ui/screens/sub/sendPayment/ProximitySubScreen.js.map +1 -1
- package/lib/module/ui/screens/sub/sendPayment/TransferSubScreen.js +110 -34
- package/lib/module/ui/screens/sub/sendPayment/TransferSubScreen.js.map +1 -1
- package/lib/module/ui/theme/index.js.map +1 -1
- package/lib/typescript/src/FountainPayProvider.d.ts +1 -1
- package/lib/typescript/src/FountainPayProvider.d.ts.map +1 -1
- package/lib/typescript/src/core/api/client.d.ts.map +1 -1
- package/lib/typescript/src/core/api/index.d.ts +42 -26
- package/lib/typescript/src/core/api/index.d.ts.map +1 -1
- package/lib/typescript/src/core/types/index.d.ts +53 -28
- package/lib/typescript/src/core/types/index.d.ts.map +1 -1
- package/lib/typescript/src/engine/BLEReceiverService.d.ts +2 -0
- package/lib/typescript/src/engine/BLEReceiverService.d.ts.map +1 -1
- package/lib/typescript/src/engine/BLESenderService.d.ts.map +1 -1
- package/lib/typescript/src/engine/FPEngine.d.ts +5 -3
- package/lib/typescript/src/engine/FPEngine.d.ts.map +1 -1
- package/lib/typescript/src/engine/useIsForeground.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/store/FPStore.d.ts +60 -0
- package/lib/typescript/src/store/FPStore.d.ts.map +1 -0
- package/lib/typescript/src/ui/components/AnimatedDots.d.ts.map +1 -1
- package/lib/typescript/src/ui/components/ConfirmScreen.d.ts +5 -5
- package/lib/typescript/src/ui/components/ConfirmScreen.d.ts.map +1 -1
- package/lib/typescript/src/ui/components/FPButton.d.ts +1 -1
- package/lib/typescript/src/ui/components/FPButton.d.ts.map +1 -1
- package/lib/typescript/src/ui/components/LoadingAnimation/InLoading.d.ts.map +1 -1
- package/lib/typescript/src/ui/components/LoadingAnimation/index.d.ts.map +1 -1
- package/lib/typescript/src/ui/components/OtpInput/OTPInputView.d.ts.map +1 -1
- package/lib/typescript/src/ui/components/OtpInput/helpers/codeToArray.d.ts.map +1 -1
- package/lib/typescript/src/ui/components/OtpInput/helpers/device.d.ts.map +1 -1
- package/lib/typescript/src/ui/components/OtpInput/helpers/styles.d.ts.map +1 -1
- package/lib/typescript/src/ui/components/OtpInput/helpers/types.d.ts +1 -2
- package/lib/typescript/src/ui/components/OtpInput/helpers/types.d.ts.map +1 -1
- package/lib/typescript/src/ui/components/OtpInput/index.d.ts +3 -1
- package/lib/typescript/src/ui/components/OtpInput/index.d.ts.map +1 -1
- package/lib/typescript/src/ui/components/PulseAnimation.d.ts.map +1 -1
- package/lib/typescript/src/ui/modals/FPPaymentRequestModal.d.ts.map +1 -1
- package/lib/typescript/src/ui/modals/FPShell.d.ts.map +1 -1
- package/lib/typescript/src/ui/screens/ReceiveScreen.d.ts +1 -1
- package/lib/typescript/src/ui/screens/ReceiveScreen.d.ts.map +1 -1
- package/lib/typescript/src/ui/screens/SendScreen.d.ts +1 -1
- package/lib/typescript/src/ui/screens/SendScreen.d.ts.map +1 -1
- package/lib/typescript/src/ui/screens/styles.d.ts +197 -0
- package/lib/typescript/src/ui/screens/styles.d.ts.map +1 -1
- package/lib/typescript/src/ui/screens/sub/receivePayment/Nfc/index.d.ts.map +1 -1
- package/lib/typescript/src/ui/screens/sub/receivePayment/Qr/index.d.ts.map +1 -1
- package/lib/typescript/src/ui/screens/sub/receivePayment/Transfer/index.d.ts.map +1 -1
- package/lib/typescript/src/ui/screens/sub/sendPayment/BluetoothSubScreen.d.ts.map +1 -1
- package/lib/typescript/src/ui/screens/sub/sendPayment/NFCSubScreen.d.ts +1 -1
- package/lib/typescript/src/ui/screens/sub/sendPayment/NFCSubScreen.d.ts.map +1 -1
- package/lib/typescript/src/ui/screens/sub/sendPayment/NQRSubScreen.d.ts +1 -1
- package/lib/typescript/src/ui/screens/sub/sendPayment/NQRSubScreen.d.ts.map +1 -1
- package/lib/typescript/src/ui/screens/sub/sendPayment/ProximitySubScreen.d.ts +1 -1
- package/lib/typescript/src/ui/screens/sub/sendPayment/ProximitySubScreen.d.ts.map +1 -1
- package/lib/typescript/src/ui/screens/sub/sendPayment/TransferSubScreen.d.ts +1 -1
- package/lib/typescript/src/ui/screens/sub/sendPayment/TransferSubScreen.d.ts.map +1 -1
- package/lib/typescript/src/ui/theme/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/FountainPayProvider.tsx +164 -23
- package/src/core/api/client.ts +26 -4
- package/src/core/api/index.ts +170 -49
- package/src/core/types/index.ts +81 -48
- package/src/engine/BLEReceiverService.ts +86 -28
- package/src/engine/BLESenderService.ts +133 -69
- package/src/engine/FPEngine.ts +316 -97
- package/src/engine/NearbyUsersService.ts +6 -6
- package/src/engine/useIsForeground.ts +12 -12
- package/src/index.ts +10 -4
- package/src/store/FPStore.ts +216 -0
- package/src/ui/components/AnimatedDots.tsx +4 -5
- package/src/ui/components/ConfirmScreen.tsx +182 -169
- package/src/ui/components/FPButton.tsx +50 -9
- package/src/ui/components/LoadingAnimation/InLoading.tsx +23 -27
- package/src/ui/components/LoadingAnimation/index.tsx +3 -7
- package/src/ui/components/OtpInput/OTPInputView.tsx +254 -205
- package/src/ui/components/OtpInput/Styles.ts +1 -1
- package/src/ui/components/OtpInput/helpers/codeToArray.ts +2 -2
- package/src/ui/components/OtpInput/helpers/device.ts +4 -3
- package/src/ui/components/OtpInput/helpers/styles.ts +13 -14
- package/src/ui/components/OtpInput/helpers/types.ts +83 -79
- package/src/ui/components/OtpInput/index.tsx +18 -15
- package/src/ui/components/PulseAnimation.tsx +3 -5
- package/src/ui/modals/FPPaymentRequestModal.tsx +111 -28
- package/src/ui/modals/FPShell.tsx +60 -34
- package/src/ui/screens/ReceiveScreen.tsx +245 -84
- package/src/ui/screens/SendScreen.tsx +419 -167
- package/src/ui/screens/styles.ts +17 -5
- package/src/ui/screens/sub/receivePayment/Nfc/index.tsx +17 -25
- package/src/ui/screens/sub/receivePayment/Qr/index.tsx +21 -20
- package/src/ui/screens/sub/receivePayment/Transfer/index.tsx +34 -28
- package/src/ui/screens/sub/sendPayment/BluetoothSubScreen.tsx +135 -67
- package/src/ui/screens/sub/sendPayment/NFCSubScreen.tsx +188 -112
- package/src/ui/screens/sub/sendPayment/NQRSubScreen.tsx +102 -69
- package/src/ui/screens/sub/sendPayment/ProximitySubScreen.tsx +225 -99
- package/src/ui/screens/sub/sendPayment/TransferSubScreen.tsx +209 -89
- package/src/ui/theme/index.ts +14 -2
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
Animated,
|
|
8
|
+
Alert,
|
|
9
|
+
} from 'react-native';
|
|
3
10
|
import NfcManager, { NfcTech, Ndef } from 'react-native-nfc-manager';
|
|
4
11
|
import { transferAPI } from '../../../../core/api';
|
|
5
12
|
import { FPButton } from '../../../components/FPButton';
|
|
6
13
|
import { C, R, S, F } from '../../../theme';
|
|
7
|
-
import type {
|
|
14
|
+
import type {
|
|
15
|
+
FPCurrency,
|
|
16
|
+
FPError,
|
|
17
|
+
FPTransaction,
|
|
18
|
+
Props,
|
|
19
|
+
} from '../../../../core/types';
|
|
8
20
|
import styled from 'styled-components/native';
|
|
9
21
|
import Svg, { Path } from 'react-native-svg';
|
|
10
22
|
import Ionicons from 'react-native-vector-icons/Ionicons';
|
|
@@ -21,7 +33,7 @@ const Header = styled(View)`
|
|
|
21
33
|
align-items: center;
|
|
22
34
|
justify-content: space-between;
|
|
23
35
|
padding: 12px 16px;
|
|
24
|
-
position: absolute
|
|
36
|
+
position: absolute;
|
|
25
37
|
top: 40px;
|
|
26
38
|
left: 0;
|
|
27
39
|
right: 0;
|
|
@@ -31,7 +43,7 @@ const Header = styled(View)`
|
|
|
31
43
|
shadow-offset: 0px 2px;
|
|
32
44
|
shadow-opacity: 0.1;
|
|
33
45
|
shadow-radius: 4px;
|
|
34
|
-
z-index: 9999999999
|
|
46
|
+
z-index: 9999999999;
|
|
35
47
|
`;
|
|
36
48
|
|
|
37
49
|
const HeaderButton = styled(TouchableOpacity)`
|
|
@@ -65,7 +77,7 @@ const QuickLinksIcon = styled.TouchableOpacity<{ bg?: string }>`
|
|
|
65
77
|
width: 96px;
|
|
66
78
|
height: 96px;
|
|
67
79
|
border-radius: 100%;
|
|
68
|
-
background-color: ${props => props.bg || '#18181b'};
|
|
80
|
+
background-color: ${(props) => props.bg || '#18181b'};
|
|
69
81
|
justify-content: center;
|
|
70
82
|
align-items: center;
|
|
71
83
|
margin-bottom: 16px;
|
|
@@ -86,7 +98,7 @@ const LCIconContainer = styled(Animated.View)`
|
|
|
86
98
|
width: 140px;
|
|
87
99
|
height: 140px;
|
|
88
100
|
border-radius: 90px;
|
|
89
|
-
background-color: #
|
|
101
|
+
background-color: #e8f5f1;
|
|
90
102
|
align-items: center;
|
|
91
103
|
justify-content: center;
|
|
92
104
|
margin-top: 24px;
|
|
@@ -110,37 +122,70 @@ const StatusText = styled.Text`
|
|
|
110
122
|
margin-bottom: 8px;
|
|
111
123
|
`;
|
|
112
124
|
|
|
113
|
-
const NFCIcon =({ color =
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
125
|
+
const NFCIcon = ({ color = '#111', size = 22 }) => (
|
|
126
|
+
<Svg
|
|
127
|
+
width={size}
|
|
128
|
+
height={size}
|
|
129
|
+
strokeWidth="0.9"
|
|
130
|
+
viewBox="0 0 24 24"
|
|
131
|
+
fill="none"
|
|
132
|
+
color={color}
|
|
133
|
+
>
|
|
134
|
+
<Path
|
|
135
|
+
d="M12 19.51L12.01 19.4989"
|
|
136
|
+
stroke="#fff"
|
|
137
|
+
strokeWidth="0.9"
|
|
138
|
+
strokeLinecap="round"
|
|
139
|
+
strokeLinejoin="round"
|
|
140
|
+
/>
|
|
141
|
+
<Path
|
|
142
|
+
d="M2 8C8 3.5 16 3.5 22 8"
|
|
143
|
+
stroke="#fff"
|
|
144
|
+
strokeWidth="0.9"
|
|
145
|
+
strokeLinecap="round"
|
|
146
|
+
strokeLinejoin="round"
|
|
147
|
+
/>
|
|
148
|
+
<Path
|
|
149
|
+
d="M5 12C9 9 15 9 19 12"
|
|
150
|
+
stroke="#fff"
|
|
151
|
+
strokeWidth="0.9"
|
|
152
|
+
strokeLinecap="round"
|
|
153
|
+
strokeLinejoin="round"
|
|
154
|
+
/>
|
|
155
|
+
<Path
|
|
156
|
+
d="M8.5 15.5C10.7504 14.1 13.2498 14.0996 15.5001 15.5"
|
|
157
|
+
stroke="#fff"
|
|
158
|
+
strokeWidth="0.9"
|
|
159
|
+
strokeLinecap="round"
|
|
160
|
+
strokeLinejoin="round"
|
|
161
|
+
/>
|
|
162
|
+
</Svg>
|
|
163
|
+
);
|
|
122
164
|
|
|
123
165
|
interface PropT {
|
|
124
166
|
mode: 'send' | 'receive';
|
|
125
|
-
amount?: number;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
167
|
+
amount?: number;
|
|
168
|
+
currency?: FPCurrency;
|
|
169
|
+
myWallet?: {
|
|
170
|
+
accountName: string;
|
|
171
|
+
accountNumber: string;
|
|
172
|
+
bankCode: string;
|
|
173
|
+
bankName: string;
|
|
130
174
|
};
|
|
131
175
|
onDone: () => void;
|
|
132
|
-
onSuccess?: (tx: FPTransaction) => void;
|
|
176
|
+
onSuccess?: (tx: FPTransaction) => void;
|
|
177
|
+
onError?: (err: FPError) => void;
|
|
133
178
|
}
|
|
134
179
|
|
|
135
180
|
type Phase = 'idle' | 'active' | 'success' | 'error';
|
|
136
181
|
|
|
137
182
|
export function NFCSubScreen({
|
|
138
|
-
amount,
|
|
183
|
+
amount,
|
|
139
184
|
currency,
|
|
140
|
-
onClose,
|
|
141
|
-
onProcessTransaction,
|
|
142
|
-
onError
|
|
143
|
-
|
|
185
|
+
onClose,
|
|
186
|
+
onProcessTransaction,
|
|
187
|
+
onError,
|
|
188
|
+
}: Props) {
|
|
144
189
|
const [phase, setPhase] = useState<Phase>('idle');
|
|
145
190
|
const [msg, setMsg] = useState('');
|
|
146
191
|
const iconScale = useRef(new Animated.Value(1)).current;
|
|
@@ -159,23 +204,23 @@ export function NFCSubScreen({
|
|
|
159
204
|
// };
|
|
160
205
|
|
|
161
206
|
const sendMoney = async (wallet: any) => {
|
|
162
|
-
|
|
163
207
|
console.log('NFC details:', wallet);
|
|
164
208
|
onProcessTransaction?.(wallet as any);
|
|
165
|
-
}
|
|
166
|
-
|
|
209
|
+
};
|
|
167
210
|
|
|
168
|
-
const
|
|
211
|
+
const tapToScan = async () => {
|
|
169
212
|
setPhase('active');
|
|
170
213
|
try {
|
|
171
|
-
await NfcManager.start();
|
|
214
|
+
// await NfcManager.start();
|
|
172
215
|
await NfcManager.requestTechnology(NfcTech.Ndef);
|
|
173
216
|
const tag = await NfcManager.getTag();
|
|
174
|
-
if (!tag?.ndefMessage?.[0]?.payload)
|
|
217
|
+
if (!tag?.ndefMessage?.[0]?.payload)
|
|
218
|
+
throw new Error('No wallet data on tag');
|
|
175
219
|
const payload = new Uint8Array(tag.ndefMessage[0].payload);
|
|
176
220
|
const text = Ndef.text.decodePayload(payload);
|
|
177
221
|
const wallet = JSON.parse(text);
|
|
178
|
-
setPhase('success');
|
|
222
|
+
setPhase('success');
|
|
223
|
+
setMsg('NFC scanned!');
|
|
179
224
|
Alert.alert(
|
|
180
225
|
'NFC Scanned',
|
|
181
226
|
`Would you love to continue with this transaction?`,
|
|
@@ -190,13 +235,17 @@ export function NFCSubScreen({
|
|
|
190
235
|
},
|
|
191
236
|
]
|
|
192
237
|
);
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
238
|
+
} catch (e: any) {
|
|
239
|
+
if (e.message?.toLowerCase().includes('cancel')) {
|
|
240
|
+
setPhase('idle');
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
setPhase('error');
|
|
244
|
+
setMsg(e.message);
|
|
245
|
+
onError?.({ code: 'NFC_ERROR', message: e.message });
|
|
246
|
+
} finally {
|
|
247
|
+
NfcManager.cancelTechnologyRequest();
|
|
198
248
|
}
|
|
199
|
-
finally { NfcManager.cancelTechnologyRequest(); }
|
|
200
249
|
};
|
|
201
250
|
|
|
202
251
|
useEffect(() => {
|
|
@@ -204,99 +253,126 @@ export function NFCSubScreen({
|
|
|
204
253
|
.then(() => console.log('NFC Manager started'))
|
|
205
254
|
.catch((err: any) => {
|
|
206
255
|
console.log('NFC start error:', err);
|
|
207
|
-
setPhase('error');
|
|
256
|
+
setPhase('error');
|
|
208
257
|
setMsg(err.message);
|
|
209
258
|
onError?.({ code: 'NFC_ERROR', message: err.message });
|
|
210
259
|
});
|
|
211
|
-
|
|
260
|
+
|
|
212
261
|
return () => {
|
|
213
262
|
NfcManager.cancelTechnologyRequest().catch(() => {});
|
|
214
263
|
};
|
|
215
264
|
}, []);
|
|
216
|
-
|
|
217
|
-
return (
|
|
218
|
-
|
|
219
265
|
|
|
266
|
+
return (
|
|
220
267
|
<Container>
|
|
221
|
-
|
|
222
268
|
{/* Header */}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
269
|
+
<Header>
|
|
270
|
+
<HeaderButton onPress={onClose}>
|
|
271
|
+
<Ionicons name="close" size={24} />
|
|
272
|
+
</HeaderButton>
|
|
273
|
+
|
|
274
|
+
<HeaderCenter>
|
|
275
|
+
<Text style={{ fontWeight: 'bold', fontSize: 16, color: '#FFF' }}>
|
|
276
|
+
NFC
|
|
277
|
+
</Text>
|
|
278
|
+
<Text style={{ fontSize: 10, color: '#FFF' }}>Transfer</Text>
|
|
279
|
+
</HeaderCenter>
|
|
280
|
+
|
|
281
|
+
<HeaderRight>
|
|
282
|
+
<HeaderButton>
|
|
283
|
+
<Ionicons name="image-outline" size={22} />
|
|
226
284
|
</HeaderButton>
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
285
|
+
<HeaderButton>
|
|
286
|
+
<Ionicons name="settings-outline" size={22} />
|
|
287
|
+
</HeaderButton>
|
|
288
|
+
</HeaderRight>
|
|
289
|
+
</Header>
|
|
290
|
+
|
|
291
|
+
<QuickLinksContainer>
|
|
292
|
+
{phase === 'idle' ? (
|
|
293
|
+
<>
|
|
294
|
+
<QuickLinksIcon
|
|
295
|
+
onPress={() => {
|
|
296
|
+
tapToScan();
|
|
297
|
+
}}
|
|
298
|
+
>
|
|
299
|
+
<NFCIcon size={40} color="#FFF" />
|
|
300
|
+
</QuickLinksIcon>
|
|
301
|
+
<QuickLinksText>Start NFC Scan</QuickLinksText>
|
|
302
|
+
</>
|
|
303
|
+
) : phase === 'active' ? (
|
|
304
|
+
<LCAnimationContainer>
|
|
305
|
+
<PulseAnimation />
|
|
306
|
+
<LCIconContainer
|
|
307
|
+
style={{ transform: [{ scale: iconScale }], marginTop: 64 }}
|
|
308
|
+
>
|
|
309
|
+
<LCIcon>📡</LCIcon>
|
|
310
|
+
</LCIconContainer>
|
|
242
311
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
</
|
|
265
|
-
</
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
)
|
|
275
|
-
: (
|
|
276
|
-
<>
|
|
277
|
-
<View style={[st.tapZone, st.tapError]}>
|
|
278
|
-
<Text style={st.tapEmoji}>{'ERR'}</Text>
|
|
279
|
-
<Text style={st.tapLabel}>
|
|
280
|
-
{msg}
|
|
281
|
-
</Text>
|
|
282
|
-
</View>
|
|
283
|
-
<FPButton label="Try Again" onPress={() => setPhase('idle')} style={{ marginTop: S.md }} />
|
|
284
|
-
</>
|
|
285
|
-
)}
|
|
286
|
-
|
|
287
|
-
</QuickLinksContainer>
|
|
312
|
+
<StatusTextContainer>
|
|
313
|
+
<StatusText>Searching for nearby users</StatusText>
|
|
314
|
+
{/* <StatusSubText>Hold devices back-to-back</StatusSubText> */}
|
|
315
|
+
</StatusTextContainer>
|
|
316
|
+
</LCAnimationContainer>
|
|
317
|
+
) : phase === 'success' ? (
|
|
318
|
+
<>
|
|
319
|
+
<QuickLinksIcon
|
|
320
|
+
bg="#057e32"
|
|
321
|
+
onPress={() => {
|
|
322
|
+
tapToScan();
|
|
323
|
+
}}
|
|
324
|
+
>
|
|
325
|
+
<Ionicons name="checkmark" size={40} color="#FFF" />
|
|
326
|
+
</QuickLinksIcon>
|
|
327
|
+
<QuickLinksText>NFC Scanned</QuickLinksText>
|
|
328
|
+
</>
|
|
329
|
+
) : (
|
|
330
|
+
<>
|
|
331
|
+
<View style={[st.tapZone, st.tapError]}>
|
|
332
|
+
<Text style={st.tapEmoji}>{'ERR'}</Text>
|
|
333
|
+
<Text style={st.tapLabel}>{msg}</Text>
|
|
334
|
+
</View>
|
|
335
|
+
<FPButton
|
|
336
|
+
label="Try Again"
|
|
337
|
+
onPress={() => setPhase('idle')}
|
|
338
|
+
style={{ marginTop: S.md }}
|
|
339
|
+
/>
|
|
340
|
+
</>
|
|
341
|
+
)}
|
|
342
|
+
</QuickLinksContainer>
|
|
288
343
|
</Container>
|
|
289
344
|
);
|
|
290
345
|
}
|
|
291
346
|
|
|
292
347
|
const st = StyleSheet.create({
|
|
293
348
|
wrap: { flex: 1, padding: S.lg },
|
|
294
|
-
back: {
|
|
295
|
-
|
|
296
|
-
|
|
349
|
+
back: {
|
|
350
|
+
color: C.brand,
|
|
351
|
+
fontSize: F.md,
|
|
352
|
+
fontWeight: '600',
|
|
353
|
+
marginBottom: S.md,
|
|
354
|
+
},
|
|
355
|
+
title: {
|
|
356
|
+
fontSize: F.xl,
|
|
357
|
+
fontWeight: '800',
|
|
358
|
+
color: C.ink,
|
|
359
|
+
marginBottom: S.lg,
|
|
360
|
+
},
|
|
361
|
+
tapZone: {
|
|
362
|
+
height: 180,
|
|
363
|
+
backgroundColor: C.ink,
|
|
364
|
+
borderRadius: R.xl,
|
|
365
|
+
justifyContent: 'center',
|
|
366
|
+
alignItems: 'center',
|
|
367
|
+
},
|
|
297
368
|
tapActive: { backgroundColor: C.brand },
|
|
298
369
|
tapSuccess: { backgroundColor: C.green },
|
|
299
370
|
tapError: { backgroundColor: C.red },
|
|
300
|
-
tapEmoji: {
|
|
371
|
+
tapEmoji: {
|
|
372
|
+
fontSize: 40,
|
|
373
|
+
color: C.white,
|
|
374
|
+
fontWeight: '800',
|
|
375
|
+
marginBottom: S.sm,
|
|
376
|
+
},
|
|
301
377
|
tapLabel: { color: C.white, fontSize: F.lg, fontWeight: '700' },
|
|
302
378
|
});
|