Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
new_excelso
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Prasetya Saputra
new_excelso
Commits
3c311b79
Commit
3c311b79
authored
May 15, 2020
by
Afid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handler notification and add icon for notification
parent
f2c03d89
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
4 deletions
+47
-4
App.js
App.js
+42
-2
app.json
app.json
+5
-2
notification.png
assets/icon/notification.png
+0
-0
No files found.
App.js
View file @
3c311b79
...
...
@@ -12,8 +12,8 @@ import i18n from 'i18n-js';
import
en
from
'./lib/en'
;
import
id
from
'./lib/id'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Text
,
View
}
from
'react-native'
;
import
{
AppLoading
}
from
'expo'
;
import
{
Alert
,
Vibration
}
from
'react-native'
;
import
{
AppLoading
,
Notifications
}
from
'expo'
;
import
*
as
Font
from
'expo-font'
;
import
*
as
Sentry
from
'sentry-expo'
;
import
Constants
from
'expo-constants'
;
...
...
@@ -58,8 +58,48 @@ export default function App() {
await
Font
.
loadAsync
(
customFonts
);
};
const
handleNotification
=
notification
=>
{
Vibration
.
vibrate
();
console
.
log
(
'Notification Payload Data : '
+
JSON
.
stringify
(
notification
.
data
))
const
data
=
notification
.
data
;
Alert
.
alert
(
data
.
title
,
data
.
body
,
[
{
text
:
'Close'
,
onPress
:
()
=>
console
.
log
(
'Close'
),
style
:
'cancel'
,
},
{
text
:
'View'
,
onPress
:
()
=>
{
console
.
log
(
'Pindah Halaman'
)
if
(
data
.
action_type
==
'Rewards'
)
{
// props.navigation.navigate('Reward Detail', { rewardId: data.data_id })
}
else
if
(
data
.
action_type
==
'Inbox'
)
{
}
else
if
(
data
.
action_type
==
'Transaction'
)
{
}
else
if
(
data
.
action_type
==
'Review'
)
{
}
else
if
(
data
.
action_type
==
'WebView'
)
{
}
else
if
(
data
.
action_type
==
'Transfer Receive'
)
{
}
else
if
(
data
.
action_type
==
'Cashback'
)
{
}
}
},
],
{
cancelable
:
false
},
)
}
useEffect
(()
=>
{
console
.
log
(
'===> Did Mount'
);
this
.
_notificationSubscription
=
Notifications
.
addListener
(
handleNotification
);
loadFont
().
then
(
_
=>
{
setfontsLoaded
(
true
);
})
...
...
app.json
View file @
3c311b79
...
...
@@ -30,7 +30,7 @@
},
"android"
:
{
"package"
:
"local.ravExcelso"
,
"versionCode"
:
20
200327
"versionCode"
:
20
05151310
},
"description"
:
""
,
"hooks"
:
{
...
...
@@ -45,6 +45,9 @@
}
}
]
},
"notification"
:
{
"icon"
:
"./assets/icon/notification.png"
}
}
}
\ No newline at end of file
assets/icon/notification.png
0 → 100644
View file @
3c311b79
5.5 KB
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