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
de87d1fc
Commit
de87d1fc
authored
May 11, 2021
by
Giang Tran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update status
parent
67d5a8be
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
1 deletion
+24
-1
users.js
src/apis/Functions/users.js
+5
-0
url.js
src/apis/url.js
+1
-0
FirebaseNotification.js
src/helper/FirebaseNotification.js
+18
-1
No files found.
src/apis/Functions/users.js
View file @
de87d1fc
...
...
@@ -57,6 +57,11 @@ export const updateLangugeApi = async (body) =>
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
err
);
export
const
getDetailUser
=
async
(
body
)
=>
GetData
(
url
.
urlGetDetailUser
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
err
);
export
const
getNewestVersionInfo
=
async
(
body
)
=>
GetData
(
url
.
urlGetNewestVersionInfo
,
body
)
.
then
((
res
)
=>
res
)
...
...
src/apis/url.js
View file @
de87d1fc
...
...
@@ -22,6 +22,7 @@ export default {
urlAddMethodBank
:
root
+
'api/v1/customers/store-payment-method'
,
urlDeleteMethodBank
:
root
+
'api/v1/customers/delete-payment-method'
,
urlUpdateMethodBank
:
root
+
'api/v1/customers/update-payment-method'
,
urlGetDetailUser
:
root
+
'api/v1/customers/detail'
,
//Home
...
...
src/helper/FirebaseNotification.js
View file @
de87d1fc
...
...
@@ -6,11 +6,24 @@ import AsyncStorage from '@react-native-community/async-storage';
import
KEY
from
'../assets/AsynStorage'
;
import
{
showNotificaton
,
updateNotification
}
from
'../actions/SnackBarAction'
;
import
{
connect
}
from
'react-redux'
;
import
{
saveUserToRedux
}
from
'../actions/users'
;
import
{
newScreenInit
}
from
'../actions/ScreenInitAction'
;
import
{
getDetailUser
}
from
'../apis/Functions/users'
;
import
{
convertScreen
}
from
'../Config/Functions'
;
const
FirebaseNotification
=
(
props
)
=>
{
const
refetchDataUser
=
async
()
=>
{
const
res
=
await
getDetailUser
({
id
:
props
.
user
.
uid
,
platform
:
Platform
.
OS
,
});
console
.
log
(
'res'
,
res
.
data
.
data
);
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
props
.
saveUserToRedux
(
res
.
data
.
data
);
}
};
messaging
().
setBackgroundMessageHandler
(
async
(
remoteMessage
)
=>
{
console
.
log
(
'Message handled in the background!'
,
remoteMessage
);
});
...
...
@@ -26,6 +39,9 @@ const FirebaseNotification = (props) => {
const
unsubscribe
=
messaging
().
onMessage
(
async
(
remoteMessage
)
=>
{
console
.
log
(
'A new FCM message arrived!'
,
remoteMessage
.
data
);
const
{
action_type
,
body
,
title
,
record_id
}
=
remoteMessage
.
data
;
if
(
action_type
!=
'CUSTOMER_NEWS'
)
refetchDataUser
();
props
.
showNotificaton
({
title
,
content
:
body
,
...
...
@@ -91,7 +107,7 @@ const FirebaseNotification = (props) => {
const
mapStateToProps
=
(
state
)
=>
{
return
{
loadingModal
:
state
.
ModalLoading
Reducer
,
user
:
state
.
user
Reducer
,
};
};
...
...
@@ -99,4 +115,5 @@ export default connect(mapStateToProps, {
showNotificaton
,
newScreenInit
,
updateNotification
,
saveUserToRedux
,
})(
FirebaseNotification
);
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