Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
InvestCustomer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Giang Tran
InvestCustomer
Commits
bd1a3c70
Commit
bd1a3c70
authored
May 28, 2021
by
Giang Tran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug language
parent
0f249e58
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
500 additions
and
428 deletions
+500
-428
build.gradle
android/app/build.gradle
+2
-2
project.pbxproj
ios/Invest.xcodeproj/project.pbxproj
+4
-4
WalletWithdraw.js
src/Screens/Action/Wallet/WalletWithdraw.js
+13
-3
ConvertUnit.js
src/Screens/Tool/ConvertUnit.js
+198
-190
ExchangeRate.js
src/Screens/Tool/ExchangeRate.js
+7
-1
index.js
src/Screens/VersionChecker/index.js
+276
-228
No files found.
android/app/build.gradle
View file @
bd1a3c70
...
@@ -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
{
...
...
ios/Invest.xcodeproj/project.pbxproj
View file @
bd1a3c70
...
@@ -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"
,
...
...
src/Screens/Action/Wallet/WalletWithdraw.js
View file @
bd1a3c70
...
@@ -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
,
{
...
...
src/Screens/Tool/ConvertUnit.js
View file @
bd1a3c70
...
@@ -5,212 +5,220 @@ import HeaderBack from '../../components/Header/HeaderBack';
...
@@ -5,212 +5,220 @@ 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
([]);
const
[
toUnit
,
setToUnit
]
=
useState
();
const
[
toUnit
,
setToUnit
]
=
useState
();
const
[
fromUnit
,
setFromUnit
]
=
useState
();
const
[
fromUnit
,
setFromUnit
]
=
useState
();
const
[
number
,
setNumber
]
=
useState
(
null
);
const
[
number
,
setNumber
]
=
useState
(
null
);
const
[
rateItem
,
setRateItem
]
=
useState
({
const
[
rateItem
,
setRateItem
]
=
useState
({
value_one
:
0.025000000373
,
value_one
:
0.025000000373
,
value_two
:
0
,
value_two
:
0
,
name
:
'Kg,'
,
name
:
'Kg,'
,
});
const
[
result
,
setResult
]
=
useState
();
useEffect
(()
=>
{
getDataUnit
();
},
[]);
useEffect
(()
=>
{
calcultorResult
();
},
[
number
,
fromUnit
,
toUnit
]);
const
getDataUnit
=
async
()
=>
{
props
.
showLoading
();
const
res
=
await
getUnitList
({
platform
:
Platform
.
OS
,
});
});
const
[
result
,
setResult
]
=
useState
();
if
(
res
.
status
==
200
&&
res
.
data
.
code
==
200
)
{
useEffect
(()
=>
{
setFromUnitList
(
res
.
data
.
data
);
getDataUnit
();
setFromUnit
(
res
.
data
.
data
[
0
]);
},
[]);
onChangeFromUnit
(
''
,
res
.
data
.
data
[
0
]);
}
else
{
useEffect
(()
=>
{
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'Can_not_get_data'
));
calcultorResult
();
}
},
[
number
,
fromUnit
,
toUnit
]);
props
.
hideLoading
();
};
const
getDataUnit
=
async
()
=>
{
props
.
showLoading
();
const
onChangeNumber
=
(
string
)
=>
{
const
res
=
await
getUnitList
({
let
number
=
string
.
toString
().
split
(
','
).
join
(
''
);
platform
:
Platform
.
OS
,
setNumber
(
number
);
});
};
if
(
res
.
status
==
200
&&
res
.
data
.
code
==
200
)
{
setFromUnitList
(
res
.
data
.
data
);
const
onChangeFromUnit
=
(
value
,
item
)
=>
{
setFromUnit
(
res
.
data
.
data
[
0
]);
setFromUnit
(
item
);
onChangeFromUnit
(
''
,
res
.
data
.
data
[
0
])
let
toUnit
=
[];
}
else
{
item
.
rates
.
map
((
rateItem
)
=>
{
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'Can_not_get_data'
));
toUnit
.
push
({
}
id
:
rateItem
.
to_unit_id
,
props
.
hideLoading
();
value
:
rateItem
.
to_unit
.
name
,
};
name
:
rateItem
.
to_unit
.
name
,
rate
:
rateItem
.
value_one
>
0
?
rateItem
.
value_one
:
rateItem
.
value_two
,
const
onChangeNumber
=
(
string
)
=>
{
});
let
number
=
string
.
toString
().
split
(
','
).
join
(
''
);
});
setNumber
(
number
);
setToUnitList
(
toUnit
);
setToUnit
(
toUnit
[
0
]);
};
};
const
onChangeFromUnit
=
(
value
,
item
)
=>
{
const
onChangeToUnit
=
(
value
,
item
)
=>
{
setFromUnit
(
item
);
setToUnit
(
item
);
let
toUnit
=
[];
};
item
.
rates
.
map
((
rateItem
)
=>
{
toUnit
.
push
({
const
calcultorResult
=
()
=>
{
id
:
rateItem
.
to_unit_id
,
if
(
number
&&
number
!=
''
&&
parseFloat
(
number
)
>
0
)
{
value
:
rateItem
.
to_unit
.
name
,
let
result
=
parseFloat
(
number
)
*
toUnit
.
rate
;
name
:
rateItem
.
to_unit
.
name
,
setResult
(
rate
:
rateItem
.
value_one
>
0
?
rateItem
.
value_one
:
rateItem
.
value_two
,
`
${
floatToPriceVnd
(
number
.
toString
())}
${
});
fromUnit
.
name
});
}
=
${
floatToPriceVnd
(
result
.
toString
())}
${
toUnit
.
name
}
`
,
setToUnitList
(
toUnit
);
);
setToUnit
(
toUnit
[
0
]);
}
else
{
};
setResult
(
''
);
}
const
onChangeToUnit
=
(
value
,
item
)
=>
{
};
setToUnit
(
item
);
};
return
(
<
View
style
=
{{
flex
:
1
}}
>
const
calcultorResult
=
()
=>
{
<
HeaderBack
title
=
{
'ConvertUnit'
}
/
>
if
(
number
&&
number
!=
''
&&
parseFloat
(
number
)
>
0
)
{
<
View
style
=
{{
flex
:
1
,
paddingTop
:
20
,
paddingHorizontal
:
20
}}
>
let
result
=
parseFloat
(
number
)
*
toUnit
.
rate
;
<
AppText
style
=
{
styles
.
txtTitle
}
i18nKey
=
{
'Count'
}
/
>
setResult
(
`
${
floatToPriceVnd
(
number
.
toString
())}
${
fromUnit
.
name
}
=
${
floatToPriceVnd
(
result
.
toString
())}
${
toUnit
.
name
}
`
);
<
View
style
=
{
styles
.
Item
}
>
}
else
{
<
View
style
=
{
styles
.
wrap
}
>
setResult
(
''
)
<
TextInput
}
onChangeText
=
{(
val
)
=>
onChangeNumber
(
val
)}
};
keyboardType
=
{
'number-pad'
}
style
=
{
styles
.
wrapInput
}
return
(
maxLength
=
{
12
}
<
View
style
=
{{
flex
:
1
}}
>
value
=
{
floatToPriceVnd
(
number
)}
<
HeaderBack
title
=
{
'ConvertUnit'
}
/
>
/
>
<
View
style
=
{{
flex
:
1
,
paddingTop
:
20
,
paddingHorizontal
:
20
}}
>
<
/View
>
<
AppText
style
=
{
styles
.
txtTitle
}
i18nKey
=
{
'Count'
}
/
>
<
/View
>
<
View
style
=
{
styles
.
Item
}
>
<
View
style
=
{
styles
.
wrap
}
>
<
TextInput
onChangeText
=
{(
val
)
=>
onChangeNumber
(
val
)}
keyboardType
=
{
'number-pad'
}
style
=
{
styles
.
wrapInput
}
maxLength
=
{
12
}
value
=
{
floatToPriceVnd
(
number
)}
/
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
Item
}
>
<
View
style
=
{
styles
.
wrap
}
>
<
PickerItem
width
=
{
WIDTHXD
(
480
)}
data
=
{
fromUnitList
}
defaultValue
=
{
fromUnit
?.
name
}
value
=
{
fromUnit
?.
name
}
onValueChange
=
{(
value
,
item
)
=>
{
onChangeFromUnit
(
value
,
item
);
}}
/
>
{
/*<TouchableOpacity>*/
}
{
/* <Icon name={'exchange'} size={30} color={R.colors.black} />*/
}
{
/*</TouchableOpacity>*/
}
<
PickerItem
width
=
{
WIDTHXD
(
480
)}
data
=
{
toUnitList
}
defaultValue
=
{
toUnit
?.
name
}
value
=
{
toUnit
?.
name
}
onValueChange
=
{(
value
,
item
)
=>
{
onChangeToUnit
(
value
,
item
);
}}
/
>
<
/View
>
<
/View
>
<
Text
style
=
{
styles
.
txtResult
}
>
{
result
}
<
/Text
>
<
View
style
=
{
styles
.
Item
}
>
<
/View
>
<
View
style
=
{
styles
.
wrap
}
>
<
PickerItem
width
=
{
WIDTHXD
(
480
)}
data
=
{
fromUnitList
}
defaultValue
=
{
fromUnit
?.
name
}
value
=
{
fromUnit
?.
name
}
onValueChange
=
{(
value
,
item
)
=>
{
onChangeFromUnit
(
value
,
item
);
}}
/
>
{
/*<TouchableOpacity>*/
}
{
/* <Icon name={'exchange'} size={30} color={R.colors.black} />*/
}
{
/*</TouchableOpacity>*/
}
<
PickerItem
width
=
{
WIDTHXD
(
480
)}
data
=
{
toUnitList
}
defaultValue
=
{
toUnit
?.
name
}
value
=
{
toUnit
?.
name
}
onValueChange
=
{(
value
,
item
)
=>
{
onChangeToUnit
(
value
,
item
);
}}
/
>
<
/View
>
<
/View
>
<
/View
>
);
<
Text
style
=
{
styles
.
txtResult
}
>
{
result
}
<
/Text
>
<
/View
>
<
/View
>
);
};
};
const
styles
=
StyleSheet
.
create
({
const
styles
=
StyleSheet
.
create
({
txtTitle
:
{
txtTitle
:
{
fontSize
:
getFontXD
(
42
),
fontSize
:
getFontXD
(
42
),
color
:
R
.
colors
.
color777
,
color
:
R
.
colors
.
color777
,
marginBottom
:
5
,
marginBottom
:
5
,
},
},
note
:
{
note
:
{
fontSize
:
getFontXD
(
36
),
fontSize
:
getFontXD
(
36
),
fontStyle
:
'italic'
,
fontStyle
:
'italic'
,
marginTop
:
10
,
marginTop
:
10
,
},
},
row
:
{
row
:
{
height
:
HEIGHTXD
(
109
),
height
:
HEIGHTXD
(
109
),
width
:
'80%'
,
width
:
'80%'
,
justifyContent
:
'space-between'
,
justifyContent
:
'space-between'
,
marginVertical
:
5
,
marginVertical
:
5
,
paddingHorizontal
:
10
,
paddingHorizontal
:
10
,
},
},
footer
:
{
footer
:
{
alignItems
:
'center'
,
alignItems
:
'center'
,
justifyContent
:
'center'
,
justifyContent
:
'center'
,
marginTop
:
40
,
marginTop
:
40
,
},
},
btnContainer
:
{
btnContainer
:
{
width
:
WIDTHXD
(
428
),
width
:
WIDTHXD
(
428
),
height
:
HEIGHTXD
(
120
),
height
:
HEIGHTXD
(
120
),
justifyContent
:
'center'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
alignItems
:
'center'
,
backgroundColor
:
R
.
colors
.
main
,
backgroundColor
:
R
.
colors
.
main
,
borderRadius
:
10
,
borderRadius
:
10
,
},
},
txtBtn
:
{
txtBtn
:
{
fontSize
:
getFontXD
(
48
),
fontSize
:
getFontXD
(
48
),
color
:
R
.
colors
.
white
,
color
:
R
.
colors
.
white
,
fontWeight
:
'600'
,
fontWeight
:
'600'
,
},
},
wrapInput
:
{
wrapInput
:
{
width
:
'100%'
,
width
:
'100%'
,
backgroundColor
:
R
.
colors
.
white
,
backgroundColor
:
R
.
colors
.
white
,
height
:
HEIGHTXD
(
109
),
height
:
HEIGHTXD
(
109
),
fontSize
:
getFontXD
(
42
),
fontSize
:
getFontXD
(
42
),
borderRadius
:
5
,
borderRadius
:
5
,
paddingHorizontal
:
10
,
paddingHorizontal
:
10
,
paddingVertical
:
0
,
paddingVertical
:
0
,
shadowColor
:
'#000'
,
shadowColor
:
'#000'
,
shadowOffset
:
{
shadowOffset
:
{
width
:
0
,
width
:
0
,
height
:
1
,
height
:
1
,
},
shadowOpacity
:
0.2
,
shadowRadius
:
1.41
,
elevation
:
2
,
},
wrap
:
{
flexDirection
:
'row'
,
alignItems
:
'center'
,
justifyContent
:
'space-between'
,
},
Item
:
{
marginBottom
:
20
,
},
txtNote
:
{
fontSize
:
getFontXD
(
36
),
textAlign
:
'right'
,
marginTop
:
10
,
},
txtResult
:
{
fontSize
:
getFontXD
(
52
),
color
:
R
.
colors
.
black
,
fontWeight
:
'600'
,
textAlign
:
'center'
,
marginTop
:
20
,
},
},
shadowOpacity
:
0.2
,
shadowRadius
:
1.41
,
elevation
:
2
,
color
:
R
.
colors
.
black
,
},
wrap
:
{
flexDirection
:
'row'
,
alignItems
:
'center'
,
justifyContent
:
'space-between'
,
},
Item
:
{
marginBottom
:
20
,
},
txtNote
:
{
fontSize
:
getFontXD
(
36
),
textAlign
:
'right'
,
marginTop
:
10
,
},
txtResult
:
{
fontSize
:
getFontXD
(
52
),
color
:
R
.
colors
.
black
,
fontWeight
:
'600'
,
textAlign
:
'center'
,
marginTop
:
20
,
},
});
});
const
mapStateToProps
=
(
state
)
=>
{
const
mapStateToProps
=
(
state
)
=>
{
return
{};
return
{};
};
};
export
default
connect
(
mapStateToProps
,
{
export
default
connect
(
mapStateToProps
,
{
showLoading
,
showLoading
,
hideLoading
,
hideLoading
,
})(
ConvertUnit
);
})(
ConvertUnit
);
src/Screens/Tool/ExchangeRate.js
View file @
bd1a3c70
...
@@ -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
>
...
...
src/Screens/VersionChecker/index.js
View file @
bd1a3c70
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
import
{
View
,
View
,
Text
,
Text
,
Modal
,
Modal
,
TouchableOpacity
,
TouchableOpacity
,
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
);
const
[
isForceUpdate
,
setIsForceUpdate
]
=
useState
(
false
);
const
[
isForceUpdate
,
setIsForceUpdate
]
=
useState
(
false
);
const
[
version
,
setVersion
]
=
useState
(
'1.0'
);
const
[
version
,
setVersion
]
=
useState
(
'1.0'
);
useEffect
(()
=>
{
useEffect
(()
=>
{
checkVersion
();
checkVersion
();
},
[]);
},
[]);
const
checkVersion
=
async
()
=>
{
const
checkVersion
=
async
()
=>
{
const
verCurrent
=
DeviceInfo
.
getVersion
();
const
verCurrent
=
DeviceInfo
.
getVersion
();
const
res
=
await
getNewestVersionInfo
({
const
res
=
await
getNewestVersionInfo
({
platform
:
Platform
.
OS
,
platform
:
Platform
.
OS
,
});
});
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
(
setVersion
(
res
.
data
.
data
[
0
].
version_name
);
res
.
data
.
data
[
0
].
version_name
!==
verCurrent
||
setVisible
(
true
);
res
.
data
.
data
[
0
].
build
.
toString
()
!==
DeviceInfo
.
getBuildNumber
setIsForceUpdate
(
res
.
data
.
data
[
0
].
is_require_update
==
0
?
false
:
true
);
)
{
}
setVersion
(
res
.
data
.
data
[
0
].
version_name
);
}
setVisible
(
true
);
};
setIsForceUpdate
(
const
setVisibleModal
=
(
visible
,
version
,
isForceUpdate
)
=>
{
res
.
data
.
data
[
0
].
is_require_update
==
0
?
false
:
true
,
setVisible
(
visible
);
setVersion
(
version
);
setIsForceUpdate
(
isForceUpdate
);
};
const
_renderDivider
=
()
=>
<
View
style
=
{
styles
.
dividerStyle
}
/>
;
const
onOutsidePressed
=
()
=>
{
setVisible
(
false
);
};
const
onUpdatePressed
=
async
()
=>
{
try
{
if
(
Platform
.
OS
===
'ios'
)
{
Linking
.
openURL
(
'itms-apps://itunes.apple.com/us/app/dcv-invest/id1556621903?l=id'
);
}
else
{
// try {
// InAppUpdate.checkUpdate()
// } catch(e) {
// console.log(e)
// }
Linking
.
openURL
(
'https://play.google.com/store/apps/details?id=com.dcv.invest'
);
}
}
catch
(
error
)
{
}
};
const
onRequestClose
=
()
=>
null
;
const
renderBackdrop
=
()
=>
{
return
(
<
View
style
=
{{
backgroundColor
:
'rgba(0,0,0,0.30)'
,
// backgroundColor: 'red',
position
:
'absolute'
,
top
:
0
,
bottom
:
0
,
left
:
0
,
right
:
0
,
width
:
getWidth
(),
height
:
getHeight
(),
}}
/
>
);
);
};
}
}
};
const
setVisibleModal
=
(
visible
,
version
,
isForceUpdate
)
=>
{
setVisible
(
visible
);
setVersion
(
version
);
setIsForceUpdate
(
isForceUpdate
);
};
const
_renderDivider
=
()
=>
<
View
style
=
{
styles
.
dividerStyle
}
/>
;
const
cancelUpdate
=
()
=>
{
const
onOutsidePressed
=
()
=>
{
setVisible
(
false
);
setVisible
(
false
);
};
};
const
onUpdatePressed
=
async
()
=>
{
try
{
if
(
Platform
.
OS
===
'ios'
)
{
Linking
.
openURL
(
'itms-apps://itunes.apple.com/us/app/dcv-invest/id1556621903?l=id'
,
);
}
else
{
// try {
// InAppUpdate.checkUpdate()
// } catch(e) {
// console.log(e)
// }
Linking
.
openURL
(
'https://play.google.com/store/apps/details?id=com.dcv.invest'
,
);
}
}
catch
(
error
)
{}
};
const
onRequestClose
=
()
=>
null
;
const
renderBackdrop
=
()
=>
{
return
(
return
(
<
Modal
<
View
onRequestClose
=
{()
=>
onRequestClose
()}
style
=
{{
transparent
backgroundColor
:
'rgba(0,0,0,0.30)'
,
animationType
=
"fade"
// backgroundColor: 'red',
style
=
{{
position
:
'absolute'
}}
position
:
'absolute'
,
visible
=
{
visible
}
top
:
0
,
>
bottom
:
0
,
{
renderBackdrop
()}
left
:
0
,
<
View
pointerEvents
=
"box-none"
style
=
{
styles
.
containerStyle
}
>
right
:
0
,
<
View
style
=
{
styles
.
imageUpgradeContainer
}
zIndex
=
{
100
}
>
<
Image
width
:
getWidth
(),
source
=
{
R
.
images
.
iconUpgrade
}
height
:
getHeight
(),
style
=
{[
styles
.
imageUpgradeStyle
,
{
tintColor
:
R
.
colors
.
main
}]}
/
>
}}
<
/View
>
/
>
<
View
style
=
{
styles
.
contentContainerStyle
}
>
<
Text
style
=
{
styles
.
titleStyle
}
>
{
I18n
.
t
(
'Update'
)}
<
/Text
>
<
Text
style
=
{
styles
.
versionLabelStyle
}
>
{
I18n
.
t
(
'Version'
)}
{
': '
}
{
version
}
<
/Text
>
<
Text
style
=
{
styles
.
descStyle
}
>
{
I18n
.
t
(
'UpdateDescription'
)}
<
/Text
>
{
_renderDivider
()}
{
isForceUpdate
?
<
TouchableOpacity
onPress
=
{()
=>
onUpdatePressed
()}
style
=
{
styles
.
notNowContainerStyle
}
>
<
Text
style
=
{[
styles
.
textNotNowStyle
,
{
color
:
R
.
colors
.
main
}]}
>
{
I18n
.
t
(
'Update'
)}
<
/Text
>
<
/TouchableOpacity
>
:
<
View
style
=
{[
styles
.
notNowContainerStyle
,
{
flexDirection
:
'row'
,
marginHorizontal
:
WIDTHXD
(
100
),
}]}
>
<
TouchableOpacity
onPress
=
{()
=>
cancelUpdate
()}
style
=
{[
styles
.
btnButton
,
{
paddingRight
:
WIDTHXD
(
60
)
}]}
>
<
Text
style
=
{[
styles
.
textNotNowStyle
,
{
color
:
R
.
colors
.
color777
,
textAlign
:
'right'
}]}
>
{
I18n
.
t
(
'Cancel'
)}
<
/Text
>
<
/TouchableOpacity
>
<
View
style
=
{
styles
.
dividerStyleVertical
}
><
/View
>
<
TouchableOpacity
onPress
=
{()
=>
onUpdatePressed
()}
style
=
{[
styles
.
btnButton
,
{
paddingLeft
:
WIDTHXD
(
60
)}]}
>
<
Text
style
=
{[
styles
.
textNotNowStyle
,
{
color
:
R
.
colors
.
main
,
textAlign
:
'left'
}]}
>
{
I18n
.
t
(
'Update'
)}
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
}
<
/View
>
<
/View
>
<
/Modal
>
);
);
};
const
cancelUpdate
=
()
=>
{
setVisible
(
false
);
};
return
(
<
Modal
onRequestClose
=
{()
=>
onRequestClose
()}
transparent
animationType
=
"fade"
style
=
{{
position
:
'absolute'
}}
visible
=
{
visible
}
>
{
renderBackdrop
()}
<
View
pointerEvents
=
"box-none"
style
=
{
styles
.
containerStyle
}
>
<
View
style
=
{
styles
.
imageUpgradeContainer
}
zIndex
=
{
100
}
>
<
Image
source
=
{
R
.
images
.
iconUpgrade
}
style
=
{[
styles
.
imageUpgradeStyle
,
{
tintColor
:
R
.
colors
.
main
}]}
/
>
<
/View
>
<
View
style
=
{
styles
.
contentContainerStyle
}
>
<
Text
style
=
{
styles
.
titleStyle
}
>
{
props
.
language
.
language
==
'vi'
?
'Cập nhật'
:
'Update'
}
<
/Text
>
<
Text
style
=
{
styles
.
versionLabelStyle
}
>
{
I18n
.
t
(
'Version'
)}
{
': '
}
{
version
}
<
/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
()}
{
isForceUpdate
?
(
<
TouchableOpacity
onPress
=
{()
=>
onUpdatePressed
()}
style
=
{
styles
.
notNowContainerStyle
}
>
<
Text
style
=
{[
styles
.
textNotNowStyle
,
{
color
:
R
.
colors
.
main
}]}
>
{
props
.
language
.
language
==
'vi'
?
'Cập nhật'
:
'Update'
}
<
/Text
>
<
/TouchableOpacity
>
)
:
(
<
View
style
=
{[
styles
.
notNowContainerStyle
,
{
flexDirection
:
'row'
,
marginHorizontal
:
WIDTHXD
(
100
),
},
]}
>
<
TouchableOpacity
onPress
=
{()
=>
cancelUpdate
()}
style
=
{[
styles
.
btnButton
,
{
paddingRight
:
WIDTHXD
(
60
)}]}
>
<
Text
style
=
{[
styles
.
textNotNowStyle
,
{
color
:
R
.
colors
.
color777
,
textAlign
:
'right'
},
]}
>
{
props
.
language
.
language
==
'vi'
?
'Bỏ qua'
:
'Cancel'
}
<
/Text
>
<
/TouchableOpacity
>
<
View
style
=
{
styles
.
dividerStyleVertical
}
><
/View
>
<
TouchableOpacity
onPress
=
{()
=>
onUpdatePressed
()}
style
=
{[
styles
.
btnButton
,
{
paddingLeft
:
WIDTHXD
(
60
)}]}
>
<
Text
style
=
{[
styles
.
textNotNowStyle
,
{
color
:
R
.
colors
.
main
,
textAlign
:
'left'
},
]}
>
{
I18n
.
t
(
'Update'
)}
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
)}
<
/View
>
<
/View
>
<
/Modal
>
);
};
};
const
styles
=
StyleSheet
.
create
({
const
styles
=
StyleSheet
.
create
({
imageUpgradeStyle
:
{
imageUpgradeStyle
:
{
width
:
50
,
width
:
50
,
height
:
50
,
height
:
50
,
tintColor
:
R
.
colors
.
primaryColor
,
tintColor
:
R
.
colors
.
primaryColor
,
},
},
imageUpgradeContainer
:
{
imageUpgradeContainer
:
{
width
:
80
,
width
:
80
,
height
:
80
,
height
:
80
,
borderRadius
:
40
,
borderRadius
:
40
,
backgroundColor
:
'white'
,
backgroundColor
:
'white'
,
alignItems
:
'center'
,
alignItems
:
'center'
,
justifyContent
:
'center'
,
justifyContent
:
'center'
,
},
},
containerStyle
:
{
containerStyle
:
{
flex
:
1
,
flex
:
1
,
width
:
getWidth
()
*
0.8
,
width
:
getWidth
()
*
0.8
,
alignSelf
:
'center'
,
alignSelf
:
'center'
,
alignItems
:
'center'
,
alignItems
:
'center'
,
justifyContent
:
'center'
,
justifyContent
:
'center'
,
},
},
contentContainerStyle
:
{
contentContainerStyle
:
{
marginTop
:
-
40
,
marginTop
:
-
40
,
paddingTop
:
40
,
paddingTop
:
40
,
width
:
getWidth
()
*
0.9
,
width
:
getWidth
()
*
0.9
,
backgroundColor
:
'white'
,
backgroundColor
:
'white'
,
alignItems
:
'center'
,
alignItems
:
'center'
,
justifyContent
:
'center'
,
justifyContent
:
'center'
,
borderRadius
:
15
,
borderRadius
:
15
,
},
},
logoStyle
:
{
logoStyle
:
{
width
:
65
,
width
:
65
,
height
:
65
,
height
:
65
,
marginVertical
:
20
,
marginVertical
:
20
,
},
},
titleStyle
:
{
titleStyle
:
{
fontWeight
:
'600'
,
fontWeight
:
'600'
,
fontSize
:
20
,
fontSize
:
20
,
color
:
'black'
,
color
:
'black'
,
paddingHorizontal
:
8
,
paddingHorizontal
:
8
,
textAlign
:
'center'
,
textAlign
:
'center'
,
},
},
versionLabelStyle
:
{
versionLabelStyle
:
{
fontSize
:
14
,
fontSize
:
14
,
color
:
R
.
colors
.
grey600
,
color
:
R
.
colors
.
grey600
,
marginTop
:
5
,
marginTop
:
5
,
marginBottom
:
15
,
marginBottom
:
15
,
paddingHorizontal
:
8
,
paddingHorizontal
:
8
,
textAlign
:
'center'
,
textAlign
:
'center'
,
},
},
descStyle
:
{
descStyle
:
{
fontSize
:
getFontXD
(
46
),
fontSize
:
getFontXD
(
46
),
color
:
R
.
colors
.
grey900
,
color
:
R
.
colors
.
grey900
,
marginBottom
:
20
,
marginBottom
:
20
,
paddingHorizontal
:
10
,
paddingHorizontal
:
10
,
textAlign
:
'center'
,
textAlign
:
'center'
,
},
},
notNowContainerStyle
:
{
notNowContainerStyle
:
{
height
:
HEIGHTXD
(
160
),
height
:
HEIGHTXD
(
160
),
width
:
'100%'
,
width
:
'100%'
,
alignItems
:
'center'
,
alignItems
:
'center'
,
justifyContent
:
'center'
,
justifyContent
:
'center'
,
},
},
btnButton
:
{
btnButton
:
{
flex
:
1
,
flex
:
1
,
},
},
textNotNowStyle
:
{
textNotNowStyle
:
{
fontSize
:
getFontXD
(
46
),
fontSize
:
getFontXD
(
46
),
width
:
'100%'
,
width
:
'100%'
,
textAlign
:
'center'
,
textAlign
:
'center'
,
color
:
R
.
colors
.
primaryColor
,
color
:
R
.
colors
.
primaryColor
,
},
},
starContainer
:
{
starContainer
:
{
flexDirection
:
'row'
,
flexDirection
:
'row'
,
width
:
'100%'
,
width
:
'100%'
,
justifyContent
:
'center'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
alignItems
:
'center'
,
height
:
45
,
height
:
45
,
},
},
dividerStyle
:
{
dividerStyle
:
{
height
:
0.5
,
height
:
0.5
,
width
:
'100%'
,
width
:
'100%'
,
backgroundColor
:
R
.
colors
.
borderC
,
backgroundColor
:
R
.
colors
.
borderC
,
},
},
dividerStyleVertical
:
{
dividerStyleVertical
:
{
height
:
HEIGHTXD
(
160
),
height
:
HEIGHTXD
(
160
),
width
:
0.5
,
width
:
0.5
,
backgroundColor
:
R
.
colors
.
borderC
,
backgroundColor
:
R
.
colors
.
borderC
,
},
},
});
});
export
default
VersionChecker
;
const
mapStateToProps
=
(
state
)
=>
{
return
{
language
:
state
.
languageReducer
,
};
};
export
default
connect
(
mapStateToProps
,
{})(
VersionChecker
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment