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
689868b4
Commit
689868b4
authored
Jun 11, 2021
by
Giang Tran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update create otp
parent
ddec860b
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
466 additions
and
285 deletions
+466
-285
WalletDeposit.js
src/Screens/Action/Wallet/WalletDeposit.js
+186
-172
WalletWithdraw.js
src/Screens/Action/Wallet/WalletWithdraw.js
+24
-18
Home.js
src/Screens/Home/Home.js
+7
-4
ChangeSmartOTP.js
src/Screens/SmartOTP/ChangeSmartOTP/ChangeSmartOTP.js
+16
-5
ConfirmChangeSmartOTP.js
src/Screens/SmartOTP/ChangeSmartOTP/ConfirmChangeSmartOTP.js
+16
-4
ConfirmCreate.js
src/Screens/SmartOTP/ConfirmCreate/ConfirmCreate.js
+210
-70
ConfirmCreateView.js
src/Screens/SmartOTP/ConfirmCreate/ConfirmCreateView.js
+1
-1
ConfirmOTPSmart.js
src/Screens/SmartOTP/ConfirmOTPSmart.js
+1
-8
en.js
src/helper/i18/locales/en.js
+2
-1
vn.js
src/helper/i18/locales/vn.js
+2
-1
TabNavigation.js
src/routers/TabNavigation.js
+1
-1
No files found.
src/Screens/Action/Wallet/WalletDeposit.js
View file @
689868b4
import
React
,
{
useState
}
from
'react'
;
import
{
DeviceEventEmitter
,
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'
;
import
TextMulti
from
'../../../components/Input/TextMulti'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
checkFormatArray
,
getFontXD
,
HEIGHTXD
,
toPriceVnd
,
WIDTHXD
}
from
'../../../Config/Functions'
;
import
{
checkFormatArray
,
getFontXD
,
HEIGHTXD
,
toPriceVnd
,
WIDTHXD
,
}
from
'../../../Config/Functions'
;
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
,
SETTINGOTP
,
SMARTOTP
}
from
'../../../routers/ScreenNames'
;
import
{
ENTER_PASSWORD_SMART_OTP
,
SETTINGOTP
,
SMARTOTP
,
CHANGESMARTOTP
,
}
from
'../../../routers/ScreenNames'
;
import
{
showAlert
,
TYPE
}
from
'../../../components/DropdownAlert'
;
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
)
{
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
{
const
index
=
checkFormatArray
([
amount
]);
if
(
index
===
true
)
{
if
(
!
props
.
user
.
smart_otp_status
)
{
confirmAlert
(
`
${
I18n
.
t
(
'YouHaveNotSettingSmartOTP'
)}
`
,
()
=>
{
navigate
.
navigate
(
CHANGESMARTOTP
,
{
TYPE
:
'CREATE_SMART_OTP'
,
old_password
:
null
,
isFromTransaction
:
true
,
setupSmartOTPSuccess
:
()
=>
{
navigate
.
goBack
();
navigate
.
goBack
();
navigate
.
navigate
(
ENTER_PASSWORD_SMART_OTP
,
{
onGoToSmartOTP
:
(
pinCode
,
otp
)
=>
onGoToSmartOTP
(
pinCode
,
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
,
DeviceEventEmitter
.
emit
(
'reloadUserInfo'
);
},
});
},
`
${
I18n
.
t
(
'setting'
)}
`
,
);
}
else
{
navigate
.
navigate
(
ENTER_PASSWORD_SMART_OTP
,
{
onGoToSmartOTP
:
(
pinCode
,
otp
)
=>
onGoToSmartOTP
(
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
>
}
}
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
>
<
/TouchableWithoutFeedback
>
<
/KeyboardAvoidingView
>
);
<
/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
>
);
};
const
styles
=
StyleSheet
.
create
({
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'
,
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'
,
},
});
const
mapStateToProps
=
(
state
)
=>
{
return
{
user
:
state
.
userReducer
,
};
return
{
user
:
state
.
userReducer
,
};
};
export
default
connect
(
mapStateToProps
,
{
showLoading
,
hideLoading
})(
WalletDeposit
,
WalletDeposit
,
);
src/Screens/Action/Wallet/WalletWithdraw.js
View file @
689868b4
...
...
@@ -9,7 +9,8 @@ import {
TouchableWithoutFeedback
,
Keyboard
,
KeyboardAvoidingView
,
ScrollView
,
DeviceEventEmitter
,
ScrollView
,
DeviceEventEmitter
,
}
from
'react-native'
;
import
R
from
'../../../assets/R'
;
import
HeaderBack
from
'../../../components/Header/HeaderBack'
;
...
...
@@ -31,7 +32,9 @@ import {saveUserToRedux} from '../../../actions/users';
import
{
confirmAlert
}
from
'../../../components/Aleart'
;
import
{
ADDMETHODPAY
,
ENTER_PASSWORD_SMART_OTP
,
SETTINGOTP
,
ENTER_PASSWORD_SMART_OTP
,
SETTINGOTP
,
CHANGESMARTOTP
,
}
from
'../../../routers/ScreenNames'
;
import
TextMoney
from
'../../../components/Input/InputMoney'
;
import
I18n
from
'../../../helper/i18/i18n'
;
...
...
@@ -116,21 +119,24 @@ const WalletWithdraw = (props) => {
}
else
{
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'
)}
`
,
`
${
I18n
.
t
(
'YouHaveNotSettingSmartOTP'
)}
`
,
()
=>
{
navigate
.
navigate
(
CHANGESMARTOTP
,
{
TYPE
:
'CREATE_SMART_OTP'
,
old_password
:
null
,
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
,
{
...
...
@@ -334,5 +340,5 @@ const mapStateToProps = (state) => {
export
default
connect
(
mapStateToProps
,
{
showLoading
,
hideLoading
,
saveUserToRedux
saveUserToRedux
,
})(
WalletWithdraw
);
src/Screens/Home/Home.js
View file @
689868b4
...
...
@@ -51,10 +51,13 @@ const Home = (props) => {
useEffect
(()
=>
{
getData
();
initSocket
();
let
reloadUserInfoListener
=
DeviceEventEmitter
.
addListener
(
'reloadUserInfo'
,
(
e
)
=>
{
console
.
log
(
'run in to reloadUserInfo'
);
onRefresh
();
});
let
reloadUserInfoListener
=
DeviceEventEmitter
.
addListener
(
'reloadUserInfo'
,
(
e
)
=>
{
console
.
log
(
'run in to reloadUserInfo'
);
onRefresh
();
},
);
return
()
=>
{
reloadUserInfoListener
.
remove
();
};
...
...
src/Screens/SmartOTP/ChangeSmartOTP/ChangeSmartOTP.js
View file @
689868b4
...
...
@@ -40,11 +40,22 @@ const EnterPasswordSmartOTP = (props) => {
setSecondsNumber
(
null
);
setThirdNumber
(
null
);
setFourNumber
(
null
);
navigation
.
navigate
(
CONFIRMCHANGESMARTOTP
,
{
pre_otp
:
pinCode
,
old_password
:
props
.
route
.
params
.
old_password
,
TYPE
:
props
.
route
.
params
.
TYPE
,
});
if
(
props
.
route
.
params
.
isFromTransaction
)
{
navigation
.
navigate
(
CONFIRMCHANGESMARTOTP
,
{
pre_otp
:
pinCode
,
old_password
:
props
.
route
.
params
.
old_password
,
isFromTransaction
:
props
.
route
.
params
.
isFromTransaction
,
TYPE
:
props
.
route
.
params
.
TYPE
,
setupSmartOTPSuccess
:
props
.
route
.
params
.
setupSmartOTPSuccess
,
});
}
else
{
navigation
.
navigate
(
CONFIRMCHANGESMARTOTP
,
{
pre_otp
:
pinCode
,
old_password
:
props
.
route
.
params
.
old_password
,
TYPE
:
props
.
route
.
params
.
TYPE
,
});
}
};
const
onDeletePress
=
()
=>
{
if
(
fourNumber
)
{
...
...
src/Screens/SmartOTP/ChangeSmartOTP/ConfirmChangeSmartOTP.js
View file @
689868b4
...
...
@@ -74,13 +74,25 @@ const ConfirmChangeSmartOTP = (props) => {
otp_password
:
'1234'
,
type
:
'CREATE_OTP_PASSWORD'
,
});
props
.
hideLoading
();
if
(
res
.
data
.
code
==
200
)
{
showAlert
(
TYPE
.
SUCCESS
,
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
navigation
.
navigate
(
CONFIRMCREATEOTP
,
{
password
:
props
.
route
.
params
.
pre_otp
,
password_confirmation
:
pinCode
,
});
if
(
props
.
route
.
params
.
isFromTransaction
)
{
navigation
.
navigate
(
CONFIRMCREATEOTP
,
{
password
:
props
.
route
.
params
.
pre_otp
,
password_confirmation
:
pinCode
,
isFromTransaction
:
props
.
route
.
params
.
isFromTransaction
,
setupSmartOTPSuccess
:
props
.
route
.
params
.
setupSmartOTPSuccess
,
});
}
else
{
navigation
.
navigate
(
CONFIRMCREATEOTP
,
{
password
:
props
.
route
.
params
.
pre_otp
,
password_confirmation
:
pinCode
,
});
}
}
else
{
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
}
...
...
src/Screens/SmartOTP/ConfirmCreate/ConfirmCreate.js
View file @
689868b4
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
ConfirmCreateView
from
'./ConfirmCreateView'
;
import
{
verifyStoreOTPApiSmart
}
from
'../../../apis/Functions/users'
;
import
React
,
{
Component
,
useEffect
,
useState
}
from
'react'
;
import
{
View
,
Text
,
TextInput
,
StyleSheet
,
TouchableOpacity
,
Platform
,
Alert
,
}
from
'react-native'
;
import
HeaderBack
from
'../../../components/Header/HeaderBack'
;
import
{
showAlert
,
TYPE
}
from
'../../../components/DropdownAlert'
;
import
{
connect
}
from
'react-redux'
;
import
{
hideLoading
,
showLoading
}
from
'../../../actions/loadingAction'
;
import
I18n
from
'../../../helper/i18/i18n'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
CONFIRMCHANGESMARTOTP
,
TABNAVIGATOR
,
}
from
'../../../routers/ScreenNames'
;
const
EnterPasswordSmartOTP
=
(
props
)
=>
{
const
navigation
=
useNavigation
();
const
[
firstNumber
,
setFirstNumber
]
=
useState
(
null
);
const
[
secondsNumber
,
setSecondsNumber
]
=
useState
(
null
);
const
[
thirdNumber
,
setThirdNumber
]
=
useState
(
null
);
const
[
fourNumber
,
setFourNumber
]
=
useState
(
null
);
useEffect
(()
=>
{
if
(
fourNumber
)
{
onCheckPINSmartOTPPin
();
}
},
[
fourNumber
]);
const
onNumberPress
=
(
number
)
=>
{
if
(
!
firstNumber
)
{
setFirstNumber
(
number
.
toString
());
}
else
if
(
!
secondsNumber
)
{
setSecondsNumber
(
number
.
toString
());
}
else
if
(
!
thirdNumber
)
{
setThirdNumber
(
number
.
toString
());
}
else
if
(
!
fourNumber
)
{
setFourNumber
(
number
.
toString
());
}
};
CodeField
,
Cursor
,
useBlurOnFulfill
,
useClearByFocusCell
,
}
from
'react-native-confirmation-code-field'
;
import
{
getFontXD
,
HEIGHTXD
,
WIDTHXD
}
from
'../../../Config/Functions'
;
import
R
from
'../../../assets/R'
;
import
{
NEWPASSWORD
,
TABNAVIGATOR
}
from
'../../../routers/ScreenNames'
;
import
{
verifyOTPApi
,
verifyStoreOTPApiSmart
,
getOTPApiSmartOTP
,
}
from
'../../../apis/Functions/users'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
I18n
from
'../../../helper/i18/i18n'
;
import
AppText
from
'../../../components/AppText'
;
import
{
showLoading
,
hideLoading
}
from
'../../../actions/loadingAction'
;
import
{
connect
}
from
'react-redux'
;
import
{
showAlert
,
TYPE
}
from
'../../../components/DropdownAlert'
;
import
CountDown
from
'../../../components/CountDown'
;
import
{
getOTPApi
}
from
'../../../apis/Functions/users'
;
const
onCheckPINSmartOTPPin
=
async
()
=>
{
let
pinCode
=
`
${
firstNumber
}${
secondsNumber
}${
thirdNumber
}${
fourNumber
}
`
;
setFirstNumber
(
null
);
setSecondsNumber
(
null
);
setThirdNumber
(
null
);
setFourNumber
(
null
);
props
.
showLoading
();
const
res
=
await
verifyStoreOTPApiSmart
({
const
CELL_COUNT
=
4
;
const
ConfirmOTP
=
(
propsa
)
=>
{
const
[
value
,
setValue
]
=
useState
(
''
);
const
[
isReset
,
setReset
]
=
useState
(
false
);
const
navigate
=
useNavigation
();
const
ref
=
useBlurOnFulfill
({
value
,
cellCount
:
CELL_COUNT
});
const
[
props
,
getCellOnLayoutHandler
]
=
useClearByFocusCell
({
value
,
setValue
,
});
const
getOTP
=
async
()
=>
{
propsa
.
showLoading
();
const
res
=
await
getOTPApiSmartOTP
({
platform
:
Platform
.
OS
,
password
:
props
.
route
.
params
.
password
,
password_confirmation
:
props
.
route
.
params
.
password_confirmation
,
otp
:
pinCode
,
otp_by
:
propsa
.
user
.
email
,
otp_password
:
'1234'
,
type
:
'CREATE_OTP_PASSWORD'
,
});
props
.
hideLoading
();
props
a
.
hideLoading
();
if
(
res
.
data
.
code
==
200
)
{
setReset
(
!
isReset
);
showAlert
(
TYPE
.
SUCCESS
,
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
navigation
.
navigate
(
TABNAVIGATOR
);
}
else
{
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
}
};
const
onDeletePress
=
()
=>
{
if
(
fourNumber
)
{
setFourNumber
(
null
);
}
else
if
(
thirdNumber
)
{
setThirdNumber
(
null
);
}
else
if
(
secondsNumber
)
{
setSecondsNumber
(
null
);
}
else
if
(
firstNumber
)
{
setFirstNumber
(
null
);
const
confirm
=
async
()
=>
{
console
.
log
(
propsa
.
route
.
params
);
if
(
!
value
)
{
showAlert
(
TYPE
.
WARN
,
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'EnterOTPRequest'
));
}
else
if
(
value
.
length
!=
4
)
{
showAlert
(
TYPE
.
WARN
,
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'OTPInvalid'
));
}
else
{
propsa
.
showLoading
();
const
res
=
await
verifyStoreOTPApiSmart
({
platform
:
Platform
.
OS
,
password
:
propsa
.
route
.
params
.
password
,
password_confirmation
:
propsa
.
route
.
params
.
password_confirmation
,
otp
:
value
,
type
:
'CREATE_OTP_PASSWORD'
,
});
propsa
.
hideLoading
();
if
(
res
.
data
.
code
==
200
)
{
showAlert
(
TYPE
.
SUCCESS
,
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
if
(
propsa
.
route
.
params
.
isFromTransaction
)
{
propsa
.
route
.
params
.
setupSmartOTPSuccess
();
}
else
{
navigate
.
navigate
(
TABNAVIGATOR
);
}
}
else
{
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
}
}
};
return
(
<
ConfirmCreateView
firstNumber
=
{
firstNumber
}
secondsNumber
=
{
secondsNumber
}
thirdNumber
=
{
thirdNumber
}
fourNumber
=
{
fourNumber
}
onNumberPress
=
{
onNumberPress
}
onDeletePress
=
{
onDeletePress
}
/
>
<
View
style
=
{{
flex
:
1
}}
>
<
HeaderBack
title
=
{
'VerifyOTP'
}
/
>
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{{
height
:
20
}}
/
>
<
View
style
=
{
styles
.
wrap
}
>
<
AppText
i18nKey
=
{
'Verify_code'
}
style
=
{
styles
.
txtTitle
}
/
>
<
View
style
=
{
styles
.
containerCode
}
>
<
CodeField
ref
=
{
ref
}
{...
props
}
value
=
{
value
}
onChangeText
=
{
setValue
}
cellCount
=
{
CELL_COUNT
}
rootStyle
=
{
styles
.
codeFieldRoot
}
keyboardType
=
"number-pad"
textContentType
=
"oneTimeCode"
renderCell
=
{({
index
,
symbol
,
isFocused
})
=>
(
<
View
onLayout
=
{
getCellOnLayoutHandler
(
index
)}
key
=
{
index
}
style
=
{[
styles
.
cellRoot
,
isFocused
&&
styles
.
focusCell
]}
>
<
Text
style
=
{
styles
.
cellText
}
>
{
symbol
||
(
isFocused
?
<
Cursor
/>
:
null
)}
<
/Text
>
<
/View
>
)}
/
>
<
/View
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
footer
}
>
<
TouchableOpacity
onPress
=
{
confirm
}
style
=
{
styles
.
btn
}
>
<
AppText
i18nKey
=
{
'Continue'
}
style
=
{
styles
.
txtBtn
}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{
styles
.
wrapFooter
}
onPress
=
{
getOTP
}
>
<
Text
style
=
{
styles
.
txtNote
}
>
{
I18n
.
t
(
'OTPValidFiveMinute'
)}
<
/Text
>
<
AppText
i18nKey
=
{
'Re_send'
}
style
=
{
styles
.
txtSend
}
/
>
<
/TouchableOpacity
>
<
CountDown
isReset
=
{
isReset
}
/
>
<
/View
>
<
/View
>
);
};
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
paddingVertical
:
20
,
},
footer
:
{
height
:
200
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
},
wrap
:
{
flex
:
1
,
paddingTop
:
30
,
alignItems
:
'center'
,
width
:
'100%'
,
paddingHorizontal
:
50
,
},
containerCode
:
{
height
:
50
,
width
:
'100%'
,
marginTop
:
30
,
},
codeFieldRoot
:
{
marginTop
:
20
,
},
focusCell
:
{
borderColor
:
'#000'
,
},
cellRoot
:
{
width
:
40
,
height
:
40
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
borderBottomColor
:
'#ccc'
,
borderBottomWidth
:
1
,
},
cellText
:
{
color
:
'#000'
,
fontSize
:
36
,
textAlign
:
'center'
,
},
focusCell
:
{
borderBottomColor
:
'#007AFF'
,
borderBottomWidth
:
2
,
},
txtTitle
:
{
fontSize
:
getFontXD
(
52
),
color
:
'#979797'
,
},
btn
:
{
width
:
WIDTHXD
(
521
),
height
:
HEIGHTXD
(
120
),
borderRadius
:
15
,
backgroundColor
:
'#1C6AF6'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
},
txtBtn
:
{
color
:
R
.
colors
.
white
,
fontSize
:
getFontXD
(
52
),
textTransform
:
'uppercase'
,
},
txtSend
:
{
fontSize
:
getFontXD
(
42
),
color
:
'#1C6AF6'
,
},
wrapFooter
:
{
marginTop
:
30
,
flexDirection
:
'row'
,
alignItems
:
'center'
,
},
txtNote
:
{
color
:
'#A2A2A2'
,
fontSize
:
getFontXD
(
42
),
fontStyle
:
'italic'
,
},
});
const
mapStateToProps
=
(
state
)
=>
{
return
{
user
:
state
.
userReducer
,
};
return
{
user
:
state
.
userReducer
};
};
export
default
connect
(
mapStateToProps
,
{
showLoading
,
hideLoading
})(
EnterPasswordSmartOTP
,
);
export
default
connect
(
mapStateToProps
,
{
showLoading
,
hideLoading
})(
ConfirmOTP
);
src/Screens/SmartOTP/ConfirmCreate/ConfirmCreateView.js
View file @
689868b4
...
...
@@ -9,7 +9,7 @@ import Icon from 'react-native-vector-icons/FontAwesome5';
const
ChangeSmartOTPView
=
(
props
)
=>
{
return
(
<
View
style
=
{{
flex
:
1
,
colorBackground
:
R
.
colors
.
white
}}
>
<
HeaderBack
title
=
{
'
ChangeSmart
OTP'
}
/
>
<
HeaderBack
title
=
{
'OTP'
}
/
>
<
Text
style
=
{[
styles
.
textNormal
,
{
marginTop
:
HEIGHTXD
(
40
)}]}
>
{
I18n
.
t
(
'EnterOTPRequest'
)}
<
/Text
>
...
...
src/Screens/SmartOTP/ConfirmOTPSmart.js
View file @
689868b4
import
React
,
{
useState
}
from
'react'
;
import
{
View
,
Text
,
StyleSheet
,
TouchableOpacity
,
Platform
,
}
from
'react-native'
;
import
{
View
,
Text
,
StyleSheet
,
TouchableOpacity
,
Platform
}
from
'react-native'
;
import
HeaderBack
from
'../../components/Header/HeaderBack'
;
import
{
...
...
@@ -30,7 +24,6 @@ import {
getOTPApiSmartOTP
,
}
from
'../../apis/Functions/users'
;
const
CELL_COUNT
=
4
;
const
ConfirmOTPSmart
=
(
propsa
)
=>
{
...
...
src/helper/i18/locales/en.js
View file @
689868b4
...
...
@@ -308,7 +308,7 @@ export default {
SettingOTP
:
'Setting Smart OTP'
,
SettingGeneral
:
'Setting general'
,
ChangeSmartOTP
:
'
Change s
mart OTP'
,
ChangeSmartOTP
:
'
S
mart OTP'
,
Rules
:
'Rules'
,
FAQs
:
'FAQs'
,
...
...
@@ -327,4 +327,5 @@ export default {
ForgotSmartOTP
:
'Forgot Smart OTP'
,
WarnMaxReqestWithdraw
:
'Invalid withdrawal amount'
,
YouHaveNotSettingSmartOTP
:
'You have not installed Smart OTP'
,
OTP
:
'Enter OTP'
,
};
src/helper/i18/locales/vn.js
View file @
689868b4
...
...
@@ -311,7 +311,7 @@ export default {
EnterSmartOTPPINNEW
:
'Vui lòng nhập mã PIN Smart OTP mới'
,
AddSmartOTP
:
'Thêm Smart OTP'
,
ChangeSmartOTP
:
'
Đổi m
ã PIN Smart OTP'
,
ChangeSmartOTP
:
'
M
ã PIN Smart OTP'
,
Rules
:
'Điều khoản và điều kiện'
,
FAQs
:
'FAQs'
,
...
...
@@ -324,4 +324,5 @@ export default {
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'
,
OTP
:
'Nhập OTP'
,
};
src/routers/TabNavigation.js
View file @
689868b4
...
...
@@ -105,7 +105,7 @@ const TabNavigator = (props) => {
return
confirmAlert
(
I18n
.
t
(
'PopupVerifyAccount'
),
()
=>
{
navigate
.
navigate
(
AccountVerification
);
});
}
else
if
(
props
.
user
.
smart_otp_status
)
{
}
else
if
(
!
props
.
user
.
smart_otp_status
)
{
return
confirmAlert
(
props
.
language
.
language
==
'vi'
?
'Bạn có muốn cài đặt Smart OTP?'
...
...
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