diff --git a/src/components/PublicNoncesRequest/PublicNoncesRequest.tsx b/src/components/PublicNoncesRequest/PublicNoncesRequest.tsx new file mode 100644 index 0000000..729ef14 --- /dev/null +++ b/src/components/PublicNoncesRequest/PublicNoncesRequest.tsx @@ -0,0 +1,109 @@ +import React, { useState } from 'react'; +import { View, Text, TouchableOpacity, ActivityIndicator } from 'react-native'; +import Icon from 'react-native-vector-icons/Feather'; +import { useTranslation } from 'react-i18next'; +import { useTheme } from '../../hooks'; +import Authentication from '../Authentication/Authentication'; + +const PublicNoncesRequest = (props: { + activityStatus: boolean; + actionStatus: (status: boolean) => void; +}) => { + // so we need our xpubkey, then generate address and show user the address. If not the same, tell user to restore or create wallet from scratch. + const { t } = useTranslation(['home', 'common']); + const { Fonts, Gutters, Layout, Colors, Common } = useTheme(); + const [authenticationOpen, setAuthenticationOpen] = useState(false); + + const approve = () => { + console.log('Approve'); + props.actionStatus(true); + }; + const openAuthentication = () => { + console.log('Open Authentication'); + setAuthenticationOpen(true); + }; + const reject = () => { + console.log('Reject'); + props.actionStatus(false); + }; + + const handleAuthenticationOpen = (status: boolean) => { + console.log(status); + console.log('authentication modal close.'); + setAuthenticationOpen(false); + if (status === true) { + approve(); + } + }; + + return ( + <> + + + + {t('home:public_nonces_request')} + + + {t('home:ssp_public_nonces_request')} + + + + openAuthentication()} + > + {(authenticationOpen || props.activityStatus) && ( + + )} + + {t('home:approve_request')} + + + reject()} + > + + {t('home:reject')} + + + + {authenticationOpen && ( + + )} + + ); +}; + +export default PublicNoncesRequest; diff --git a/src/components/PublicNoncesSuccess/PublicNoncesSuccess.tsx b/src/components/PublicNoncesSuccess/PublicNoncesSuccess.tsx new file mode 100644 index 0000000..ef508fd --- /dev/null +++ b/src/components/PublicNoncesSuccess/PublicNoncesSuccess.tsx @@ -0,0 +1,81 @@ +import React from 'react'; +import { View, Text, TouchableOpacity, Modal, ScrollView } from 'react-native'; +import Icon from 'react-native-vector-icons/Feather'; +import { useTranslation } from 'react-i18next'; +import { useTheme } from '../../hooks'; + +const PublicNoncesSuccess = (props: { + actionStatus: (status: boolean) => void; +}) => { + // so we need our xpubkey, then generate address and show user the address. If not the same, tell user to restore or create wallet from scratch. + const { t } = useTranslation(['home', 'common']); + const { Fonts, Gutters, Layout, Colors, Common } = useTheme(); + + const close = () => { + console.log('Close'); + props.actionStatus(false); + }; + + return ( + close()} + > + + + + + + {t('home:public_nonces_request_approved')} + + + {t('home:public_nonces_request_approved_info')} + + + + close()} + > + + {t('home:close')} + + + + + + + ); +}; + +export default PublicNoncesSuccess; diff --git a/src/screens/Home/Home.tsx b/src/screens/Home/Home.tsx index 3244ecd..971d373 100644 --- a/src/screens/Home/Home.tsx +++ b/src/screens/Home/Home.tsx @@ -20,6 +20,8 @@ import ManualInput from '../../components/ManualInput/ManualInput'; import MenuModal from '../../components/MenuModal/MenuModal'; import Scanner from '../../components/Scanner/Scanner'; import Navbar from '../../components/Navbar/Navbar'; +import PublicNoncesRequest from '../..//components/PublicNoncesRequest/PublicNoncesRequest'; +import PublicNoncesSuccess from '../../components/PublicNoncesSuccess/PublicNoncesSuccess'; import { getUniqueId } from 'react-native-device-info'; import EncryptedStorage from 'react-native-encrypted-storage'; import Toast from 'react-native-toast-message'; @@ -1113,16 +1115,13 @@ function Home({ navigation }: Props) { /> )} {publicNoncesReq && ( - )} {publicNoncesShared && ( - )} diff --git a/src/translations/resources/en/home.json b/src/translations/resources/en/home.json index 01447ac..330fb50 100644 --- a/src/translations/resources/en/home.json +++ b/src/translations/resources/en/home.json @@ -77,5 +77,10 @@ "selected_chain_wallet": "Selected Chain and Wallet", "chain_not_synced_scan": "Chain Not Synced with SSP Wallet. Scan SSP Wallet QR Code to Sync it.", "submitting_transaction": "Submitting Transaction...", - "err_generate_address": "Error while generating address." + "err_generate_address": "Error while generating address.", + "public_nonces_request": "Public Nonces Request", + "ssp_public_nonces_request": "SSP Wallet would like request Public Nonces. Public Nonces are used to construct blockchain transcations that use Schnorr signatures.", + "approve_request": "Approve Request", + "public_nonces_request_approved": "Public Nonces Synced!", + "public_nonces_request_approved_info": "Public Nonces were generated and sent for syncing with SSP Wallet." }