Commit e86c175a by Nguyễn Thị Thúy

update check setting smart otp

parent af55d763
......@@ -132,8 +132,8 @@ android {
applicationId "com.dcv.invest"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 15
versionName "1.9"
versionCode 16
versionName "2.0"
vectorDrawables.useSupportLibrary = true
}
splits {
......
......@@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"properties": [],
"versionCode": 15,
"versionName": "1.9",
"versionCode": 16,
"versionName": "2.0",
"enabled": true,
"outputFile": "app-release.apk"
}
......
......@@ -903,7 +903,7 @@
CODE_SIGN_ENTITLEMENTS = Invest/Invest.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5;
CURRENT_PROJECT_VERSION = 7;
DEVELOPMENT_TEAM = MXZ24GRH48;
ENABLE_BITCODE = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
......@@ -912,7 +912,7 @@
);
INFOPLIST_FILE = Invest/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 2.0;
MARKETING_VERSION = 2.2;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
......@@ -937,11 +937,11 @@
CODE_SIGN_ENTITLEMENTS = Invest/Invest.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5;
CURRENT_PROJECT_VERSION = 7;
DEVELOPMENT_TEAM = MXZ24GRH48;
INFOPLIST_FILE = Invest/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 2.0;
MARKETING_VERSION = 2.2;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
......
import React, {useState} from 'react';
import {
Dimensions,
Keyboard,
KeyboardAvoidingView,
Platform,
ScrollView,
StyleSheet,
Text,
TouchableOpacity,
TouchableWithoutFeedback,
View,
DeviceEventEmitter,
Dimensions,
Keyboard,
KeyboardAvoidingView,
Platform,
ScrollView,
StyleSheet,
Text,
TouchableOpacity,
TouchableWithoutFeedback,
View,
} from 'react-native';
import R from '../../../assets/R';
import HeaderBack from '../../../components/Header/HeaderBack';
......@@ -20,164 +21,183 @@ import {connect} from 'react-redux';
import {hideLoading, showLoading} from '../../../actions/loadingAction';
import TextMoney from '../../../components/Input/InputMoney';
import I18n from '../../../helper/i18/i18n';
import {ENTER_PASSWORD_SMART_OTP, SMARTOTP} from '../../../routers/ScreenNames';
import {ENTER_PASSWORD_SMART_OTP, SETTINGOTP, SMARTOTP} from '../../../routers/ScreenNames';
import {showAlert, TYPE} from '../../../components/DropdownAlert';
const {width} = Dimensions.get('window');
import {confirmAlert} from '../../../components/Aleart';
const WalletDeposit = (props) => {
const [amount, setAmount] = useState();
const [notes, setNotes] = useState();
const navigate = useNavigation();
const [amount, setAmount] = useState();
const [notes, setNotes] = useState();
const navigate = useNavigation();
const onClick = async () => {
const titles = [
I18n.t('AmountOfMoney').toLowerCase(),
I18n.t('Note').toLowerCase(),
];
const onClick = async () => {
const titles = [
I18n.t('AmountOfMoney').toLowerCase(),
I18n.t('Note').toLowerCase(),
];
const index = checkFormatArray([amount]);
if (index === true) {
navigate.navigate(ENTER_PASSWORD_SMART_OTP, {
onGoToSmartOTP: (pinCode, otp) => onGoToSmartOTP(pinCode, otp)
});
} else {
showAlert(
TYPE.WARN,
I18n.t('Notification'),
I18n.t('Please_fill_in') + titles[index],
);
}
};
const onGoToSmartOTP = (pinCode, otp) => {
navigate.goBack()
navigate.navigate(SMARTOTP, {
type: 'DEPOSIT',
amount,
notes,
pinCode,
otp,
});
}
return (
<KeyboardAvoidingView
behavior={Platform.Os === 'ios' ? 'padding' : 'height'}
style={{flex: 1, backgroundColor: 'white'}}
keyboardVerticalOffset={-50}>
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
<View style={{flex: 1}}>
<HeaderBack title={'InvestmentDeposit'} />
<ScrollView showsVerticalScrollIndicator={false}>
<View style={styles.container}>
<View style={styles.wrapTop}>
<View style={styles.itemTop}>
<Text style={styles.txtTitle}>{I18n.t('Wallet')}</Text>
<Text style={styles.txtMoney}>
{' '}
{props.user.current_money != 0
? toPriceVnd(props.user.current_money)
: 0}{' '}
</Text>
</View>
<View style={{width: 1, backgroundColor: '#DBDBDB'}} />
<View style={styles.itemTop}>
<Text style={styles.txtTitle}>CQG</Text>
<Text style={styles.txtMoney}>
{' '}
{props.user.current_cqg_money != 0
? toPriceVnd(props.user.current_cqg_money)
: 0}{' '}
đ
</Text>
const index = checkFormatArray([amount]);
if (index === true) {
if (!props.user.smart_otp_status) {
confirmAlert(
`${I18n.t('YouHaveNotSettingSmartOTP')}`,
() => {
navigate.navigate(SETTINGOTP, {
isFromTransaction: true,
setupSmartOTPSuccess: () => {
navigate.goBack()
navigate.goBack()
navigate.navigate(ENTER_PASSWORD_SMART_OTP, {
onGoToSmartOTP: (pinCode, otp) => onGoToSmartOTP(pinCode, otp),
});
DeviceEventEmitter.emit('reloadUserInfo');
},
});
},
`${I18n.t('setting')}`,
);
} else {
navigate.navigate(ENTER_PASSWORD_SMART_OTP, {
onGoToSmartOTP: (pinCode, otp) => onGoToSmartOTP(pinCode, otp),
});
}
} else {
showAlert(
TYPE.WARN,
I18n.t('Notification'),
I18n.t('Please_fill_in') + titles[index],
);
}
};
const onGoToSmartOTP = (pinCode, otp) => {
navigate.goBack();
navigate.navigate(SMARTOTP, {
type: 'DEPOSIT',
amount,
notes,
pinCode,
otp,
});
};
return (
<KeyboardAvoidingView
behavior={Platform.Os === 'ios' ? 'padding' : 'height'}
style={{flex: 1, backgroundColor: 'white'}}
keyboardVerticalOffset={-50}>
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
<View style={{flex: 1}}>
<HeaderBack title={'InvestmentDeposit'}/>
<ScrollView showsVerticalScrollIndicator={false}>
<View style={styles.container}>
<View style={styles.wrapTop}>
<View style={styles.itemTop}>
<Text style={styles.txtTitle}>{I18n.t('Wallet')}</Text>
<Text style={styles.txtMoney}>
{' '}
{props.user.current_money != 0
? toPriceVnd(props.user.current_money)
: 0}{' '}
</Text>
</View>
<View style={{width: 1, backgroundColor: '#DBDBDB'}}/>
<View style={styles.itemTop}>
<Text style={styles.txtTitle}>CQG</Text>
<Text style={styles.txtMoney}>
{' '}
{props.user.current_cqg_money != 0
? toPriceVnd(props.user.current_cqg_money)
: 0}{' '}
đ
</Text>
</View>
</View>
<View style={styles.wrapBody}>
{/* <TextDisable value={'10010101'} title={'Số tài khoản CQG'} /> */}
<TextMoney
onChangeText={(val) => setAmount(val)}
title={I18n.t('AmountOfMoney')}
value={amount}
/>
<TextMulti
onChangeText={(val) => setNotes(val)}
title={I18n.t('Note')}
placeholder={I18n.t('noteWithdrawMoney')}
/>
</View>
</View>
</ScrollView>
<View
style={{
paddingVertical: 10,
justifyContent: 'center',
alignItems: 'center',
}}>
<TouchableOpacity onPress={onClick} style={styles.btnSend}>
<Text style={styles.txtSend}>{I18n.t('Deposit')}</Text>
</TouchableOpacity>
</View>
</View>
</View>
<View style={styles.wrapBody}>
{/* <TextDisable value={'10010101'} title={'Số tài khoản CQG'} /> */}
<TextMoney
onChangeText={(val) => setAmount(val)}
title={I18n.t('AmountOfMoney')}
value={amount}
/>
<TextMulti
onChangeText={(val) => setNotes(val)}
title={I18n.t('Note')}
placeholder={I18n.t('noteWithdrawMoney')}
/>
</View>
</View>
</ScrollView>
<View
style={{
paddingVertical: 10,
justifyContent: 'center',
alignItems: 'center',
}}>
<TouchableOpacity onPress={onClick} style={styles.btnSend}>
<Text style={styles.txtSend}>{I18n.t('Deposit')}</Text>
</TouchableOpacity>
</View>
</View>
</TouchableWithoutFeedback>
</KeyboardAvoidingView>
);
</TouchableWithoutFeedback>
</KeyboardAvoidingView>
);
};
const styles = StyleSheet.create({
container: {
backgroundColor: R.colors.white,
marginVertical: 10,
shadowColor: '#AFA9A9',
shadowOffset: {
width: 0,
height: 1,
container: {
backgroundColor: R.colors.white,
marginVertical: 10,
shadowColor: '#AFA9A9',
shadowOffset: {
width: 0,
height: 1,
},
shadowOpacity: 0.25,
shadowRadius: 1.84,
elevation: 1,
},
wrapTop: {
flexDirection: 'row',
borderBottomWidth: 1,
borderBottomColor: '#DBDBDB',
},
itemTop: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
paddingVertical: 20,
},
wrapBody: {
paddingHorizontal: 10,
paddingVertical: 20,
},
txtMoney: {
color: '#1C6AF6',
fontSize: getFontXD(52),
},
txtTitle: {
color: R.colors.black,
fontSize: getFontXD(42),
},
txtSend: {
fontSize: getFontXD(42),
color: R.colors.white,
fontWeight: 'bold',
},
btnSend: {
width: WIDTHXD(400),
height: HEIGHTXD(100),
backgroundColor: R.colors.main,
borderRadius: 10,
justifyContent: 'center',
alignItems: 'center',
},
shadowOpacity: 0.25,
shadowRadius: 1.84,
elevation: 1,
},
wrapTop: {
flexDirection: 'row',
borderBottomWidth: 1,
borderBottomColor: '#DBDBDB',
},
itemTop: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
paddingVertical: 20,
},
wrapBody: {
paddingHorizontal: 10,
paddingVertical: 20,
},
txtMoney: {
color: '#1C6AF6',
fontSize: getFontXD(52),
},
txtTitle: {
color: R.colors.black,
fontSize: getFontXD(42),
},
txtSend: {
fontSize: getFontXD(42),
color: R.colors.white,
fontWeight: 'bold',
},
btnSend: {
width: WIDTHXD(400),
height: HEIGHTXD(100),
backgroundColor: R.colors.main,
borderRadius: 10,
justifyContent: 'center',
alignItems: 'center',
},
});
const mapStateToProps = (state) => {
return {
user: state.userReducer,
};
return {
user: state.userReducer,
};
};
export default connect(mapStateToProps, {showLoading, hideLoading})(
WalletDeposit,
WalletDeposit,
);
......@@ -10,7 +10,7 @@ import {
TouchableWithoutFeedback,
Keyboard,
KeyboardAvoidingView,
ScrollView,
ScrollView, DeviceEventEmitter,
} from 'react-native';
import R from '../../../assets/R';
import HeaderBack from '../../../components/Header/HeaderBack';
......@@ -30,14 +30,15 @@ import RadioForm from 'react-native-simple-radio-button';
import {widthDraw, getListWidthDraw} from '../../../apis/Functions/Widthdraw';
import {useNavigation} from '@react-navigation/native';
import {showLoading, hideLoading} from '../../../actions/loadingAction';
import {saveUserToRedux} from '../../../actions/users';
import {confirmAlert} from '../../../components/Aleart';
import {
ADDMETHODPAY,
ENTER_PASSWORD_SMART_OTP,
ENTER_PASSWORD_SMART_OTP, SETTINGOTP,
} from '../../../routers/ScreenNames';
import TextMoney from '../../../components/Input/InputMoney';
import I18n from '../../../helper/i18/i18n';
import {getOTPApi} from '../../../apis/Functions/users';
import {getDetailUser, getOTPApi} from '../../../apis/Functions/users';
import {SMARTOTP} from '../../../routers/ScreenNames';
import {showAlert, TYPE} from '../../../components/DropdownAlert';
var radio_props = [
......@@ -117,9 +118,29 @@ const WalletWithdraw = (props) => {
I18n.t('WarnMaxReqestWithdraw'),
);
} else {
navigate.navigate(ENTER_PASSWORD_SMART_OTP, {
onGoToSmartOTP: (pinCode, otp) => onGoToSmartOTP(pinCode, otp),
});
if (!props.user.smart_otp_status) {
confirmAlert(
`${I18n.t('YouHaveNotSettingSmartOTP')}`,
() => {
navigate.navigate(SETTINGOTP, {
isFromTransaction: true,
setupSmartOTPSuccess: () => {
navigate.goBack()
navigate.goBack()
navigate.navigate(ENTER_PASSWORD_SMART_OTP, {
onGoToSmartOTP: (pinCode, otp) => onGoToSmartOTP(pinCode, otp),
});
DeviceEventEmitter.emit('reloadUserInfo');
},
});
},
`${I18n.t('setting')}`,
);
} else {
navigate.navigate(ENTER_PASSWORD_SMART_OTP, {
onGoToSmartOTP: (pinCode, otp) => onGoToSmartOTP(pinCode, otp),
});
}
}
} else {
showAlert(
......@@ -317,4 +338,5 @@ const mapStateToProps = (state) => {
export default connect(mapStateToProps, {
showLoading,
hideLoading,
saveUserToRedux
})(WalletWithdraw);
import React, {useEffect, useState} from 'react';
import {Alert, Platform, View} from 'react-native';
import {Alert, DeviceEventEmitter, Platform, View} from 'react-native';
import {connect} from 'react-redux';
import {getTransaction} from '../../apis/Functions/users';
import {getImagesHome} from '../../apis/Functions/General';
......@@ -14,6 +14,7 @@ import {showAlert, TYPE} from '../../components/DropdownAlert/index';
import VersionChecker from '../VersionChecker';
import {saveUserToRedux} from '../../actions/users';
import {getDetailUser} from '../../apis/Functions/users';
import {logout} from '../../Config/Functions';
const Home = (props) => {
const [data, setData] = useState({total_deposit: 0, total_withdraw: 0});
......@@ -52,6 +53,13 @@ const Home = (props) => {
useEffect(() => {
getData();
initSocket();
let reloadUserInfoListener = DeviceEventEmitter.addListener('reloadUserInfo', (e) => {
console.log('run in to reloadUserInfo');
onRefresh();
});
return () => {
reloadUserInfoListener.remove();
};
}, []);
useEffect(() => {
......
import React, {Component, useEffect, useState} from 'react';
import React, {useState} from 'react';
import {
View,
Text,
TextInput,
StyleSheet,
TouchableOpacity,
Platform,
Alert,
} from 'react-native';
import HeaderBack from '../../components/Header/HeaderBack';
......@@ -19,7 +17,6 @@ import {
import {getFontXD, HEIGHTXD, WIDTHXD} from '../../Config/Functions';
import R from '../../assets/R';
import {TABNAVIGATOR} from '../../routers/ScreenNames';
import {verifyOTPApi} from '../../apis/Functions/users';
import {useNavigation} from '@react-navigation/native';
import I18n from '../../helper/i18/i18n';
import AppText from '../../components/AppText';
......@@ -29,12 +26,11 @@ import {connect} from 'react-redux';
import {showAlert, TYPE} from '../../components/DropdownAlert';
import CountDown from '../../components/CountDown';
import {
verifyOTPApiSmart,
getOTPApi,
verifyStoreOTPApiSmart,
getOTPApiSmartOTP,
} from '../../apis/Functions/users';
const CELL_COUNT = 4;
const ConfirmOTPSmart = (propsa) => {
......@@ -82,7 +78,11 @@ const ConfirmOTPSmart = (propsa) => {
showAlert(TYPE.SUCCESS, I18n.t('Notification'), res.data.message);
propsa.hideLoading();
if (res.data.code == 200) {
navigate.navigate(TABNAVIGATOR);
if (propsa.route.params.isFromTransaction) {
propsa.route.params.setupSmartOTPSuccess();
} else {
navigate.navigate(TABNAVIGATOR);
}
} else {
showAlert(TYPE.ERROR, I18n.t('Notification'), res.data.message);
}
......
......@@ -47,6 +47,8 @@ const SettingOTP = (props) => {
navigatiton.navigate(CONFIRMOTPSMART, {
password,
password_confirmation,
isFromTransaction: props.route.params.isFromTransaction,
setupSmartOTPSuccess: props.route.params.setupSmartOTPSuccess
});
} else {
showAlert(TYPE.ERROR, I18n.t('Notification'), res.data.message);
......
......@@ -2,25 +2,25 @@ import {Alert} from 'react-native';
import I18n from '../helper/i18/i18n';
export const NotificationAlert = (string) => {
Alert.alert(I18n.t('Notification'), string);
Alert.alert(I18n.t('Notification'), string);
};
export const confirmAlert = (content, callback) => {
Alert.alert(
I18n.t('Notification'),
content,
[
{
text: I18n.t('Cancel'),
style: 'cancel',
},
{
text: I18n.t('Ok'),
onPress: () => {
callback();
},
},
],
{cancelable: false},
);
export const confirmAlert = (content, callback, positiveTitle) => {
Alert.alert(
I18n.t('Notification'),
content,
[
{
text: I18n.t('Cancel'),
style: 'cancel',
},
{
text: positiveTitle ? positiveTitle : I18n.t('Ok'),
onPress: () => {
callback();
},
},
],
{cancelable: false},
);
};
......@@ -326,4 +326,5 @@ export default {
ResetSmartOTP2: ' press 3 to meet technical support staff.',
ForgotSmartOTP: 'Forgot Smart OTP',
WarnMaxReqestWithdraw: 'Invalid withdrawal amount',
YouHaveNotSettingSmartOTP: 'You have not installed Smart OTP',
};
......@@ -323,4 +323,5 @@ export default {
'Để đảm bảo an toàn trong quá trình sử dụng ứng dụng, bạn vui lòng liên hệ đến tổng đài: ',
ResetSmartOTP2: ' bấm phím 3 để gặp nhân viên hỗ trợ kỹ thuật.',
ForgotSmartOTP: 'Quên Smart OTP',
YouHaveNotSettingSmartOTP: 'Bạn chưa cài đặt Smart OTP',
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment