Commit 65a00329 by Giang Tran

update api language

parent 92293725
......@@ -132,8 +132,8 @@ android {
applicationId "com.dcv.invest"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
versionCode 3
versionName "1.3"
vectorDrawables.useSupportLibrary = true
}
splits {
......
{
"version": 1,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.dcv.invest",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"properties": [],
"versionCode": 1,
"versionName": "1.0",
"enabled": true,
"outputFile": "app-release.apk"
}
]
}
\ No newline at end of file
......@@ -40,7 +40,17 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="dcvinvest" />
</intent-filter>
</activity>
......
......@@ -903,7 +903,7 @@
CODE_SIGN_ENTITLEMENTS = Invest/Invest.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = MXZ24GRH48;
ENABLE_BITCODE = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
......@@ -936,7 +936,7 @@
CODE_SIGN_ENTITLEMENTS = Invest/Invest.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = MXZ24GRH48;
INFOPLIST_FILE = Invest/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
......
......@@ -24,6 +24,19 @@
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>dcv.investcustomer.vn. linking</string>
<key>CFBundleURLSchemes</key>
<array>
<string>dcvinvest</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
......
......@@ -30,7 +30,7 @@ const Fillters = [
},
{
id: '4',
name: 'Withdraw',
name: 'Transfer',
value: 'TRANSFER',
},
];
......
......@@ -42,9 +42,7 @@ const Item = (props) => {
style={{
alignItems: 'flex-start',
}}>
<Text style={styles.txtBlack}>
{converType(item.transection_category)}
</Text>
<Text style={styles.txtBlack}>{item.name}</Text>
<Text style={styles.txt}>{item.transection_date_timestamp}</Text>
</View>
......@@ -100,7 +98,6 @@ const styles = StyleSheet.create({
fontSize: getFontXD(36),
color: '#C4C4C4',
marginTop: 10,
fontStyle: 'italic',
},
imgIcon: {
width: WIDTHXD(178),
......
......@@ -5,31 +5,58 @@ import {
HEIGHTXD,
WIDTHXD,
toPriceVnd,
converType,
converStatus,
} from '../../../Config/Functions';
import R from '../../../assets/R';
import Block from '../../../components/Block';
import I18n from '../../../helper/i18/i18n';
import {useNavigation} from '@react-navigation/native';
import {HISTORYDETAIL} from '../../../routers/ScreenNames';
const Item = (props) => {
const {item} = props;
const navigate = useNavigation();
return (
<TouchableOpacity onPress={() => console.log('HEllo')}>
<View style={styles.container}>
<Block flex={1} row>
<Block padding={[5, 10]} space={'between'} flex={1}>
<View style={{justifyContent: 'center', flex: 1}}>
<Text style={styles.txt1}>
`${I18n.t('BonusMoney')}:{' '}`
<Text style={styles.money}>{toPriceVnd(item.money)}</Text> vnđ
</Text>
<Text numberOfLines={1} style={styles.txt2}>
`{I18n.t('Content')}: {item.content}`
<TouchableOpacity
onPress={() =>
navigate.navigate(HISTORYDETAIL, {id: item.transection_id})
}
style={styles.container}>
<Block flex={1} row>
<View style={styles.wrapLeft} />
<View style={styles.wrapDate}>
<Image source={{uri: item.icon}} style={styles.imgIcon} />
</View>
<Block
style={{justifyContent: 'center'}}
padding={[5, 10]}
space={'between'}
flex={1}>
<View
style={{
flexDirection: 'row',
justifyContent: 'space-between',
}}>
<View
style={{
alignItems: 'flex-start',
}}>
<Text style={styles.txtBlack}>{item.name}</Text>
<Text style={styles.txt}>{item.transection_date_timestamp}</Text>
</View>
<View style={{alignItems: 'flex-end'}}>
<Text
style={[
styles.txtMoney,
item.status == 1 ? {color: '#1473E6'} : null,
]}>
{toPriceVnd(item.amount)} Đ
</Text>
<Text style={styles.txt}> {item.status_name}</Text>
</View>
<Text style={styles.txt}>{item.time}</Text>
</Block>
</View>
</Block>
</View>
</Block>
</TouchableOpacity>
);
};
......@@ -38,7 +65,6 @@ export default Item;
const styles = StyleSheet.create({
container: {
marginTop: 10,
height: HEIGHTXD(250),
shadowColor: '#000',
shadowOffset: {
......@@ -50,10 +76,13 @@ const styles = StyleSheet.create({
elevation: 5,
marginHorizontal: 10,
backgroundColor: R.colors.white,
marginBottom: 10,
marginVertical: 5,
borderRadius: HEIGHTXD(30),
},
wrapRight: {
borderLeftColor: R.colors.borderGray,
borderLeftWidth: 0.7,
},
wrapLeft: {
width: WIDTHXD(16),
borderTopLeftRadius: HEIGHTXD(30),
......@@ -63,36 +92,22 @@ const styles = StyleSheet.create({
justifyContent: 'center',
paddingHorizontal: 10,
},
txtTitle: {
fontSize: getFontXD(42),
color: R.colors.black,
fontWeight: 'bold',
},
txt: {
fontSize: getFontXD(39),
fontSize: getFontXD(36),
color: '#C4C4C4',
fontStyle: 'italic',
},
rowBet: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
},
txt1: {
fontSize: getFontXD(42),
color: '#0B2031',
},
txt2: {
fontSize: getFontXD(42),
color: '#0B2031',
marginVertical: 2,
marginTop: 10,
},
imgIcon: {
width: WIDTHXD(178),
height: HEIGHTXD(178),
resizeMode: 'contain',
},
money: {
color: '#E3434F',
txtMoney: {
fontSize: getFontXD(42),
fontWeight: 'bold',
color: '#F99D1D',
},
txtBlack: {
fontSize: getFontXD(42),
},
});
import React from 'react';
import {View, FlatList, Text} from 'react-native';
import React, {useState, useEffect} from 'react';
import {View, FlatList, Text, Alert} from 'react-native';
import HeaderBack from '../../../components/Header/HeaderBack';
import Item from './Item';
import AppText from '../../../components/AppText';
import {getListTransaction} from '../../../apis/Functions/Widthdraw';
import I18n from '../../../helper/i18/i18n';
const Payments = (props) => {
const [page, setPage] = useState(1);
const [data, setData] = useState([]);
const [tottalPage, setTotalPage] = useState(1);
const [isRefresh, setisRefresh] = useState(false);
useEffect(() => {
getData();
}, []);
const getData = async () => {
setisRefresh(true);
setPage(1);
const res = await getListTransaction({
keyword: '',
type: 'PAYMENT',
platform: Platform.OS,
page_size: 10,
status: -1,
page_index: 1,
start_date: '',
end_date: '',
});
setisRefresh(false);
if ((res.data.code = 200 && res.data.data)) {
setData(res.data.data);
setTotalPage(res.data.meta.pages);
console.log(res.data.data);
} else {
Alert.alert(I18n.t('Notification'), res.data.message);
}
};
const onRefresh = () => {
getData();
};
const onLoadMore = () => {
if (page < tottalPage) getDataLoadMore();
};
const getDataLoadMore = async () => {
setisRefresh(true);
const res = await getListTransaction({
keyword: '',
type: 'PAYMENT',
platform: Platform.OS,
page_size: 10,
status: -1,
page_index: page + 1,
start_date: '',
end_date: '',
});
setPage(page + 1);
if (res.data.code == 200) {
setData(data.concat(res.data.data));
}
setisRefresh(false);
};
return (
<View style={{flex: 1}}>
<HeaderBack isWhite={false} title={'Payments'} />
<View style={{justifyContent: 'center', alignItems: 'center', flex: 1}}>
<AppText
i18nKey={'Features_develop'}
style={{
fontSize: 18,
fontWeight: 'bold',
textAlign: 'center',
}}
/>
</View>
{/* <FlatList
<FlatList
keyExtractor={(item) => item.id}
data={data}
refreshing={isRefresh}
showsVerticalScrollIndicator={false}
onRefresh={onRefresh}
onEndReachedThreshold={0.01}
onEndReached={(info) => {
onLoadMore();
}}
keyExtractor={(item) => item.transection_id + 'a'}
renderItem={({item}) => <Item item={item} />}
/> */}
/>
</View>
);
};
......
......@@ -8,10 +8,15 @@ import I18n from '../../helper/i18/i18n';
const MethodPay = (props) => {
const [data, setData] = useState([]);
const [isRefresh, setRefresh] = useState(false);
const navigation = useNavigation();
useEffect(() => {
getData();
}, []);
const unsubscribe = navigation.addListener('focus', () => {
getData();
});
return unsubscribe;
}, [navigation]);
const onRefresh = () => {
getData();
......
......@@ -13,7 +13,6 @@ const MethodPayView = (props) => {
const {isRefresh, listMethod, onRefresh} = props;
console.log('List', listMethod);
return (
<View style={{flex: 1}}>
<HeaderBack title={'PaymentSetting'} />
......
import React, {useState,useEffect} from 'react';
import React, {useState, useEffect} from 'react';
import {
Text,
View,
......@@ -24,14 +24,13 @@ import ItemBank from './ItemBank';
import {SafeAreaView} from 'react-native-safe-area-context';
const SelectBankModal = (props) => {
console.log(props)
const [modalVisible, setModalVisible] = useState(false);
const [valueSearch, setValueSearch] = useState('');
const [result, setResult] = useState(props.data);
const [keySearch, setKeySearch] = useState('');
useEffect(()=>{
setResult(props.data)
},[props.data])
useEffect(() => {
setResult(props.data);
}, [props.data]);
const localFilter = (data, allowFields = [], search_text) => {
if (!data) return [];
if (!search_text || search_text === '') return data;
......@@ -44,10 +43,10 @@ const SelectBankModal = (props) => {
let added = false;
allowFields.map((param) => {
if (
!added &&
(item[param + ''] + '')
.toLowerCase()
.includes(search_text.toLowerCase())
!added &&
(item[param + ''] + '')
.toLowerCase()
.includes(search_text.toLowerCase())
) {
result.push(item);
added = true;
......@@ -59,16 +58,13 @@ const SelectBankModal = (props) => {
};
const _onSearch = async (keySearch) => {
const data = props.data
? localFilter(props.data, ['code', 'name'], keySearch)
.map(
(x) => ({
id: x.id,
code: x.code,
name: x.name,
logo: x.logo,
})
)
: [];
? localFilter(props.data, ['code', 'name'], keySearch).map((x) => ({
id: x.id,
code: x.code,
name: x.name,
logo: x.logo,
}))
: [];
// remove duplicate
let result = [];
......@@ -79,124 +75,118 @@ const SelectBankModal = (props) => {
setResult(result);
};
const _onPressItem = (item) => {
console.log('_onPressItem', item)
props.onPressItem(item)
setValueSearch(item ? item.name : '');
setModalVisible(false);
};
return (
<View>
<TouchableOpacity
style={[styles.buttonShowModal]}
onPress={() => {
setModalVisible(true);
setKeySearch('');
_onSearch(keySearch);
}}>
<View style={styles.flexRowJustifyBetween}>
<Text
style={[styles.txtTitle, {flex: 1, flexWrap: 'wrap'}]}
numberOfLines={1}
ellipsizeMode="tail">
{valueSearch.trim()}
</Text>
<View>
{valueSearch === '' ? (
<TouchableOpacity
onPress={() => {
setModalVisible(true);
_onSearch(keySearch);
}}
hitSlop={{left: WIDTHXD(50), right: WIDTHXD(50)}}>
<AntDesign
name="search1"
size={WIDTHXD(43)}
color={R.colors.iconGray}
/>
</TouchableOpacity>
) : (
<TouchableOpacity
onPress={() => {
_onPressItem(null);
}}
hitSlop={{left: WIDTHXD(50), right: WIDTHXD(50)}}>
<AntDesign
name="close"
size={WIDTHXD(43)}
color={R.colors.iconGray}
/>
</TouchableOpacity>
)}
</View>
<View>
<TouchableOpacity
style={[styles.buttonShowModal]}
onPress={() => {
setModalVisible(true);
setKeySearch('');
_onSearch(keySearch);
}}>
<View style={styles.flexRowJustifyBetween}>
<Text
style={[styles.txtTitle, {flex: 1, flexWrap: 'wrap'}]}
numberOfLines={1}
ellipsizeMode="tail">
{valueSearch.trim()}
</Text>
<View>
{valueSearch === '' ? (
<TouchableOpacity
onPress={() => {
setModalVisible(true);
_onSearch(keySearch);
}}
hitSlop={{left: WIDTHXD(50), right: WIDTHXD(50)}}>
<AntDesign
name="search1"
size={WIDTHXD(43)}
color={R.colors.iconGray}
/>
</TouchableOpacity>
) : (
<TouchableOpacity
onPress={() => {
_onPressItem(null);
}}
hitSlop={{left: WIDTHXD(50), right: WIDTHXD(50)}}>
<AntDesign
name="close"
size={WIDTHXD(43)}
color={R.colors.iconGray}
/>
</TouchableOpacity>
)}
</View>
</TouchableOpacity>
</View>
</TouchableOpacity>
<Modal
animated={true}
animationType="fade"
visible={modalVisible}
>
<SafeAreaView>
<View style={styles.overViewModal}>
<View style={[styles.container]}>
<View style={styles.viewTitle}>
<Text style={[styles.title]}>{props.title}</Text>
<TouchableOpacity
style={styles.btClose}
onPress={() => setModalVisible(false)}>
<AntDesign
name="close"
size={WIDTHXD(48)}
color={R.colors.black}
/>
</TouchableOpacity>
<Modal animated={true} animationType="fade" visible={modalVisible}>
<SafeAreaView>
<View style={styles.overViewModal}>
<View style={[styles.container]}>
<View style={styles.viewTitle}>
<Text style={[styles.title]}>{props.title}</Text>
<TouchableOpacity
style={styles.btClose}
onPress={() => setModalVisible(false)}>
<AntDesign
name="close"
size={WIDTHXD(48)}
color={R.colors.black}
/>
</TouchableOpacity>
</View>
<View style={styles.viewContent}>
<View style={styles.inputSearch}>
<TextInput
style={styles.input}
value={keySearch}
placeholder={I18n.t('Search')}
placeholderTextColor={R.colors.color777}
onChangeText={(keySearch) => {
setKeySearch(keySearch);
_onSearch(keySearch);
}}
/>
<AntDesign
name="search1"
size={WIDTHXD(40)}
color={R.colors.gray}
style={{position: 'absolute', left: WIDTHXD(28)}}
/>
</View>
<View style={styles.viewContent}>
<View style={styles.inputSearch}>
<TextInput
style={styles.input}
value={keySearch}
placeholder={I18n.t('Search')}
placeholderTextColor={R.colors.color777}
onChangeText={(keySearch) => {
setKeySearch(keySearch);
_onSearch(keySearch);
}}
/>
<AntDesign
name="search1"
size={WIDTHXD(40)}
color={R.colors.gray}
style={{position: 'absolute', left: WIDTHXD(28)}}
{!_.isEmpty(result) ? (
<View style={styles.viewResult}>
<FlatList
data={result}
extraData={result}
style={styles.flatlist}
renderItem={({item, index}) => (
<ItemBank
item={item}
isEndItem={index == result.length - 1}
onPress={(item) => _onPressItem(item)}
/>
)}
/>
</View>
{!_.isEmpty(result) ? (
<View style={styles.viewResult}>
<FlatList
data={result}
extraData={result}
style={styles.flatlist}
renderItem={({item, index}) => (
<ItemBank
item={item}
isEndItem = {index == result.length - 1}
onPress={(item) => _onPressItem(item)}
/>
)}
/>
</View>
) : (
<Text style={styles.txtEmpty}>
{I18n.t('NullDataSearch')}
</Text>
)}
</View>
) : (
<Text style={styles.txtEmpty}>
{I18n.t('NullDataSearch')}
</Text>
)}
</View>
</View>
</SafeAreaView>
</Modal>
</View>
</View>
</SafeAreaView>
</Modal>
</View>
);
};
......@@ -242,7 +232,7 @@ const styles = StyleSheet.create({
},
flatlist: {
width: getWidth(),
marginBottom: HEIGHTXD(300)
marginBottom: HEIGHTXD(300),
},
input: {
height: WIDTHXD(110),
......@@ -321,4 +311,4 @@ const styles = StyleSheet.create({
marginTop: 24,
},
});
export default SelectBankModal;
export default React.memo(SelectBankModal);
import React from 'react';
import {Alert} from 'react-native';
import SettingView from './SettingView';
import {updateLangugeApi} from '../../apis/Functions/users';
import I18n from '../../helper/i18/i18n';
import {connect} from 'react-redux';
import {showLoading, hideLoading} from '../../actions/loadingAction';
const Setting = (props) => {
return <SettingView />;
const convertKeyLanguage = (key) => {
if (key == 'en') return 'ENGLISH';
return 'VIETNAMESE';
};
const updateLangue = async (key) => {
props.showLoading();
const res = await updateLangugeApi({
platform: Platform.OS,
language: convertKeyLanguage(key),
});
props.hideLoading();
if (res.data.code == 200) {
setTimeout(() => {
Alert.alert(I18n.t('Notification'), res.data.message);
}, 500);
} else {
setTimeout(() => {
Alert.alert(I18n.t('Notification'), res.data.message);
}, 500);
}
};
return <SettingView updateLangue={updateLangue} />;
};
export default Setting;
const mapStateToProps = (state) => {
return {
user: state.userReducer,
};
};
export default connect(mapStateToProps, {
showLoading,
hideLoading,
})(Setting);
......@@ -23,7 +23,9 @@ const dataLanguage = [
const SettingView = (props) => {
const [isEnabled, setIsEnabled] = useState(true);
const toggleSwitch = () => setIsEnabled((previousState) => !previousState);
const [language, setLanguage] = useState();
useEffect(() => {
convertLanguage();
}, []);
......@@ -59,7 +61,8 @@ const SettingView = (props) => {
setLanguage(items.name);
props.changeLanguage(items.value);
AsyncStorage.setItem(KEY.LANGUAGE, items.value);
setLocation(I18n, items.value)
setLocation(I18n, items.value);
props.updateLangue(items.value);
}}
/>
</View>
......
......@@ -51,3 +51,8 @@ export const updateInforUser = async (body) =>
PostData(url.urlUpdateInforUser, body)
.then((res) => res)
.catch((err) => err);
export const updateLangugeApi = async (body) =>
PostData(url.urlUpdateLanguage, body)
.then((res) => res)
.catch((err) => err);
......@@ -35,4 +35,6 @@ export default {
urlOpenCQG: root + 'api/v1/customers/register-open-cqg',
urlUpdateInforUser: root + 'api/v1/customers/update-general-info',
urlUpdateLanguage: root + 'api/v1/customers/update-language',
};
......@@ -96,7 +96,7 @@ export default {
Provisional: 'Provisional',
Here: 'Here',
Open_account_demo: 'You can open a demo account',
Features_develop: 'Features are under development, please come back later!',
Features_develop: 'No data!',
Language: 'Language',
Email: 'Email',
Password: 'Password',
......@@ -139,7 +139,8 @@ export default {
BeneficiaryAccount: 'the beneficiary account',
FromWallet: 'From wallet',
FromCQGAccount: 'From CQG account',
SettingPaymentMethodConfirm: 'You have not the payment method. Go to payment method setting?',
SettingPaymentMethodConfirm:
'You have not the payment method. Go to payment method setting?',
EnterEmailRequest: 'Please enter email',
EnterEmail: 'Enter email',
GetVerificationCode: 'Get the verification code',
......
......@@ -103,7 +103,7 @@ export default {
Provisional: 'Tạm tính',
Here: 'Tại đây',
Open_account_demo: 'Bạn có thể mở tài khoản thử',
Features_develop: 'Tính năng đang được phát triển, vui lòng quay lại sau!',
Features_develop: 'Không có dữ liệu!',
Email: 'Email',
Password: 'Mật khẩu',
Login: 'Đăng nhập',
......@@ -128,7 +128,8 @@ export default {
Branch: 'Chi nhánh',
OwnerAccountName: 'Tên chủ tài khoản',
AccountNumber: 'Số tài khoản ngân hàng',
DeletePaymentMethodConfirm: 'Bạn có chắc chắn muốn xoá phương thức thanh toán',
DeletePaymentMethodConfirm:
'Bạn có chắc chắn muốn xoá phương thức thanh toán',
Forbidden: 'Từ chối',
OwnerAccount: 'Chủ TK',
Add: 'Thêm',
......@@ -143,7 +144,8 @@ export default {
BeneficiaryAccount: 'tài khoản hưởng thụ',
FromWallet: 'Từ ví',
FromCQGAccount: 'Từ tài khoản CQG',
SettingPaymentMethodConfirm: 'Bạn chưa có phương thức thanh toán.Đi đến cài đặt phương thức thanh toán?',
SettingPaymentMethodConfirm:
'Bạn chưa có phương thức thanh toán.Đi đến cài đặt phương thức thanh toán?',
EnterEmailRequest: 'Vui lòng nhập email',
EnterEmail: 'Nhập email',
GetVerificationCode: 'Lấy mã xác thực',
......
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