react-native-fpay 0.2.9 → 0.3.2
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 +5 -1
- package/lib/module/FountainPayProvider.js.map +1 -1
- package/lib/module/core/api/index.js +22 -12
- package/lib/module/core/api/index.js.map +1 -1
- package/lib/module/engine/BLEReceiverService.js.map +1 -1
- package/lib/module/engine/FPEngine.js +24 -13
- package/lib/module/engine/FPEngine.js.map +1 -1
- package/lib/module/engine/useIsForeground.js +17 -0
- package/lib/module/engine/useIsForeground.js.map +1 -0
- package/lib/module/ui/components/AnimatedDots.js +68 -0
- package/lib/module/ui/components/AnimatedDots.js.map +1 -0
- package/lib/module/ui/components/ConfirmScreen.js +333 -0
- package/lib/module/ui/components/ConfirmScreen.js.map +1 -0
- package/lib/module/ui/modals/FPPaymentRequestModal.js +6 -8
- package/lib/module/ui/modals/FPPaymentRequestModal.js.map +1 -1
- package/lib/module/ui/modals/FPShell.js +7 -4
- package/lib/module/ui/modals/FPShell.js.map +1 -1
- package/lib/module/ui/screens/ReceiveScreen.js +379 -274
- package/lib/module/ui/screens/ReceiveScreen.js.map +1 -1
- package/lib/module/ui/screens/SendScreen.js +154 -45
- package/lib/module/ui/screens/SendScreen.js.map +1 -1
- package/lib/module/ui/screens/styles.js +89 -0
- package/lib/module/ui/screens/styles.js.map +1 -0
- package/lib/module/ui/screens/sub/receivePayment/Nfc/index.js +361 -0
- package/lib/module/ui/screens/sub/receivePayment/Nfc/index.js.map +1 -0
- package/lib/module/ui/screens/sub/receivePayment/Qr/index.js +338 -0
- package/lib/module/ui/screens/sub/receivePayment/Qr/index.js.map +1 -0
- package/lib/module/ui/screens/sub/receivePayment/Transfer/index.js +453 -0
- package/lib/module/ui/screens/sub/receivePayment/Transfer/index.js.map +1 -0
- package/lib/module/ui/screens/sub/{BluetoothSubScreen.js → sendPayment/BluetoothSubScreen.js} +25 -32
- package/lib/module/ui/screens/sub/sendPayment/BluetoothSubScreen.js.map +1 -0
- package/lib/module/ui/screens/sub/sendPayment/NFCSubScreen.js +354 -0
- package/lib/module/ui/screens/sub/sendPayment/NFCSubScreen.js.map +1 -0
- package/lib/module/ui/screens/sub/sendPayment/NQRSubScreen.js +440 -0
- package/lib/module/ui/screens/sub/sendPayment/NQRSubScreen.js.map +1 -0
- package/lib/module/ui/screens/sub/{ProximitySubScreen.js → sendPayment/ProximitySubScreen.js} +20 -111
- package/lib/module/ui/screens/sub/sendPayment/ProximitySubScreen.js.map +1 -0
- package/lib/module/ui/screens/sub/sendPayment/TransferSubScreen.js +327 -0
- package/lib/module/ui/screens/sub/sendPayment/TransferSubScreen.js.map +1 -0
- package/lib/typescript/src/FountainPayProvider.d.ts.map +1 -1
- package/lib/typescript/src/core/api/index.d.ts +20 -27
- package/lib/typescript/src/core/api/index.d.ts.map +1 -1
- package/lib/typescript/src/core/types/index.d.ts +56 -13
- 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/FPEngine.d.ts +3 -1
- package/lib/typescript/src/engine/FPEngine.d.ts.map +1 -1
- package/lib/typescript/src/engine/useIsForeground.d.ts +2 -0
- package/lib/typescript/src/engine/useIsForeground.d.ts.map +1 -0
- package/lib/typescript/src/ui/components/AnimatedDots.d.ts +2 -0
- package/lib/typescript/src/ui/components/AnimatedDots.d.ts.map +1 -0
- package/lib/typescript/src/ui/components/ConfirmScreen.d.ts +10 -0
- package/lib/typescript/src/ui/components/ConfirmScreen.d.ts.map +1 -0
- package/lib/typescript/src/ui/components/OtpInput/Styles.d.ts +3 -3
- 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 +2 -9
- package/lib/typescript/src/ui/screens/ReceiveScreen.d.ts.map +1 -1
- package/lib/typescript/src/ui/screens/SendScreen.d.ts +4 -2
- package/lib/typescript/src/ui/screens/SendScreen.d.ts.map +1 -1
- package/lib/typescript/src/ui/screens/styles.d.ts +1390 -0
- package/lib/typescript/src/ui/screens/styles.d.ts.map +1 -0
- package/lib/typescript/src/ui/screens/sub/receivePayment/Nfc/index.d.ts +10 -0
- package/lib/typescript/src/ui/screens/sub/receivePayment/Nfc/index.d.ts.map +1 -0
- package/lib/typescript/src/ui/screens/sub/receivePayment/Qr/index.d.ts +10 -0
- package/lib/typescript/src/ui/screens/sub/receivePayment/Qr/index.d.ts.map +1 -0
- package/lib/typescript/src/ui/screens/sub/receivePayment/Transfer/index.d.ts +5 -0
- package/lib/typescript/src/ui/screens/sub/receivePayment/Transfer/index.d.ts.map +1 -0
- package/lib/typescript/src/ui/screens/sub/{BluetoothSubScreen.d.ts → sendPayment/BluetoothSubScreen.d.ts} +2 -11
- package/lib/typescript/src/ui/screens/sub/sendPayment/BluetoothSubScreen.d.ts.map +1 -0
- package/lib/typescript/src/ui/screens/sub/sendPayment/NFCSubScreen.d.ts +3 -0
- package/lib/typescript/src/ui/screens/sub/sendPayment/NFCSubScreen.d.ts.map +1 -0
- package/lib/typescript/src/ui/screens/sub/sendPayment/NQRSubScreen.d.ts +3 -0
- package/lib/typescript/src/ui/screens/sub/sendPayment/NQRSubScreen.d.ts.map +1 -0
- package/lib/typescript/src/ui/screens/sub/{ProximitySubScreen.d.ts → sendPayment/ProximitySubScreen.d.ts} +2 -10
- package/lib/typescript/src/ui/screens/sub/sendPayment/ProximitySubScreen.d.ts.map +1 -0
- package/lib/typescript/src/ui/screens/sub/sendPayment/TransferSubScreen.d.ts +3 -0
- package/lib/typescript/src/ui/screens/sub/sendPayment/TransferSubScreen.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/FountainPayProvider.tsx +7 -1
- package/src/core/api/index.ts +34 -19
- package/src/core/types/index.ts +67 -13
- package/src/engine/BLEReceiverService.ts +2 -0
- package/src/engine/FPEngine.ts +29 -14
- package/src/engine/useIsForeground.ts +18 -0
- package/src/ui/components/AnimatedDots.tsx +81 -0
- package/src/ui/components/ConfirmScreen.tsx +421 -0
- package/src/ui/modals/FPPaymentRequestModal.tsx +7 -6
- package/src/ui/modals/FPShell.tsx +9 -9
- package/src/ui/screens/ReceiveScreen.tsx +266 -115
- package/src/ui/screens/SendScreen.tsx +141 -19
- package/src/ui/screens/styles.ts +101 -0
- package/src/ui/screens/sub/receivePayment/Nfc/index.tsx +418 -0
- package/src/ui/screens/sub/receivePayment/Qr/index.tsx +391 -0
- package/src/ui/screens/sub/receivePayment/Transfer/index.tsx +512 -0
- package/src/ui/screens/sub/{BluetoothSubScreen.tsx → sendPayment/BluetoothSubScreen.tsx} +27 -46
- package/src/ui/screens/sub/sendPayment/NFCSubScreen.tsx +302 -0
- package/src/ui/screens/sub/sendPayment/NQRSubScreen.tsx +490 -0
- package/src/ui/screens/sub/{ProximitySubScreen.tsx → sendPayment/ProximitySubScreen.tsx} +24 -44
- package/src/ui/screens/sub/sendPayment/TransferSubScreen.tsx +345 -0
- package/lib/module/ui/screens/sub/BluetoothSubScreen.js.map +0 -1
- package/lib/module/ui/screens/sub/NFCSubScreen.js +0 -164
- package/lib/module/ui/screens/sub/NFCSubScreen.js.map +0 -1
- package/lib/module/ui/screens/sub/NQRSubScreen.js +0 -131
- package/lib/module/ui/screens/sub/NQRSubScreen.js.map +0 -1
- package/lib/module/ui/screens/sub/ProximitySubScreen.js.map +0 -1
- package/lib/module/ui/screens/sub/TransferSubScreen.js +0 -353
- package/lib/module/ui/screens/sub/TransferSubScreen.js.map +0 -1
- package/lib/typescript/src/ui/screens/sub/BluetoothSubScreen.d.ts.map +0 -1
- package/lib/typescript/src/ui/screens/sub/NFCSubScreen.d.ts +0 -18
- package/lib/typescript/src/ui/screens/sub/NFCSubScreen.d.ts.map +0 -1
- package/lib/typescript/src/ui/screens/sub/NQRSubScreen.d.ts +0 -12
- package/lib/typescript/src/ui/screens/sub/NQRSubScreen.d.ts.map +0 -1
- package/lib/typescript/src/ui/screens/sub/ProximitySubScreen.d.ts.map +0 -1
- package/lib/typescript/src/ui/screens/sub/TransferSubScreen.d.ts +0 -11
- package/lib/typescript/src/ui/screens/sub/TransferSubScreen.d.ts.map +0 -1
- package/src/ui/screens/sub/NFCSubScreen.tsx +0 -86
- package/src/ui/screens/sub/NQRSubScreen.tsx +0 -62
- package/src/ui/screens/sub/TransferSubScreen.tsx +0 -147
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/ui/screens/styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAE3B,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAQrB,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAInB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAOzB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAK5B,CAAC;AAEF,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAShB,CAAC;AAGF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAMpB,CAAC;AAGF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAG1B,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAQtB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAGvB,CAAC;AAEF,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAKjB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAOpB,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAIuvrB,CAAC;;;;;;;;;;;UAAnxrB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ReceiveNFCScreenProps {
|
|
3
|
+
amount: number;
|
|
4
|
+
description?: string;
|
|
5
|
+
onClose?: () => void;
|
|
6
|
+
onPaymentReceived?: (data: any) => void;
|
|
7
|
+
}
|
|
8
|
+
declare const Nfc: React.FC<ReceiveNFCScreenProps>;
|
|
9
|
+
export default Nfc;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/screens/sub/receivePayment/Nfc/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAmO3D,UAAU,qBAAqB;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CACzC;AAED,QAAA,MAAM,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAqLxC,CAAC;AAEF,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ReceiveQRCodeScreenProps {
|
|
3
|
+
amount: number;
|
|
4
|
+
description?: string;
|
|
5
|
+
onClose?: () => void;
|
|
6
|
+
onPaymentReceived?: (data: any) => void;
|
|
7
|
+
}
|
|
8
|
+
declare const Qr: React.FC<ReceiveQRCodeScreenProps>;
|
|
9
|
+
export default Qr;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/screens/sub/receivePayment/Qr/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAiO3D,UAAU,wBAAwB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CACzC;AAED,QAAA,MAAM,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA4J1C,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/screens/sub/receivePayment/Transfer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAiR5E,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAuOlD,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Props } from '../../../../core/types';
|
|
3
3
|
export declare const DeviceCard: import("styled-components/native/dist/types").IStyledComponentBase<"native", import("styled-components/native/dist/types").FastOmit<Omit<Readonly<Omit<Readonly<{
|
|
4
4
|
onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => unknown) | undefined;
|
|
5
5
|
onAccessibilityTap?: (() => unknown) | undefined;
|
|
@@ -538,14 +538,5 @@ export declare const PayButtonText: import("styled-components/native/dist/types"
|
|
|
538
538
|
}>, never>>, "ref"> & {
|
|
539
539
|
ref?: React.Ref<import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default>;
|
|
540
540
|
}, never>>;
|
|
541
|
-
|
|
542
|
-
mode: 'send' | 'receive';
|
|
543
|
-
amount: number;
|
|
544
|
-
currency: FPCurrency;
|
|
545
|
-
onDone: () => void;
|
|
546
|
-
onSuccess?: (tx: FPTransaction) => void;
|
|
547
|
-
onError?: (err: FPError) => void;
|
|
548
|
-
}
|
|
549
|
-
export declare function BluetoothSubScreen({ mode, amount, currency, onDone, onSuccess, onError, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
550
|
-
export {};
|
|
541
|
+
export declare function BluetoothSubScreen({ amount, currency, onClose, onProcessTransaction, onError, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
551
542
|
//# sourceMappingURL=BluetoothSubScreen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BluetoothSubScreen.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/screens/sub/sendPayment/BluetoothSubScreen.tsx"],"names":[],"mappings":"AAaA,OAAO,KAA8B,MAAM,OAAO,CAAC;AASnD,OAAO,KAAK,EAA2E,KAAK,EAAE,MAAM,wBAAwB,CAAC;AA8E7H,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAatB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAEtB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAKtB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAGxB,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAIrB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAIzB,CAAC;AAwDF,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,QAAQ,EACR,OAAO,EACP,oBAAoB,EACpB,OAAO,GACR,EAAE,KAAK,2CAqNP"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NFCSubScreen.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/screens/sub/sendPayment/NFCSubScreen.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAsC,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAkIxF,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,QAAQ,EACR,OAAO,EACP,oBAAoB,EACpB,OAAO,EACP,EAAE,KAAK,2CAmJR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NQRSubScreen.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/screens/sub/sendPayment/NQRSubScreen.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAuB,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAsLzE,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,QAAQ,EACR,OAAO,EACP,oBAAoB,EACpB,OAAO,EACP,EAAE,KAAK,2CA0RR"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Animated } from 'react-native';
|
|
3
|
-
import type {
|
|
3
|
+
import type { Props } from '../../../../core/types';
|
|
4
4
|
export declare const DeviceCard: import("styled-components/native/dist/types").IStyledComponentBase<"native", import("styled-components/native/dist/types").FastOmit<Omit<Readonly<Omit<Readonly<{
|
|
5
5
|
onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => unknown) | undefined;
|
|
6
6
|
onAccessibilityTap?: (() => unknown) | undefined;
|
|
@@ -539,13 +539,5 @@ export declare const PayButtonText: import("styled-components/native/dist/types"
|
|
|
539
539
|
}>, never>>, "ref"> & {
|
|
540
540
|
ref?: React.Ref<import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default>;
|
|
541
541
|
}, never>>;
|
|
542
|
-
|
|
543
|
-
amount: number;
|
|
544
|
-
currency: FPCurrency;
|
|
545
|
-
onDone: () => void;
|
|
546
|
-
onSuccess?: (tx: FPTransaction) => void;
|
|
547
|
-
onError?: (err: FPError) => void;
|
|
548
|
-
}
|
|
549
|
-
export declare function ProximitySubScreen({ amount, currency, onDone, onSuccess, onError }: Props): import("react/jsx-runtime").JSX.Element;
|
|
550
|
-
export {};
|
|
542
|
+
export declare function ProximitySubScreen({ amount, currency, onClose, onProcessTransaction, onError }: Props): import("react/jsx-runtime").JSX.Element;
|
|
551
543
|
//# sourceMappingURL=ProximitySubScreen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProximitySubScreen.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/screens/sub/sendPayment/ProximitySubScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,OAAO,EAA4C,QAAQ,EAAU,MAAM,cAAc,CAAC;AAE1F,OAAO,KAAK,EAAW,KAAK,EAAwB,MAAM,wBAAwB,CAAC;AA8EnF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAatB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAEtB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAKtB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAGxB,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAIrB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAIzB,CAAC;AAiGF,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,QAAQ,EACR,OAAO,EACP,oBAAoB,EACpB,OAAO,EAAE,EAAE,KAAK,2CAiJjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransferSubScreen.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/screens/sub/sendPayment/TransferSubScreen.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAsC,KAAK,EAAwB,MAAM,wBAAwB,CAAC;AAmJ9G,wBAAgB,iBAAiB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,EAAE,KAAK,2CA8LpG"}
|
package/package.json
CHANGED
|
@@ -24,6 +24,7 @@ import type {
|
|
|
24
24
|
FPCurrency,
|
|
25
25
|
FPGenerateAccountRequest,
|
|
26
26
|
FPVirtualAccount,
|
|
27
|
+
FPTransferRecipient,
|
|
27
28
|
} from './core/types';
|
|
28
29
|
|
|
29
30
|
// ── Context ───────────────────────────────────────────────────────────────────
|
|
@@ -81,7 +82,7 @@ export function FountainPayProvider({ apiKey, options, children }: ProviderProps
|
|
|
81
82
|
* Starts BLE advertising, proximity broadcast, and the payment listener.
|
|
82
83
|
*/
|
|
83
84
|
async initializeSDK(user: FPUserInfo, callbacks?: FPCallbacks): Promise<void> {
|
|
84
|
-
console.log('[FountainPay] initializeSDK() called for user:', user.
|
|
85
|
+
console.log('[FountainPay] initializeSDK() called for user:', user.name);
|
|
85
86
|
try {
|
|
86
87
|
await FPEngine.initialize(apiKey, user, options ?? {}, callbacks ?? {});
|
|
87
88
|
console.log('[FountainPay] initializeSDK() complete. SDK is ready.');
|
|
@@ -91,6 +92,11 @@ export function FountainPayProvider({ apiKey, options, children }: ProviderProps
|
|
|
91
92
|
}
|
|
92
93
|
},
|
|
93
94
|
|
|
95
|
+
setAccountDetails(account: FPTransferRecipient): void {
|
|
96
|
+
console.log('[FountainPay] setAccountDetails() called for user:', account.accountName);
|
|
97
|
+
FPEngine.setAccountDetails(account);
|
|
98
|
+
},
|
|
99
|
+
|
|
94
100
|
/** Open the Send Money bottom sheet. */
|
|
95
101
|
send(amount: number, currency: FPCurrency): void {
|
|
96
102
|
console.log('[FountainPay] send() called:', amount, currency);
|
package/src/core/api/index.ts
CHANGED
|
@@ -8,54 +8,69 @@ import type {
|
|
|
8
8
|
FPNQRData,
|
|
9
9
|
FPTxStatus,
|
|
10
10
|
FPProximityPeer,
|
|
11
|
+
FPSendPaymentRequest,
|
|
11
12
|
} from "../types";
|
|
12
13
|
|
|
13
14
|
export const walletAPI = {
|
|
14
15
|
generate: (req: FPGenerateAccountRequest) =>
|
|
15
|
-
http().post<FPVirtualAccount>("/
|
|
16
|
+
http().post<FPVirtualAccount>("/wallet/generate", req).then(r => r.data),
|
|
16
17
|
|
|
17
18
|
getBalance: (walletId: string) =>
|
|
18
|
-
http().get<{ balance: number; currency: string }>("/
|
|
19
|
+
http().get<{ balance: number; currency: string }>("/wallet/" + walletId + "/balance").then(r => r.data),
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
export const transferAPI = {
|
|
22
23
|
getBanks: () =>
|
|
23
|
-
http().get<FPBankItem[]>("/
|
|
24
|
+
http().get<FPBankItem[]>("/banks").then(r => r.data),
|
|
24
25
|
|
|
25
26
|
verifyAccount: (accountNumber: string, bankCode: string) =>
|
|
26
27
|
http().post<{ accountName: string; accountNumber: string; bankName: string; bankCode: string }>(
|
|
27
|
-
"/
|
|
28
|
+
"/transfer/verify-account", { accountNumber, bankCode }
|
|
28
29
|
).then(r => r.data),
|
|
29
30
|
|
|
30
|
-
send: (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
).then(r => r.data),
|
|
34
|
-
|
|
35
|
-
status: (reference: string) =>
|
|
36
|
-
http().get<{ status: FPTxStatus; reference: string }>("/v1/transfer/" + reference + "/status").then(r => r.data),
|
|
31
|
+
send: (
|
|
32
|
+
payload: FPSendPaymentRequest
|
|
33
|
+
) =>
|
|
34
|
+
http().post<FPTransaction>("/transfer/initiate", payload).then(r => r.data),
|
|
37
35
|
};
|
|
38
36
|
|
|
39
37
|
export const nqrAPI = {
|
|
40
38
|
generate: (payload: { amount?: number; reference?: string; currency?: string; expiresInMinutes?: number }) =>
|
|
41
|
-
http().post<FPNQRData>("/
|
|
39
|
+
http().post<FPNQRData>("/payment/nqr/generate", payload).then(r => r.data),
|
|
42
40
|
|
|
43
|
-
pay: (payload:
|
|
44
|
-
http().post<FPTransaction>("/
|
|
41
|
+
pay: (payload: FPSendPaymentRequest) =>
|
|
42
|
+
http().post<FPTransaction>("/payment/nqr/pay", payload).then(r => r.data),
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const nfcAPI = {
|
|
46
|
+
pay: (payload: FPSendPaymentRequest) =>
|
|
47
|
+
http().post<FPTransaction>("/payment/nfc/pay", payload).then(r => r.data),
|
|
45
48
|
};
|
|
46
49
|
|
|
47
50
|
export const proximityAPI = {
|
|
48
|
-
broadcast: (payload: { latitude: number; longitude: number; accountName: string; accountNumber: string; bankCode: string; bankName: string }) =>
|
|
49
|
-
http().post<{ sessionId: string }>("/
|
|
51
|
+
broadcast: (payload: { latitude: number; longitude: number; user: string; email: string; accountName: string; accountNumber: string; bankCode: string; bankName: string }) =>
|
|
52
|
+
http().post<{ sessionId: string }>("/proximity/broadcast", payload).then(r => r.data),
|
|
50
53
|
|
|
51
54
|
heartbeat: (sessionId: string, lat: number, lng: number) =>
|
|
52
|
-
http().patch("/
|
|
55
|
+
http().patch("/proximity/broadcast/" + sessionId, { latitude: lat, longitude: lng }),
|
|
53
56
|
|
|
54
57
|
unregister: (sessionId: string) =>
|
|
55
|
-
http().delete("/
|
|
58
|
+
http().delete("/proximity/broadcast/" + sessionId),
|
|
56
59
|
|
|
57
60
|
discover: (lat: number, lng: number, radiusMeters: number) =>
|
|
58
61
|
http().post<{ peers: FPProximityPeer[] }>(
|
|
59
|
-
"/
|
|
62
|
+
"/proximity/discover", { latitude: lat, longitude: lng, radiusMeters }
|
|
60
63
|
).then(r => r.data.peers),
|
|
61
64
|
};
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
export const transactionAPI = {
|
|
68
|
+
status: (reference: string) =>
|
|
69
|
+
http().get<{ status: FPTxStatus; reference: string }>("/transaction/verify/" + reference).then(r => r.data),
|
|
70
|
+
|
|
71
|
+
verify: (reference: string) =>
|
|
72
|
+
http().get<{ FPTransaction: any }>("/transaction/verify/" + reference).then(r => r.data),
|
|
73
|
+
|
|
74
|
+
validateOtp: (otp: string, email: string) =>
|
|
75
|
+
http().post<{Response: any}>("/verify-otp", {otp, email}).then(r=>r.data)
|
|
76
|
+
};
|
package/src/core/types/index.ts
CHANGED
|
@@ -8,12 +8,9 @@ export type FPTxStatus = 'pending' | 'processing' | 'successful' | 'failed' | 'r
|
|
|
8
8
|
export type FPTxType = 'debit' | 'credit';
|
|
9
9
|
|
|
10
10
|
export interface FPUserInfo {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
bankCode: string;
|
|
15
|
-
phone?: string;
|
|
16
|
-
email?: string;
|
|
11
|
+
name: string;
|
|
12
|
+
phone: string;
|
|
13
|
+
email: string;
|
|
17
14
|
userId: string;
|
|
18
15
|
}
|
|
19
16
|
|
|
@@ -24,15 +21,53 @@ export interface FPSDKOptions {
|
|
|
24
21
|
bluetoothDisplayName?: string;
|
|
25
22
|
}
|
|
26
23
|
|
|
27
|
-
export interface
|
|
24
|
+
export interface FPTransferRecipient {
|
|
25
|
+
accountNumber: string;
|
|
28
26
|
accountName: string;
|
|
29
|
-
|
|
30
|
-
bankName
|
|
31
|
-
|
|
27
|
+
bankCode: string;
|
|
28
|
+
bankName: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
export interface FPNfcRecipient {
|
|
33
|
+
accountNumber: string;
|
|
34
|
+
accountName: string;
|
|
35
|
+
bankCode: string;
|
|
36
|
+
bankName: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface FPNqrRecipient {
|
|
40
|
+
accountNumber: string;
|
|
41
|
+
accountName: string;
|
|
42
|
+
bankCode: string;
|
|
43
|
+
bankName: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface FPParty {
|
|
47
|
+
name: string;
|
|
32
48
|
phone?: string;
|
|
33
49
|
email?: string;
|
|
34
50
|
}
|
|
35
51
|
|
|
52
|
+
export interface FPSendPaymentRequest {
|
|
53
|
+
sender?: FPUserInfo;
|
|
54
|
+
amount: number;
|
|
55
|
+
narration?: string;
|
|
56
|
+
reference?: string
|
|
57
|
+
channel: 'transfer' | 'proximity' | 'bluetooth' | 'nfc' | 'nqr';
|
|
58
|
+
currency?: string
|
|
59
|
+
recipient: FPTransferRecipient | FPNfcRecipient | FPNqrRecipient
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
export interface FPNfcTransfer {
|
|
64
|
+
amount: number;
|
|
65
|
+
narration?: string;
|
|
66
|
+
reference?: string
|
|
67
|
+
currency?: string
|
|
68
|
+
channel: 'nfc';
|
|
69
|
+
}
|
|
70
|
+
|
|
36
71
|
export interface FPTransaction {
|
|
37
72
|
id: string;
|
|
38
73
|
reference: string;
|
|
@@ -42,8 +77,8 @@ export interface FPTransaction {
|
|
|
42
77
|
currency: FPCurrency;
|
|
43
78
|
status: FPTxStatus;
|
|
44
79
|
description?: string;
|
|
45
|
-
sender?:
|
|
46
|
-
recipient?:
|
|
80
|
+
sender?: FPUserInfo;
|
|
81
|
+
recipient?: FPTransferRecipient | FPNfcRecipient | FPNqrRecipient;
|
|
47
82
|
metadata?: Record<string, unknown>;
|
|
48
83
|
createdAt: string;
|
|
49
84
|
}
|
|
@@ -75,7 +110,7 @@ export interface FPVirtualAccount {
|
|
|
75
110
|
|
|
76
111
|
export interface FPBluetoothPaymentRequest {
|
|
77
112
|
requestId: string;
|
|
78
|
-
sender:
|
|
113
|
+
sender: FPUserInfo & { deviceId: string; deviceName?: string };
|
|
79
114
|
amount: number;
|
|
80
115
|
currency: FPCurrency;
|
|
81
116
|
narration?: string;
|
|
@@ -142,3 +177,22 @@ export interface FintechDevice {
|
|
|
142
177
|
rawDevice: Device;
|
|
143
178
|
waiting?: boolean;
|
|
144
179
|
}
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
export interface Props {
|
|
183
|
+
amount: number;
|
|
184
|
+
currency: FPCurrency;
|
|
185
|
+
onClose: () => void;
|
|
186
|
+
onProcessTransaction?: (tx: FPSendPaymentRequest) => void;
|
|
187
|
+
onError?: (err: FPError) => void;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
export interface ReceiveTransferScreenProps {
|
|
192
|
+
amount?: number;
|
|
193
|
+
description?: string;
|
|
194
|
+
user: FPUserInfo;
|
|
195
|
+
recipient: FPTransferRecipient;
|
|
196
|
+
onClose?: () => void;
|
|
197
|
+
onPaymentReceived?: (data: any) => void;
|
|
198
|
+
}
|
package/src/engine/FPEngine.ts
CHANGED
|
@@ -16,6 +16,7 @@ import type {
|
|
|
16
16
|
FPGenerateAccountRequest,
|
|
17
17
|
FPError,
|
|
18
18
|
FintechDevice,
|
|
19
|
+
FPTransferRecipient,
|
|
19
20
|
} from '../core/types';
|
|
20
21
|
import BLEReceiverService, { type BLEPaymentRequest, type BLEPaymentResponse } from './BLEReceiverService';
|
|
21
22
|
import BLESenderService, { type BLESendPaymentRequest, type BLESendPaymentResponse } from './BLESenderService';
|
|
@@ -23,6 +24,7 @@ import BLESenderService, { type BLESendPaymentRequest, type BLESendPaymentRespon
|
|
|
23
24
|
// ── Module-level singleton state ──────────────────────────────
|
|
24
25
|
let _apiKey: string | null = null;
|
|
25
26
|
let _user: FPUserInfo | null = null;
|
|
27
|
+
let _account: FPTransferRecipient | null = null;
|
|
26
28
|
let _callbacks: FPCallbacks = {};
|
|
27
29
|
let _options: FPSDKOptions = {};
|
|
28
30
|
let _isReady = false;
|
|
@@ -65,15 +67,17 @@ function _getLocation(): Promise<{ lat: number; lng: number }> {
|
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
async function _startProximityBroadcast(): Promise<void> {
|
|
68
|
-
if (!_user) return;
|
|
70
|
+
if (!_user || !_account) return;
|
|
69
71
|
try {
|
|
70
72
|
const loc = await _getLocation();
|
|
71
73
|
const session = await proximityAPI.broadcast({
|
|
72
74
|
latitude: loc.lat, longitude: loc.lng,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
user: _user?.name || "",
|
|
76
|
+
email: _user?.email || "",
|
|
77
|
+
accountName: _account?.accountName || "",
|
|
78
|
+
accountNumber: _account?.accountNumber || "",
|
|
79
|
+
bankCode: _account?.bankCode || "",
|
|
80
|
+
bankName: _account?.bankName || "",
|
|
77
81
|
});
|
|
78
82
|
_proximitySessionId = session.sessionId;
|
|
79
83
|
_clearProximityInterval();
|
|
@@ -170,7 +174,10 @@ async function _handleIncomingRequest(req: BLEPaymentRequest, deviceId: string):
|
|
|
170
174
|
const fpRequest: FPBluetoothPaymentRequest = {
|
|
171
175
|
requestId: req.senderId + '_' + req.timestamp,
|
|
172
176
|
sender: {
|
|
173
|
-
|
|
177
|
+
name: req.senderName,
|
|
178
|
+
phone: req.senderPhone,
|
|
179
|
+
email: req.senderEmail,
|
|
180
|
+
userId: req.senderId,
|
|
174
181
|
deviceId,
|
|
175
182
|
deviceName: req.senderName,
|
|
176
183
|
},
|
|
@@ -207,9 +214,9 @@ export const FPEngine = {
|
|
|
207
214
|
initClient(apiKey, { baseUrl: options.baseUrl, environment: options.environment });
|
|
208
215
|
|
|
209
216
|
// Initialize BLE receiver with this user's info
|
|
210
|
-
const displayName = options.bluetoothDisplayName ?? user.
|
|
217
|
+
const displayName = options.bluetoothDisplayName ?? user.name;
|
|
211
218
|
await BLEReceiverService.initializeWithUserInfo(
|
|
212
|
-
user.userId ?? user.
|
|
219
|
+
user.userId ?? user.userId,
|
|
213
220
|
displayName,
|
|
214
221
|
'FountainPay'
|
|
215
222
|
);
|
|
@@ -240,6 +247,12 @@ export const FPEngine = {
|
|
|
240
247
|
console.log('[FPay Engine] Initialized. Advertising as:', displayName);
|
|
241
248
|
},
|
|
242
249
|
|
|
250
|
+
async setAccountDetails(account: FPTransferRecipient): Promise<void>{
|
|
251
|
+
_account = account;
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
243
256
|
async deviceConnection (deviceId: string): Promise<void>{
|
|
244
257
|
await BLESenderService.connectToDevice(deviceId);
|
|
245
258
|
},
|
|
@@ -272,11 +285,11 @@ export const FPEngine = {
|
|
|
272
285
|
accepted: true,
|
|
273
286
|
transactionId,
|
|
274
287
|
timestamp: Date.now(),
|
|
275
|
-
accountDetails:
|
|
276
|
-
accountName:
|
|
277
|
-
accountNumber:
|
|
278
|
-
bankName:
|
|
279
|
-
bankCode:
|
|
288
|
+
accountDetails: _account ? {
|
|
289
|
+
accountName: _account?.accountName,
|
|
290
|
+
accountNumber: _account?.accountNumber,
|
|
291
|
+
bankName: _account?.bankName,
|
|
292
|
+
bankCode: _account?.bankCode,
|
|
280
293
|
} : undefined,
|
|
281
294
|
// requestTimestamp is echoed back so the sender's polling can match it
|
|
282
295
|
requestTimestamp: new Date(request.timestamp).getTime(),
|
|
@@ -343,7 +356,7 @@ export const FPEngine = {
|
|
|
343
356
|
},
|
|
344
357
|
|
|
345
358
|
showSend(amount: number, currency: string): void {
|
|
346
|
-
_emitEvent('show_send', {
|
|
359
|
+
_emitEvent('show_send', {amount, currency });
|
|
347
360
|
},
|
|
348
361
|
|
|
349
362
|
showReceive(amount?: number, currency?: string): void {
|
|
@@ -351,6 +364,7 @@ export const FPEngine = {
|
|
|
351
364
|
},
|
|
352
365
|
|
|
353
366
|
getUser: () => _user,
|
|
367
|
+
getAccount: () => _account,
|
|
354
368
|
isReady: () => _isReady,
|
|
355
369
|
getCallbacks: () => _callbacks,
|
|
356
370
|
|
|
@@ -363,6 +377,7 @@ export const FPEngine = {
|
|
|
363
377
|
_appStateSub?.remove();
|
|
364
378
|
_isReady = false;
|
|
365
379
|
_user = null;
|
|
380
|
+
_account = null;
|
|
366
381
|
_proximitySessionId = null;
|
|
367
382
|
_listeners.clear();
|
|
368
383
|
console.log('[FPay Engine] Destroyed');
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { useEffect } from 'react'
|
|
3
|
+
import type { AppStateStatus } from 'react-native'
|
|
4
|
+
import { AppState } from 'react-native'
|
|
5
|
+
|
|
6
|
+
export const useIsForeground = (): boolean => {
|
|
7
|
+
const [isForeground, setIsForeground] = useState(true)
|
|
8
|
+
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const onChange = (state: AppStateStatus): void => {
|
|
11
|
+
setIsForeground(state === 'active')
|
|
12
|
+
}
|
|
13
|
+
const listener = AppState.addEventListener('change', onChange)
|
|
14
|
+
return () => listener.remove()
|
|
15
|
+
}, [setIsForeground])
|
|
16
|
+
|
|
17
|
+
return isForeground
|
|
18
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
import { Animated, Easing } from "react-native";
|
|
3
|
+
import styled from "styled-components/native";
|
|
4
|
+
|
|
5
|
+
// Animated Dots Component
|
|
6
|
+
const DotsContainer = styled.View`
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
align-items: center;
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
const Dot = styled(Animated.View)<{ delay: number }>`
|
|
12
|
+
width: 8px;
|
|
13
|
+
height: 8px;
|
|
14
|
+
border-radius: 4px;
|
|
15
|
+
background-color: #0a3d2e;
|
|
16
|
+
margin: 0 4px;
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
export const AnimatedDots: React.FC = () => {
|
|
20
|
+
const dot1 = useRef(new Animated.Value(0)).current;
|
|
21
|
+
const dot2 = useRef(new Animated.Value(0)).current;
|
|
22
|
+
const dot3 = useRef(new Animated.Value(0)).current;
|
|
23
|
+
|
|
24
|
+
const AnimatedDot = Animated.createAnimatedComponent(Dot);
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const animateDot = (dot: Animated.Value, delay: number) => {
|
|
29
|
+
return Animated.loop(
|
|
30
|
+
Animated.sequence([
|
|
31
|
+
Animated.delay(delay),
|
|
32
|
+
Animated.timing(dot, {
|
|
33
|
+
toValue: 1,
|
|
34
|
+
duration: 400,
|
|
35
|
+
easing: Easing.ease,
|
|
36
|
+
useNativeDriver: true,
|
|
37
|
+
}),
|
|
38
|
+
Animated.timing(dot, {
|
|
39
|
+
toValue: 0,
|
|
40
|
+
duration: 400,
|
|
41
|
+
easing: Easing.ease,
|
|
42
|
+
useNativeDriver: true,
|
|
43
|
+
}),
|
|
44
|
+
])
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const animations = Animated.parallel([
|
|
49
|
+
animateDot(dot1, 0),
|
|
50
|
+
animateDot(dot2, 200),
|
|
51
|
+
animateDot(dot3, 400),
|
|
52
|
+
]);
|
|
53
|
+
|
|
54
|
+
animations.start();
|
|
55
|
+
|
|
56
|
+
return () => animations.stop();
|
|
57
|
+
}, []);
|
|
58
|
+
|
|
59
|
+
const dotStyle = (animValue: Animated.Value) => ({
|
|
60
|
+
opacity: animValue.interpolate({
|
|
61
|
+
inputRange: [0, 1],
|
|
62
|
+
outputRange: [0.3, 1],
|
|
63
|
+
}),
|
|
64
|
+
transform: [
|
|
65
|
+
{
|
|
66
|
+
scale: animValue.interpolate({
|
|
67
|
+
inputRange: [0, 1],
|
|
68
|
+
outputRange: [1, 1.3],
|
|
69
|
+
}),
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<DotsContainer>
|
|
76
|
+
<AnimatedDot style={dotStyle(dot1)} delay={0} />
|
|
77
|
+
<AnimatedDot style={dotStyle(dot2)} delay={200} />
|
|
78
|
+
<AnimatedDot style={dotStyle(dot3)} delay={400} />
|
|
79
|
+
</DotsContainer>
|
|
80
|
+
);
|
|
81
|
+
};
|