Commit bd1a3c70 by Giang Tran

fix bug language

parent 0f249e58
...@@ -132,8 +132,8 @@ android { ...@@ -132,8 +132,8 @@ android {
applicationId "com.dcv.invest" applicationId "com.dcv.invest"
minSdkVersion rootProject.ext.minSdkVersion minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 2 versionCode 11
versionName "1.4" versionName "1.5"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
} }
splits { splits {
......
...@@ -903,7 +903,7 @@ ...@@ -903,7 +903,7 @@
CODE_SIGN_ENTITLEMENTS = Invest/Invest.entitlements; CODE_SIGN_ENTITLEMENTS = Invest/Invest.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2; CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = MXZ24GRH48; DEVELOPMENT_TEAM = MXZ24GRH48;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (
...@@ -912,7 +912,7 @@ ...@@ -912,7 +912,7 @@
); );
INFOPLIST_FILE = Invest/Info.plist; INFOPLIST_FILE = Invest/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 2.0; MARKETING_VERSION = 2.1;
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
"$(inherited)", "$(inherited)",
"-ObjC", "-ObjC",
...@@ -937,11 +937,11 @@ ...@@ -937,11 +937,11 @@
CODE_SIGN_ENTITLEMENTS = Invest/Invest.entitlements; CODE_SIGN_ENTITLEMENTS = Invest/Invest.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2; CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = MXZ24GRH48; DEVELOPMENT_TEAM = MXZ24GRH48;
INFOPLIST_FILE = Invest/Info.plist; INFOPLIST_FILE = Invest/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 2.0; MARKETING_VERSION = 2.1;
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
"$(inherited)", "$(inherited)",
"-ObjC", "-ObjC",
......
...@@ -38,8 +38,13 @@ import {getOTPApi} from '../../../apis/Functions/users'; ...@@ -38,8 +38,13 @@ import {getOTPApi} from '../../../apis/Functions/users';
import {OTPWALLET} from '../../../routers/ScreenNames'; import {OTPWALLET} from '../../../routers/ScreenNames';
import {showAlert, TYPE} from '../../../components/DropdownAlert'; import {showAlert, TYPE} from '../../../components/DropdownAlert';
var radio_props = [ var radio_props = [
{label: I18n.t('FromWallet'), value: 'WALLET'}, {label: 'Từ ví', value: 'WALLET'},
{label: I18n.t('FromCQGAccount'), value: 'INVESTMENT'}, {label: 'Từ tài khoản CQG', value: 'INVESTMENT'},
];
var radio_propsEN = [
{label: 'From wallet', value: 'WALLET'},
{label: 'From CQG Account', value: 'INVESTMENT'},
]; ];
const {width} = Dimensions.get('window'); const {width} = Dimensions.get('window');
...@@ -161,7 +166,11 @@ const WalletWithdraw = (props) => { ...@@ -161,7 +166,11 @@ const WalletWithdraw = (props) => {
</Text> </Text>
{/* <View style={styles.row}> */} {/* <View style={styles.row}> */}
<RadioForm <RadioForm
radio_props={radio_props} radio_props={
props.language.language == 'vi'
? radio_props
: radio_propsEN
}
labelStyle={{fontSize: getFontXD(42)}} labelStyle={{fontSize: getFontXD(42)}}
formHorizontal={true} formHorizontal={true}
style={styles.row} style={styles.row}
...@@ -273,6 +282,7 @@ const styles = StyleSheet.create({ ...@@ -273,6 +282,7 @@ const styles = StyleSheet.create({
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
user: state.userReducer, user: state.userReducer,
language: state.languageReducer,
}; };
}; };
export default connect(mapStateToProps, { export default connect(mapStateToProps, {
......
...@@ -5,14 +5,19 @@ import HeaderBack from '../../components/Header/HeaderBack'; ...@@ -5,14 +5,19 @@ import HeaderBack from '../../components/Header/HeaderBack';
import PickerItem from '../../components/Picker/PickerItem'; import PickerItem from '../../components/Picker/PickerItem';
import I18n from '../../helper/i18/i18n'; import I18n from '../../helper/i18/i18n';
import AppText from '../../components/AppText'; import AppText from '../../components/AppText';
import {floatToPriceVnd, getFontXD, HEIGHTXD, toPriceVnd, WIDTHXD} from '../../Config/Functions'; import {
floatToPriceVnd,
getFontXD,
HEIGHTXD,
toPriceVnd,
WIDTHXD,
} from '../../Config/Functions';
import R from '../../assets/R'; import R from '../../assets/R';
import {getUnitList} from '../../apis/Functions/Transaction'; import {getUnitList} from '../../apis/Functions/Transaction';
import {showAlert, TYPE} from '../../components/DropdownAlert'; import {showAlert, TYPE} from '../../components/DropdownAlert';
import {hideLoading, showLoading} from '../../actions/loadingAction'; import {hideLoading, showLoading} from '../../actions/loadingAction';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
const ConvertUnit = (props) => { const ConvertUnit = (props) => {
const [fromUnitList, setFromUnitList] = useState([]); const [fromUnitList, setFromUnitList] = useState([]);
const [toUnitList, setToUnitList] = useState([]); const [toUnitList, setToUnitList] = useState([]);
...@@ -41,7 +46,7 @@ const ConvertUnit = (props) => { ...@@ -41,7 +46,7 @@ const ConvertUnit = (props) => {
if (res.status == 200 && res.data.code == 200) { if (res.status == 200 && res.data.code == 200) {
setFromUnitList(res.data.data); setFromUnitList(res.data.data);
setFromUnit(res.data.data[0]); setFromUnit(res.data.data[0]);
onChangeFromUnit('', res.data.data[0]) onChangeFromUnit('', res.data.data[0]);
} else { } else {
showAlert(TYPE.ERROR, I18n.t('Notification'), I18n.t('Can_not_get_data')); showAlert(TYPE.ERROR, I18n.t('Notification'), I18n.t('Can_not_get_data'));
} }
...@@ -51,7 +56,6 @@ const ConvertUnit = (props) => { ...@@ -51,7 +56,6 @@ const ConvertUnit = (props) => {
const onChangeNumber = (string) => { const onChangeNumber = (string) => {
let number = string.toString().split(',').join(''); let number = string.toString().split(',').join('');
setNumber(number); setNumber(number);
}; };
const onChangeFromUnit = (value, item) => { const onChangeFromUnit = (value, item) => {
...@@ -76,17 +80,21 @@ const ConvertUnit = (props) => { ...@@ -76,17 +80,21 @@ const ConvertUnit = (props) => {
const calcultorResult = () => { const calcultorResult = () => {
if (number && number != '' && parseFloat(number) > 0) { if (number && number != '' && parseFloat(number) > 0) {
let result = parseFloat(number) * toUnit.rate; let result = parseFloat(number) * toUnit.rate;
setResult(`${floatToPriceVnd(number.toString())} ${fromUnit.name} = ${floatToPriceVnd(result.toString())} ${toUnit.name}`); setResult(
`${floatToPriceVnd(number.toString())} ${
fromUnit.name
} = ${floatToPriceVnd(result.toString())} ${toUnit.name}`,
);
} else { } else {
setResult('') setResult('');
} }
}; };
return ( return (
<View style={{flex: 1}}> <View style={{flex: 1}}>
<HeaderBack title={'ConvertUnit'}/> <HeaderBack title={'ConvertUnit'} />
<View style={{flex: 1, paddingTop: 20, paddingHorizontal: 20}}> <View style={{flex: 1, paddingTop: 20, paddingHorizontal: 20}}>
<AppText style={styles.txtTitle} i18nKey={'Count'}/> <AppText style={styles.txtTitle} i18nKey={'Count'} />
<View style={styles.Item}> <View style={styles.Item}>
<View style={styles.wrap}> <View style={styles.wrap}>
<TextInput <TextInput
...@@ -184,6 +192,7 @@ const styles = StyleSheet.create({ ...@@ -184,6 +192,7 @@ const styles = StyleSheet.create({
shadowOpacity: 0.2, shadowOpacity: 0.2,
shadowRadius: 1.41, shadowRadius: 1.41,
elevation: 2, elevation: 2,
color: R.colors.black,
}, },
wrap: { wrap: {
flexDirection: 'row', flexDirection: 'row',
...@@ -213,4 +222,3 @@ export default connect(mapStateToProps, { ...@@ -213,4 +222,3 @@ export default connect(mapStateToProps, {
showLoading, showLoading,
hideLoading, hideLoading,
})(ConvertUnit); })(ConvertUnit);
...@@ -56,6 +56,11 @@ const ExchangeRate = (props) => { ...@@ -56,6 +56,11 @@ const ExchangeRate = (props) => {
} else if (!priceExchange) setUsdTan(''); } else if (!priceExchange) setUsdTan('');
}; };
const onClick = () => {
setPriceExchange('');
setUsdTan('');
};
return ( return (
<View style={{flex: 1}}> <View style={{flex: 1}}>
<HeaderBack title={'ExchangeRate'} /> <HeaderBack title={'ExchangeRate'} />
...@@ -76,6 +81,7 @@ const ExchangeRate = (props) => { ...@@ -76,6 +81,7 @@ const ExchangeRate = (props) => {
<TextField <TextField
isNumber={true} isNumber={true}
maxLength={12} maxLength={12}
value={priceExchange}
onChangeText={(val) => setPriceExchange(val)} onChangeText={(val) => setPriceExchange(val)}
title={I18n.t('ConversionPrice')} title={I18n.t('ConversionPrice')}
/> />
...@@ -85,7 +91,7 @@ const ExchangeRate = (props) => { ...@@ -85,7 +91,7 @@ const ExchangeRate = (props) => {
title={I18n.t('ConvertUSD')} title={I18n.t('ConvertUSD')}
/> />
<View style={styles.footer}> <View style={styles.footer}>
<TouchableOpacity style={styles.btnContainer}> <TouchableOpacity onPress={onClick} style={styles.btnContainer}>
<AppText style={styles.txtBtn} i18nKey={'Delete'} /> <AppText style={styles.txtBtn} i18nKey={'Delete'} />
</TouchableOpacity> </TouchableOpacity>
</View> </View>
......
...@@ -7,14 +7,22 @@ import { ...@@ -7,14 +7,22 @@ import {
StyleSheet, StyleSheet,
Image, Image,
TouchableWithoutFeedback, TouchableWithoutFeedback,
Linking, Platform, Linking,
Platform,
} from 'react-native'; } from 'react-native';
import R from '../../assets/R'; import R from '../../assets/R';
import {getFontXD, getHeight, getWidth, HEIGHTXD, WIDTHXD} from '../../Config/Functions'; import {
getFontXD,
getHeight,
getWidth,
HEIGHTXD,
WIDTHXD,
} from '../../Config/Functions';
import I18n from '../../helper/i18/i18n'; import I18n from '../../helper/i18/i18n';
import DeviceInfo from 'react-native-device-info'; import DeviceInfo from 'react-native-device-info';
import {getNewestVersionInfo} from '../../apis/Functions/users'; import {getNewestVersionInfo} from '../../apis/Functions/users';
import InAppUpdate from '../../helper/InAppUpdate'; import InAppUpdate from '../../helper/InAppUpdate';
import {connect} from 'react-redux';
const VersionChecker = (props) => { const VersionChecker = (props) => {
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
...@@ -31,10 +39,15 @@ const VersionChecker = (props) => { ...@@ -31,10 +39,15 @@ const VersionChecker = (props) => {
}); });
if ((res.data.code = 200 && res.data.data)) { if ((res.data.code = 200 && res.data.data)) {
console.log(res); console.log(res);
if (res.data.data[0].version_name !== verCurrent || res.data.data[0].build.toString() !== DeviceInfo.getBuildNumber) { if (
res.data.data[0].version_name !== verCurrent ||
res.data.data[0].build.toString() !== DeviceInfo.getBuildNumber
) {
setVersion(res.data.data[0].version_name); setVersion(res.data.data[0].version_name);
setVisible(true); setVisible(true);
setIsForceUpdate(res.data.data[0].is_require_update == 0 ? false : true); setIsForceUpdate(
res.data.data[0].is_require_update == 0 ? false : true,
);
} }
} }
}; };
...@@ -44,7 +57,7 @@ const VersionChecker = (props) => { ...@@ -44,7 +57,7 @@ const VersionChecker = (props) => {
setIsForceUpdate(isForceUpdate); setIsForceUpdate(isForceUpdate);
}; };
const _renderDivider = () => <View style={styles.dividerStyle}/>; const _renderDivider = () => <View style={styles.dividerStyle} />;
const onOutsidePressed = () => { const onOutsidePressed = () => {
setVisible(false); setVisible(false);
...@@ -53,17 +66,20 @@ const VersionChecker = (props) => { ...@@ -53,17 +66,20 @@ const VersionChecker = (props) => {
const onUpdatePressed = async () => { const onUpdatePressed = async () => {
try { try {
if (Platform.OS === 'ios') { if (Platform.OS === 'ios') {
Linking.openURL('itms-apps://itunes.apple.com/us/app/dcv-invest/id1556621903?l=id'); Linking.openURL(
'itms-apps://itunes.apple.com/us/app/dcv-invest/id1556621903?l=id',
);
} else { } else {
// try { // try {
// InAppUpdate.checkUpdate() // InAppUpdate.checkUpdate()
// } catch(e) { // } catch(e) {
// console.log(e) // console.log(e)
// } // }
Linking.openURL('https://play.google.com/store/apps/details?id=com.dcv.invest'); Linking.openURL(
} 'https://play.google.com/store/apps/details?id=com.dcv.invest',
} catch (error) { );
} }
} catch (error) {}
}; };
const onRequestClose = () => null; const onRequestClose = () => null;
...@@ -97,50 +113,76 @@ const VersionChecker = (props) => { ...@@ -97,50 +113,76 @@ const VersionChecker = (props) => {
transparent transparent
animationType="fade" animationType="fade"
style={{position: 'absolute'}} style={{position: 'absolute'}}
visible={visible} visible={visible}>
>
{renderBackdrop()} {renderBackdrop()}
<View pointerEvents="box-none" style={styles.containerStyle}> <View pointerEvents="box-none" style={styles.containerStyle}>
<View style={styles.imageUpgradeContainer} zIndex={100}> <View style={styles.imageUpgradeContainer} zIndex={100}>
<Image <Image
source={R.images.iconUpgrade} source={R.images.iconUpgrade}
style={[styles.imageUpgradeStyle, {tintColor: R.colors.main}]}/> style={[styles.imageUpgradeStyle, {tintColor: R.colors.main}]}
/>
</View> </View>
<View style={styles.contentContainerStyle}> <View style={styles.contentContainerStyle}>
<Text style={styles.titleStyle}>{I18n.t('Update')}</Text> <Text style={styles.titleStyle}>
{props.language.language == 'vi' ? 'Cập nhật' : 'Update'}
</Text>
<Text style={styles.versionLabelStyle}> <Text style={styles.versionLabelStyle}>
{I18n.t('Version')} {I18n.t('Version')}
{': '} {': '}
{version} {version}
</Text> </Text>
<Text style={styles.descStyle}>{I18n.t('UpdateDescription')}</Text> <Text style={styles.descStyle}>
{' '}
{props.language.language == 'vi'
? 'Đã có phiên bản DCVInvest mới. Cập nhật ngay để tiếp tục sử dụng và trải nghiệm những tính năng mới nhất của hệ thống!'
: 'A new version of DCVInvest is available. Update now to continue using and experiencing the latest system features!'}
</Text>
{_renderDivider()} {_renderDivider()}
{isForceUpdate ? {isForceUpdate ? (
<TouchableOpacity onPress={() => onUpdatePressed()} style={styles.notNowContainerStyle}> <TouchableOpacity
<Text onPress={() => onUpdatePressed()}
style={[styles.textNotNowStyle, {color: R.colors.main}]}>{I18n.t('Update')}</Text> style={styles.notNowContainerStyle}>
<Text style={[styles.textNotNowStyle, {color: R.colors.main}]}>
{props.language.language == 'vi' ? 'Cập nhật' : 'Update'}
</Text>
</TouchableOpacity> </TouchableOpacity>
: ) : (
<View style={[styles.notNowContainerStyle, { <View
style={[
styles.notNowContainerStyle,
{
flexDirection: 'row', flexDirection: 'row',
marginHorizontal: WIDTHXD(100), marginHorizontal: WIDTHXD(100),
}]}> },
<TouchableOpacity onPress={() => cancelUpdate()} ]}>
style={[styles.btnButton, {paddingRight: WIDTHXD(60) }]}> <TouchableOpacity
onPress={() => cancelUpdate()}
style={[styles.btnButton, {paddingRight: WIDTHXD(60)}]}>
<Text <Text
style={[styles.textNotNowStyle, {color: R.colors.color777, textAlign: 'right'}]}>{I18n.t('Cancel')}</Text> style={[
styles.textNotNowStyle,
{color: R.colors.color777, textAlign: 'right'},
]}>
{props.language.language == 'vi' ? 'Bỏ qua' : 'Cancel'}
</Text>
</TouchableOpacity> </TouchableOpacity>
<View style={styles.dividerStyleVertical}></View> <View style={styles.dividerStyleVertical}></View>
<TouchableOpacity onPress={() => onUpdatePressed()} <TouchableOpacity
onPress={() => onUpdatePressed()}
style={[styles.btnButton, {paddingLeft: WIDTHXD(60)}]}> style={[styles.btnButton, {paddingLeft: WIDTHXD(60)}]}>
<Text <Text
style={[styles.textNotNowStyle, {color: R.colors.main, textAlign: 'left'}]}>{I18n.t('Update')}</Text> style={[
styles.textNotNowStyle,
{color: R.colors.main, textAlign: 'left'},
]}>
{I18n.t('Update')}
</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
} )}
</View> </View>
</View> </View>
</Modal> </Modal>
...@@ -245,4 +287,10 @@ const styles = StyleSheet.create({ ...@@ -245,4 +287,10 @@ const styles = StyleSheet.create({
}, },
}); });
export default VersionChecker; const mapStateToProps = (state) => {
return {
language: state.languageReducer,
};
};
export default connect(mapStateToProps, {})(VersionChecker);
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