Skip to content

Commit

Permalink
[#64][#144] Add sync submission notification listener
Browse files Browse the repository at this point in the history
  • Loading branch information
wayangalihpratama committed Aug 24, 2023
1 parent 3e01414 commit 30992cf
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions app/src/navigation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,16 @@ const RootNavigator = () => {
const notificationListener = Notifications.addNotificationReceivedListener((notification) => {
console.log('[Notification]Received Listener');
});
const responseListener = Notifications.addNotificationResponseReceivedListener((response) => {
console.log('[Notification]Response Listener');
backgroundTask.syncFormVersion({ showNotificationOnly: false });
const responseListener = Notifications.addNotificationResponseReceivedListener((res) => {
const notificationBody = res?.notification?.request;
const notificationType = notificationBody?.content?.data?.notificationType;
console.log('[Notification]Response Listener', notificationBody);
if (notificationType === 'sync-form-version') {
backgroundTask.syncFormVersion({ showNotificationOnly: false });
}
if (notificationType === 'sync-form-submission') {
console.info('[Notification]Response Listener => ', notificationType);
}
});
return () => {
Notifications.removeNotificationSubscription(notificationListener);
Expand Down

0 comments on commit 30992cf

Please sign in to comment.