-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
public nonces request, public nonces success
- Loading branch information
Showing
4 changed files
with
200 additions
and
6 deletions.
There are no files selected for viewing
109 changes: 109 additions & 0 deletions
109
src/components/PublicNoncesRequest/PublicNoncesRequest.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<> | ||
<View | ||
style={[ | ||
Layout.fill, | ||
Layout.relative, | ||
Layout.fullWidth, | ||
Layout.justifyContentCenter, | ||
Layout.alignItemsCenter, | ||
]} | ||
> | ||
<Icon name="link" size={60} color={Colors.textGray400} /> | ||
<Text style={[Fonts.textBold, Fonts.textRegular, Gutters.smallMargin]}> | ||
{t('home:public_nonces_request')} | ||
</Text> | ||
<Text | ||
style={[ | ||
Fonts.textSmall, | ||
Fonts.textCenter, | ||
Gutters.smallLMargin, | ||
Gutters.smallRMargin, | ||
]} | ||
> | ||
{t('home:ssp_public_nonces_request')} | ||
</Text> | ||
</View> | ||
<View style={[Layout.justifyContentEnd]}> | ||
<TouchableOpacity | ||
style={[ | ||
Common.button.rounded, | ||
Common.button.bluePrimary, | ||
Gutters.regularBMargin, | ||
Gutters.smallTMargin, | ||
]} | ||
disabled={authenticationOpen || props.activityStatus} | ||
onPressIn={() => openAuthentication()} | ||
> | ||
{(authenticationOpen || props.activityStatus) && ( | ||
<ActivityIndicator | ||
size={'large'} | ||
style={[{ position: 'absolute' }]} | ||
/> | ||
)} | ||
<Text style={[Fonts.textRegular, Fonts.textWhite]}> | ||
{t('home:approve_request')} | ||
</Text> | ||
</TouchableOpacity> | ||
<TouchableOpacity | ||
disabled={authenticationOpen || props.activityStatus} | ||
onPressIn={() => reject()} | ||
> | ||
<Text | ||
style={[ | ||
Fonts.textSmall, | ||
Fonts.textBluePrimary, | ||
Gutters.regularBMargin, | ||
Fonts.textCenter, | ||
]} | ||
> | ||
{t('home:reject')} | ||
</Text> | ||
</TouchableOpacity> | ||
</View> | ||
{authenticationOpen && ( | ||
<Authentication actionStatus={handleAuthenticationOpen} type="sync" /> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default PublicNoncesRequest; |
81 changes: 81 additions & 0 deletions
81
src/components/PublicNoncesSuccess/PublicNoncesSuccess.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<Modal | ||
animationType="fade" | ||
transparent={true} | ||
visible={true} | ||
onRequestClose={() => close()} | ||
> | ||
<ScrollView | ||
keyboardShouldPersistTaps="always" | ||
style={[Layout.fill, Common.modalBackdrop]} | ||
contentInset={{ bottom: 80 }} | ||
contentContainerStyle={[ | ||
Gutters.smallBPadding, | ||
Layout.scrollSpaceBetween, | ||
]} | ||
> | ||
<View style={[Layout.fill, Common.modalView]}> | ||
<View | ||
style={[ | ||
Layout.fill, | ||
Layout.relative, | ||
Layout.fullWidth, | ||
Layout.justifyContentCenter, | ||
Layout.alignItemsCenter, | ||
]} | ||
> | ||
<Icon name="check-circle" size={60} color={Colors.textGray400} /> | ||
<Text | ||
style={[ | ||
Fonts.textBold, | ||
Fonts.textRegular, | ||
Gutters.smallMargin, | ||
Fonts.textCenter, | ||
]} | ||
> | ||
{t('home:public_nonces_request_approved')} | ||
</Text> | ||
<Text style={[Fonts.textTiny, Fonts.textCenter]}> | ||
{t('home:public_nonces_request_approved_info')} | ||
</Text> | ||
</View> | ||
<View style={[Layout.justifyContentEnd]}> | ||
<TouchableOpacity | ||
style={[ | ||
Common.button.rounded, | ||
Common.button.bluePrimary, | ||
Gutters.regularBMargin, | ||
Gutters.smallTMargin, | ||
]} | ||
onPress={() => close()} | ||
> | ||
<Text style={[Fonts.textRegular, Fonts.textWhite]}> | ||
{t('home:close')} | ||
</Text> | ||
</TouchableOpacity> | ||
</View> | ||
</View> | ||
</ScrollView> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default PublicNoncesSuccess; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters