react-native-fpay 0.3.4 → 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 -5
- 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,88 +1,92 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import type { TextStyle, ViewStyle } from 'react-native';
|
|
3
3
|
|
|
4
|
-
type KeyboardType =
|
|
4
|
+
export type KeyboardType =
|
|
5
|
+
| 'default'
|
|
6
|
+
| 'email-address'
|
|
7
|
+
| 'number-pad'
|
|
8
|
+
| 'phone-pad';
|
|
5
9
|
|
|
6
10
|
export interface InputProps {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Digits of pins in the OTP
|
|
13
|
+
*/
|
|
14
|
+
pinCount: number;
|
|
15
|
+
/**
|
|
16
|
+
* Style of the input fields
|
|
17
|
+
*/
|
|
18
|
+
codeInputFieldStyle?: TextStyle;
|
|
19
|
+
/**
|
|
20
|
+
* Style of highlighted status for input fields
|
|
21
|
+
*/
|
|
22
|
+
codeInputHighlightStyle?: TextStyle;
|
|
23
|
+
/**
|
|
24
|
+
* Callback function
|
|
25
|
+
* Trigger when all fields of the OTP has been filled
|
|
26
|
+
*
|
|
27
|
+
* @param code The verification code
|
|
28
|
+
*/
|
|
29
|
+
onCodeFilled?: (code: string) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Callback function
|
|
32
|
+
* Trigger when a field of the OTP is changed
|
|
33
|
+
*
|
|
34
|
+
* @param code The verification code
|
|
35
|
+
*/
|
|
36
|
+
onCodeChanged?: (code: string) => void;
|
|
37
|
+
/**
|
|
38
|
+
* If keyboard is automatically brought up when OTP is loaded.
|
|
39
|
+
*/
|
|
40
|
+
autoFocusOnLoad?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Initial pin code
|
|
43
|
+
*/
|
|
44
|
+
code?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Secure input text
|
|
47
|
+
*/
|
|
48
|
+
secureTextEntry?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Set editable for inputs
|
|
51
|
+
*/
|
|
52
|
+
editable?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Type of the keyboard
|
|
55
|
+
*/
|
|
56
|
+
keyboardType?: KeyboardType;
|
|
57
|
+
/**
|
|
58
|
+
* Placeholder character to fill all inputs when the OTP is empty
|
|
59
|
+
*/
|
|
60
|
+
placeholderCharacter?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Placeholder text color of inputs
|
|
63
|
+
*/
|
|
64
|
+
placeholderTextColor?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Style of the OTP container view
|
|
67
|
+
*/
|
|
68
|
+
style?: ViewStyle;
|
|
69
|
+
/**
|
|
70
|
+
* The highlight (and cursor on iOS) color of the text input.
|
|
71
|
+
*/
|
|
72
|
+
selectionColor?: string;
|
|
73
|
+
/**
|
|
74
|
+
* If inputs are automatically cleared.
|
|
75
|
+
*/
|
|
76
|
+
clearInputs?: boolean;
|
|
73
77
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Keyboard appearance. The value can be 'default', 'dark' or 'light'.
|
|
80
|
+
*/
|
|
81
|
+
keyboardAppearance?: 'default' | 'dark' | 'light';
|
|
78
82
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Keyboard auto-appear on focus. The value can be 'false' or 'true'.
|
|
85
|
+
*/
|
|
86
|
+
showSoftInputOnFocus?: boolean;
|
|
83
87
|
}
|
|
84
88
|
|
|
85
89
|
export interface OTPInputViewState {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
90
|
+
digits: string[];
|
|
91
|
+
selectedIndex: number;
|
|
92
|
+
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {View, StyleSheet} from 'react-native';
|
|
1
|
+
import { View, StyleSheet } from 'react-native';
|
|
2
2
|
// import { NumPad } from "frontatish";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import OTPInputView from './OTPInputView';
|
|
5
|
+
import type { KeyboardType } from './helpers/types';
|
|
5
6
|
|
|
6
7
|
type PropT = {
|
|
7
8
|
callBack: Function;
|
|
8
9
|
pinvalue?: any;
|
|
9
10
|
isSecure?: boolean;
|
|
10
11
|
count?: number;
|
|
12
|
+
keyboardType?: KeyboardType;
|
|
11
13
|
};
|
|
12
14
|
|
|
13
15
|
export default function OTPInputs({
|
|
@@ -15,26 +17,27 @@ export default function OTPInputs({
|
|
|
15
17
|
pinvalue = '',
|
|
16
18
|
isSecure = true,
|
|
17
19
|
count = 4,
|
|
20
|
+
keyboardType = 'number-pad',
|
|
18
21
|
}: PropT) {
|
|
19
|
-
|
|
20
22
|
return (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
<OTPInputView
|
|
24
|
+
style={{ width: '100%', backgroundColor: 'transparent' }}
|
|
25
|
+
codeInputFieldStyle={styles.underlineStyleBase}
|
|
26
|
+
codeInputHighlightStyle={styles.underlineStyleHighLighted}
|
|
27
|
+
secureTextEntry={isSecure}
|
|
28
|
+
keyboardType={keyboardType}
|
|
29
|
+
pinCount={count}
|
|
30
|
+
autoFocusOnLoad
|
|
31
|
+
placeholderCharacter={''}
|
|
32
|
+
onCodeFilled={(code) => {
|
|
33
|
+
callBack(code);
|
|
34
|
+
}}
|
|
35
|
+
/>
|
|
33
36
|
);
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
const styles = StyleSheet.create({
|
|
37
|
-
|
|
40
|
+
underlineStyleBase: {
|
|
38
41
|
width: 60,
|
|
39
42
|
height: 60,
|
|
40
43
|
borderWidth: 1,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { useEffect, useRef } from
|
|
2
|
-
import { Animated, Easing } from
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { Animated, Easing } from 'react-native';
|
|
3
3
|
import styled from 'styled-components/native';
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
const PulseRing = styled(Animated.View)<{ delay?: number }>`
|
|
7
6
|
position: absolute;
|
|
8
7
|
width: 200px;
|
|
@@ -19,7 +18,6 @@ export const PulseAnimation: React.FC = () => {
|
|
|
19
18
|
const pulse3 = useRef(new Animated.Value(0)).current;
|
|
20
19
|
const AnimatedPulseRing = Animated.createAnimatedComponent(PulseRing);
|
|
21
20
|
|
|
22
|
-
|
|
23
21
|
useEffect(() => {
|
|
24
22
|
const createPulse = (value: Animated.Value, delay: number) => {
|
|
25
23
|
return Animated.loop(
|
|
@@ -75,4 +73,4 @@ export const PulseAnimation: React.FC = () => {
|
|
|
75
73
|
<AnimatedPulseRing style={pulseStyle(pulse3)} />
|
|
76
74
|
</>
|
|
77
75
|
);
|
|
78
|
-
};
|
|
76
|
+
};
|
|
@@ -1,27 +1,55 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
Modal,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
Animated,
|
|
8
|
+
TouchableOpacity,
|
|
9
|
+
} from 'react-native';
|
|
3
10
|
import { FPEngine, _onEvent } from '../../engine/FPEngine';
|
|
4
11
|
import { FPButton } from '../components/FPButton';
|
|
5
12
|
import { C, R, S, F, shadow } from '../theme';
|
|
6
|
-
import type {
|
|
13
|
+
import type {
|
|
14
|
+
FPBluetoothPaymentRequest,
|
|
15
|
+
FPTransferRecipient,
|
|
16
|
+
FPUserInfo,
|
|
17
|
+
} from '../../core/types';
|
|
7
18
|
|
|
8
19
|
export function FPPaymentRequestModal() {
|
|
9
|
-
const [request, setRequest] = useState<FPBluetoothPaymentRequest | null>(
|
|
20
|
+
const [request, setRequest] = useState<FPBluetoothPaymentRequest | null>(
|
|
21
|
+
null
|
|
22
|
+
);
|
|
10
23
|
const [loading, setLoading] = useState(false);
|
|
11
24
|
const scale = React.useRef(new Animated.Value(0.85)).current;
|
|
12
25
|
|
|
13
26
|
const recipient: FPUserInfo | null = FPEngine.getUser() ?? null;
|
|
14
|
-
const recipientAccount: FPTransferRecipient | null =
|
|
27
|
+
const recipientAccount: FPTransferRecipient | null =
|
|
28
|
+
FPEngine.getAccount() ?? null;
|
|
15
29
|
|
|
16
30
|
useEffect(() => {
|
|
17
31
|
const unsub = _onEvent('incoming_payment_request', (req: unknown) => {
|
|
18
32
|
setRequest(req as FPBluetoothPaymentRequest);
|
|
19
|
-
Animated.spring(scale, {
|
|
33
|
+
Animated.spring(scale, {
|
|
34
|
+
toValue: 1,
|
|
35
|
+
useNativeDriver: true,
|
|
36
|
+
tension: 80,
|
|
37
|
+
friction: 10,
|
|
38
|
+
}).start();
|
|
20
39
|
});
|
|
21
40
|
return unsub;
|
|
22
41
|
}, []);
|
|
23
42
|
|
|
24
|
-
const dismiss = () => {
|
|
43
|
+
const dismiss = () => {
|
|
44
|
+
scale.setValue(0.85);
|
|
45
|
+
setRequest(null);
|
|
46
|
+
setLoading(false);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const fullName = (): string => {
|
|
50
|
+
if (!request) return '';
|
|
51
|
+
return `${request.sender.firstName} ${request.sender.lastName}`;
|
|
52
|
+
};
|
|
25
53
|
|
|
26
54
|
const handleAccept = async () => {
|
|
27
55
|
if (!request) return;
|
|
@@ -39,10 +67,13 @@ export function FPPaymentRequestModal() {
|
|
|
39
67
|
|
|
40
68
|
if (!request) return null;
|
|
41
69
|
|
|
42
|
-
|
|
43
70
|
return (
|
|
44
71
|
<Modal
|
|
45
|
-
visible
|
|
72
|
+
visible
|
|
73
|
+
transparent
|
|
74
|
+
animationType="slide"
|
|
75
|
+
statusBarTranslucent
|
|
76
|
+
onRequestClose={handleDecline}
|
|
46
77
|
>
|
|
47
78
|
<View
|
|
48
79
|
style={{
|
|
@@ -52,20 +83,18 @@ export function FPPaymentRequestModal() {
|
|
|
52
83
|
alignItems: 'center',
|
|
53
84
|
}}
|
|
54
85
|
>
|
|
55
|
-
|
|
56
86
|
<View
|
|
57
87
|
style={{
|
|
58
|
-
backgroundColor: '#fff',
|
|
59
88
|
borderRadius: 20,
|
|
60
89
|
padding: 30,
|
|
61
|
-
width: '80%',
|
|
62
|
-
maxWidth: 400,
|
|
63
90
|
}}
|
|
64
91
|
>
|
|
65
92
|
<Animated.View style={[st.card, { transform: [{ scale }] }]}>
|
|
66
93
|
<View style={st.avatar}>
|
|
67
94
|
<Text style={st.avatarText}>
|
|
68
|
-
{(
|
|
95
|
+
{(fullName() ?? request?.sender.deviceName ?? '?')
|
|
96
|
+
.charAt(0)
|
|
97
|
+
.toUpperCase()}
|
|
69
98
|
</Text>
|
|
70
99
|
</View>
|
|
71
100
|
<Text style={st.headline}>Payment Request</Text>
|
|
@@ -89,10 +118,10 @@ export function FPPaymentRequestModal() {
|
|
|
89
118
|
marginBottom: 20,
|
|
90
119
|
}}
|
|
91
120
|
>
|
|
92
|
-
{
|
|
121
|
+
{fullName() ?? request.sender.deviceName ?? 'Someone'}
|
|
93
122
|
</Text>
|
|
94
123
|
<Text style={st.sub}>wants to send you</Text>
|
|
95
|
-
{request.amount &&(
|
|
124
|
+
{request.amount && (
|
|
96
125
|
<View
|
|
97
126
|
style={{
|
|
98
127
|
backgroundColor: '#f5f5f5',
|
|
@@ -101,7 +130,9 @@ export function FPPaymentRequestModal() {
|
|
|
101
130
|
alignItems: 'center',
|
|
102
131
|
}}
|
|
103
132
|
>
|
|
104
|
-
<Text
|
|
133
|
+
<Text
|
|
134
|
+
style={{ fontSize: 16, color: '#666', marginBottom: 5 }}
|
|
135
|
+
>
|
|
105
136
|
Amount
|
|
106
137
|
</Text>
|
|
107
138
|
<Text
|
|
@@ -111,9 +142,10 @@ export function FPPaymentRequestModal() {
|
|
|
111
142
|
color: '#4CAF50',
|
|
112
143
|
}}
|
|
113
144
|
>
|
|
114
|
-
{request.currency}
|
|
145
|
+
{request.currency}
|
|
146
|
+
{request.amount.toFixed(2)}
|
|
115
147
|
</Text>
|
|
116
|
-
</View>
|
|
148
|
+
</View>
|
|
117
149
|
)}
|
|
118
150
|
|
|
119
151
|
{request.narration ? (
|
|
@@ -124,16 +156,28 @@ export function FPPaymentRequestModal() {
|
|
|
124
156
|
) : null}
|
|
125
157
|
<Text style={st.disclaimer}>
|
|
126
158
|
Accepting will receive into{'\n'}
|
|
127
|
-
<Text style={{ fontWeight: '700' }}>
|
|
159
|
+
<Text style={{ fontWeight: '700' }}>
|
|
160
|
+
{recipientAccount?.accountName}
|
|
161
|
+
</Text>{' '}
|
|
162
|
+
({recipientAccount?.accountNumber})
|
|
128
163
|
</Text>
|
|
129
164
|
</View>
|
|
130
165
|
|
|
131
166
|
<View style={st.btnRow}>
|
|
132
|
-
<FPButton
|
|
133
|
-
|
|
167
|
+
<FPButton
|
|
168
|
+
label="Decline"
|
|
169
|
+
onPress={handleDecline}
|
|
170
|
+
variant="outline"
|
|
171
|
+
style={st.declineBtn}
|
|
172
|
+
/>
|
|
173
|
+
<FPButton
|
|
174
|
+
label="Accept"
|
|
175
|
+
onPress={handleAccept}
|
|
176
|
+
loading={loading}
|
|
177
|
+
style={st.acceptBtn}
|
|
178
|
+
/>
|
|
134
179
|
</View>
|
|
135
180
|
</Animated.View>
|
|
136
|
-
|
|
137
181
|
</View>
|
|
138
182
|
</View>
|
|
139
183
|
</Modal>
|
|
@@ -141,18 +185,57 @@ export function FPPaymentRequestModal() {
|
|
|
141
185
|
}
|
|
142
186
|
|
|
143
187
|
const st = StyleSheet.create({
|
|
144
|
-
scrim: {
|
|
145
|
-
|
|
146
|
-
|
|
188
|
+
scrim: {
|
|
189
|
+
flex: 1,
|
|
190
|
+
backgroundColor: 'rgba(11,29,53,0.6)',
|
|
191
|
+
justifyContent: 'flex-end',
|
|
192
|
+
padding: S.lg,
|
|
193
|
+
paddingBottom: 48,
|
|
194
|
+
},
|
|
195
|
+
card: {
|
|
196
|
+
backgroundColor: C.white,
|
|
197
|
+
borderRadius: 28,
|
|
198
|
+
padding: S.xl,
|
|
199
|
+
alignItems: 'center',
|
|
200
|
+
...shadow.lg,
|
|
201
|
+
},
|
|
202
|
+
avatar: {
|
|
203
|
+
width: 72,
|
|
204
|
+
height: 72,
|
|
205
|
+
borderRadius: 36,
|
|
206
|
+
backgroundColor: C.brandLight,
|
|
207
|
+
justifyContent: 'center',
|
|
208
|
+
alignItems: 'center',
|
|
209
|
+
marginBottom: S.md,
|
|
210
|
+
},
|
|
147
211
|
avatarText: { fontSize: 28, fontWeight: '800', color: C.brand },
|
|
148
|
-
headline: {
|
|
212
|
+
headline: {
|
|
213
|
+
fontSize: F.sm,
|
|
214
|
+
fontWeight: '700',
|
|
215
|
+
color: C.muted,
|
|
216
|
+
letterSpacing: 0.8,
|
|
217
|
+
textTransform: 'uppercase',
|
|
218
|
+
marginBottom: 4,
|
|
219
|
+
},
|
|
149
220
|
sender: { fontSize: F.xl, fontWeight: '800', color: C.ink },
|
|
150
221
|
sub: { fontSize: F.md, color: C.muted, marginBottom: S.sm },
|
|
151
222
|
amount: { fontSize: 40, fontWeight: '800', color: C.ink, marginBottom: S.md },
|
|
152
|
-
noteBox: {
|
|
223
|
+
noteBox: {
|
|
224
|
+
backgroundColor: C.surface,
|
|
225
|
+
borderRadius: R.md,
|
|
226
|
+
padding: S.md,
|
|
227
|
+
width: '100%',
|
|
228
|
+
marginBottom: S.md,
|
|
229
|
+
},
|
|
153
230
|
noteLabel: { fontSize: F.xs, color: C.muted, marginBottom: 2 },
|
|
154
231
|
note: { fontSize: F.md, color: C.ink },
|
|
155
|
-
disclaimer: {
|
|
232
|
+
disclaimer: {
|
|
233
|
+
fontSize: F.sm,
|
|
234
|
+
color: C.muted,
|
|
235
|
+
textAlign: 'center',
|
|
236
|
+
lineHeight: 20,
|
|
237
|
+
marginBottom: S.lg,
|
|
238
|
+
},
|
|
156
239
|
btnRow: { flexDirection: 'row', gap: S.sm, width: '100%' },
|
|
157
240
|
declineBtn: { flex: 1 },
|
|
158
241
|
acceptBtn: { flex: 1 },
|
|
@@ -5,7 +5,18 @@
|
|
|
5
5
|
// renders the appropriate full-screen sheet.
|
|
6
6
|
// ─────────────────────────────────────────────
|
|
7
7
|
import React, { useEffect, useState, useRef } from 'react';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
Modal,
|
|
10
|
+
View,
|
|
11
|
+
Text,
|
|
12
|
+
TouchableOpacity,
|
|
13
|
+
StyleSheet,
|
|
14
|
+
Animated,
|
|
15
|
+
Dimensions,
|
|
16
|
+
SafeAreaView,
|
|
17
|
+
StatusBar,
|
|
18
|
+
Platform,
|
|
19
|
+
} from 'react-native';
|
|
9
20
|
import { _onEvent } from '../../engine/FPEngine';
|
|
10
21
|
import SendScreen from '../screens/SendScreen';
|
|
11
22
|
import ReceiveScreen from '../screens/ReceiveScreen';
|
|
@@ -55,13 +66,28 @@ export function FPShell() {
|
|
|
55
66
|
useEffect(() => {
|
|
56
67
|
const unsubSend = _onEvent('show_send', (d: unknown) => {
|
|
57
68
|
const data = d as any;
|
|
58
|
-
open({
|
|
69
|
+
open({
|
|
70
|
+
mode: 'send',
|
|
71
|
+
user: data?.user,
|
|
72
|
+
amount: data?.amount,
|
|
73
|
+
currency: data?.currency,
|
|
74
|
+
});
|
|
59
75
|
});
|
|
60
76
|
const unsubReceive = _onEvent('show_receive', (d: unknown) => {
|
|
61
77
|
const data = d as any;
|
|
62
|
-
open({
|
|
78
|
+
open({
|
|
79
|
+
mode: 'receive',
|
|
80
|
+
user: data?.user,
|
|
81
|
+
amount: data?.amount,
|
|
82
|
+
currency: data?.currency,
|
|
83
|
+
});
|
|
63
84
|
});
|
|
64
|
-
|
|
85
|
+
const unsubClose = _onEvent('close_send', () => close());
|
|
86
|
+
return () => {
|
|
87
|
+
unsubSend();
|
|
88
|
+
unsubReceive();
|
|
89
|
+
unsubClose();
|
|
90
|
+
};
|
|
65
91
|
}, []);
|
|
66
92
|
|
|
67
93
|
return (
|
|
@@ -73,33 +99,33 @@ export function FPShell() {
|
|
|
73
99
|
<Animated.View
|
|
74
100
|
style={[st.fullscreen, { transform: [{ translateY: slide }] }]}
|
|
75
101
|
>
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
<View style={st.content}>
|
|
103
|
+
{sheet.mode === 'send' && (
|
|
104
|
+
<SendScreen
|
|
105
|
+
user={FPEngine.getUser() ?? null}
|
|
106
|
+
account={FPEngine.getAccount() ?? null}
|
|
107
|
+
amount={sheet.amount ?? 0}
|
|
108
|
+
currency={sheet.currency ?? 'NGN'}
|
|
109
|
+
onClose={close}
|
|
110
|
+
onPaymentSent={(tx) => {
|
|
111
|
+
FPEngine.getCallbacks().onPaymentSent?.(tx);
|
|
112
|
+
close();
|
|
113
|
+
}}
|
|
114
|
+
onError={FPEngine.getCallbacks().onError}
|
|
115
|
+
/>
|
|
116
|
+
)}
|
|
117
|
+
{sheet.mode === 'receive' && (
|
|
118
|
+
<ReceiveScreen
|
|
119
|
+
amount={sheet.amount}
|
|
120
|
+
currency={sheet.currency}
|
|
121
|
+
user={FPEngine.getUser() ?? null}
|
|
122
|
+
account={FPEngine.getAccount() ?? null}
|
|
123
|
+
onClose={close}
|
|
124
|
+
onPaymentReceived={FPEngine.getCallbacks().onPaymentReceived}
|
|
125
|
+
onError={FPEngine.getCallbacks().onError}
|
|
126
|
+
/>
|
|
127
|
+
)}
|
|
128
|
+
</View>
|
|
103
129
|
</Animated.View>
|
|
104
130
|
)}
|
|
105
131
|
</>
|
|
@@ -126,7 +152,8 @@ const st = StyleSheet.create({
|
|
|
126
152
|
alignItems: 'center',
|
|
127
153
|
justifyContent: 'space-between',
|
|
128
154
|
paddingHorizontal: S.lg,
|
|
129
|
-
paddingTop:
|
|
155
|
+
paddingTop:
|
|
156
|
+
Platform.OS === 'android' ? (StatusBar.currentHeight ?? 0) + S.sm : S.md,
|
|
130
157
|
paddingBottom: S.md,
|
|
131
158
|
backgroundColor: C.white,
|
|
132
159
|
},
|
|
@@ -164,7 +191,7 @@ const st = StyleSheet.create({
|
|
|
164
191
|
width: 8,
|
|
165
192
|
height: 8,
|
|
166
193
|
borderRadius: 4,
|
|
167
|
-
marginRight: 14,
|
|
194
|
+
marginRight: 14, // visually balances the close button width
|
|
168
195
|
},
|
|
169
196
|
divider: {
|
|
170
197
|
height: 1,
|
|
@@ -176,4 +203,3 @@ const st = StyleSheet.create({
|
|
|
176
203
|
backgroundColor: C.surface,
|
|
177
204
|
},
|
|
178
205
|
});
|
|
179
|
-
|