fix double email

This commit is contained in:
feruzm 2023-01-10 08:19:32 +05:30
parent 66299b27f0
commit 9c23176e70
4 changed files with 77 additions and 72 deletions

View File

@ -37,7 +37,7 @@ export const ActionPanel = ({
) : ( ) : (
<IconButton <IconButton
iconType="MaterialCommunityIcons" iconType="MaterialCommunityIcons"
name={'account-plus'} name="account-plus"
size={26} size={26}
color={EStyleSheet.value(followColor)} color={EStyleSheet.value(followColor)}
disabled={isFollowing || isLoading} disabled={isFollowing || isLoading}

View File

@ -87,7 +87,7 @@ export default EStyleSheet.create({
}, },
itemWrapper: { itemWrapper: {
flexDirection: 'row', flexDirection: 'row',
alignItems:'center', alignItems: 'center',
marginLeft: 55, marginLeft: 55,
}, },
versionText: { versionText: {

View File

@ -6,13 +6,13 @@ import { SafeAreaView } from 'react-native-safe-area-context';
import { useNavigation } from '@react-navigation/native'; import { useNavigation } from '@react-navigation/native';
import { ScrollView, TouchableOpacity } from 'react-native-gesture-handler'; import { ScrollView, TouchableOpacity } from 'react-native-gesture-handler';
import EStyleSheet from 'react-native-extended-stylesheet'; import EStyleSheet from 'react-native-extended-stylesheet';
import {openInbox} from "react-native-email-link";
import styles from '../styles/registerAccountModalStyles'; import styles from '../styles/registerAccountModalStyles';
import { InAppPurchaseContainer } from '../../../containers'; import { InAppPurchaseContainer } from '../../../containers';
import { Icon, MainButton, Modal, PostCardPlaceHolder } from '../../../components'; import { Icon, MainButton, Modal, PostCardPlaceHolder } from '../../../components';
import LOGO_ESTM from '../../../assets/esteemcoin_boost.png'; import LOGO_ESTM from '../../../assets/esteemcoin_boost.png';
import { signUp } from '../../../providers/ecency/ecency'; import { signUp } from '../../../providers/ecency/ecency';
import ROUTES from '../../../constants/routeNames'; import ROUTES from '../../../constants/routeNames';
import {openInbox} from "react-native-email-link";
type Props = { type Props = {
username: string; username: string;
@ -44,7 +44,7 @@ export const RegisterAccountModal = forwardRef(({ username, email, refUsername }
const _onContinuePress = () => { const _onContinuePress = () => {
navigation.navigate(ROUTES.DRAWER.MAIN); navigation.navigate(ROUTES.DRAWER.MAIN);
openInbox(); openInbox();
}; };
const _handleOnPressRegister = () => { const _handleOnPressRegister = () => {
@ -58,23 +58,21 @@ export const RegisterAccountModal = forwardRef(({ username, email, refUsername }
setIsRegistering(false); setIsRegistering(false);
}) })
.catch((err) => { .catch((err) => {
let title = intl.formatMessage({ id: 'alert.fail' }); let title = intl.formatMessage({ id: 'alert.fail' });
let body = intl.formatMessage({ id: 'alert.unknow_error' }); let body = intl.formatMessage({ id: 'alert.unknow_error' });
if (get(err, 'response.status') === 500) { if (get(err, 'response.status') === 500) {
title = intl.formatMessage({ id: 'alert.fail' });
title = intl.formatMessage({ id: 'alert.fail' }) body = intl.formatMessage({ id: 'register.500_error' });
body = intl.formatMessage({ id: 'register.500_error' })
} else if (get(err, 'response.data.message')) { } else if (get(err, 'response.data.message')) {
title = intl.formatMessage({ id: 'alert.fail' }); title = intl.formatMessage({ id: 'alert.fail' });
body = intl.formatMessage({ id: 'register.error_message' }, { message: err.response.data.message }); body = intl.formatMessage(
{ id: 'register.error_message' },
{ message: err.response.data.message },
);
} }
Alert.alert( Alert.alert(title, body);
title,
body
);
setIsRegistering(false); setIsRegistering(false);
}); });
}; };
@ -88,26 +86,30 @@ export const RegisterAccountModal = forwardRef(({ username, email, refUsername }
setIsRegistering(false); setIsRegistering(false);
}; };
const _renderIntermediateComponent = () => { const _renderIntermediateComponent = () => {
if (!isRegistering && !isRegistered) { if (!isRegistering && !isRegistered) {
return null; return null;
} }
const _textId = isRegistered ? 'register.registered' : 'register.registering' const _textId = isRegistered ? 'register.registered' : 'register.registering';
const _indicator = isRegistered ? const _indicator = isRegistered ? (
<Icon size={56} color={EStyleSheet.value("$primaryGreen")} name='check-circle' iconType='MaterialIcons' /> <Icon
: size={56}
<ActivityIndicator size="large" color={EStyleSheet.value('$primaryBlack')} />; color={EStyleSheet.value('$primaryGreen')}
name="check-circle"
iconType="MaterialIcons"
/>
) : (
<ActivityIndicator size="large" color={EStyleSheet.value('$primaryBlack')} />
);
const _action = isRegistered && const _action = isRegistered && (
<MainButton <MainButton
onPress={_onContinuePress} onPress={_onContinuePress}
text={intl.formatMessage({ id: 'alert.continue' })} text={intl.formatMessage({ id: 'alert.continue' })}
style={styles.actionButton} style={styles.actionButton}
/> />;
);
return ( return (
<View style={styles.registeringContainer}> <View style={styles.registeringContainer}>
@ -119,9 +121,9 @@ export const RegisterAccountModal = forwardRef(({ username, email, refUsername }
</Text> </Text>
{_action} {_action}
</View> </View>
) );
} };
const _renderUserInfo = (text: string, style: TextStyle) => ( const _renderUserInfo = (text: string, style: TextStyle) => (
<View style={styles.userInfoContainer}> <View style={styles.userInfoContainer}>
@ -156,34 +158,34 @@ export const RegisterAccountModal = forwardRef(({ username, email, refUsername }
}; };
const _renderRegisterOptions = ({ productList, buyItem }) => { const _renderRegisterOptions = ({ productList, buyItem }) => {
return ( return isRegistered || isRegistering ? (
isRegistered || isRegistering ? _renderIntermediateComponent() : ( _renderIntermediateComponent()
<ScrollView style={styles.productsWrapper}> ) : (
{!disableFree && <ScrollView style={styles.productsWrapper}>
_renderCard({ {!disableFree &&
titleId: 'free_account.title', _renderCard({
descriptionId: 'free_account.desc', titleId: 'free_account.title',
descriptionId: 'free_account.desc',
btnTitle: intl.formatMessage({ id: 'free_account.btn_register' }), btnTitle: intl.formatMessage({ id: 'free_account.btn_register' }),
onPress: _handleOnPressRegister, onPress: _handleOnPressRegister,
})} })}
{productList.map((product) => {productList.map((product) =>
_renderCard({ _renderCard({
titleId: 'buy_account.title', titleId: 'buy_account.title',
descriptionId: 'buy_account.desc', descriptionId: 'buy_account.desc',
btnTitle: intl.formatMessage( btnTitle: intl.formatMessage(
{ id: 'buy_account.btn_register' }, { id: 'buy_account.btn_register' },
{ price: product.localizedPrice }, { price: product.localizedPrice },
), ),
onPress: () => { onPress: () => {
setIsRegistering(true); setIsRegistering(true);
buyItem(product.productId); buyItem(product.productId);
}, },
}), }),
)} )}
</ScrollView> </ScrollView>
)
); );
}; };
@ -193,27 +195,30 @@ export const RegisterAccountModal = forwardRef(({ username, email, refUsername }
<View style={styles.headerContainer}> <View style={styles.headerContainer}>
<View> <View>
{_renderUserInfo(username, styles.usernameStyle)} {_renderUserInfo(username, styles.usernameStyle)}
{_renderUserInfo(email + email, styles.emailStyle)} {_renderUserInfo(email, styles.emailStyle)}
</View> </View>
<Image style={styles.logoEstm} source={LOGO_ESTM} /> <Image style={styles.logoEstm} source={LOGO_ESTM} />
</View> </View>
<InAppPurchaseContainer <InAppPurchaseContainer
skus={ITEM_SKUS} skus={ITEM_SKUS}
username={username} username={username}
email={email} email={email}
isNoSpin isNoSpin
handleOnPurchaseSuccess={_handleOnPurchaseSuccess} handleOnPurchaseSuccess={_handleOnPurchaseSuccess}
handleOnPurchaseFailure={_handleOnPurchaseFailure} handleOnPurchaseFailure={_handleOnPurchaseFailure}
> >
{({ buyItem, productList, isLoading }) => ( {({ buyItem, productList, isLoading }) => (
<SafeAreaView style={styles.container}> <SafeAreaView style={styles.container}>
{isLoading ? <PostCardPlaceHolder /> : _renderRegisterOptions({ productList, buyItem })} {isLoading ? (
</SafeAreaView> <PostCardPlaceHolder />
)} ) : (
</InAppPurchaseContainer> _renderRegisterOptions({ productList, buyItem })
</View> )}
); </SafeAreaView>
)}
</InAppPurchaseContainer>
</View>
);
}; };
return ( return (

View File

@ -129,8 +129,8 @@ const RegisterScreen = ({ navigation, route }) => {
const _onContinuePress = () => { const _onContinuePress = () => {
Keyboard.dismiss(); Keyboard.dismiss();
registerAccountModalRef.current?.showModal() registerAccountModalRef.current?.showModal();
} };
return ( return (
<SafeAreaView style={styles.container}> <SafeAreaView style={styles.container}>
@ -236,7 +236,7 @@ const RegisterScreen = ({ navigation, route }) => {
iconName="arrow-forward" iconName="arrow-forward"
iconColor="white" iconColor="white"
iconPosition="right" iconPosition="right"
text={intl.formatMessage({id:'alert.continue'})} text={intl.formatMessage({ id: 'alert.continue' })}
isDisable={!isUsernameValid || !isRefUsernameValid || !isEmailValid} isDisable={!isUsernameValid || !isRefUsernameValid || !isEmailValid}
style={styles.mainButton} style={styles.mainButton}
/> />