upd: notifikasi diskusi umum
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||
import { getApp, getApps, initializeApp } from '@react-native-firebase/app';
|
||||
import messaging, { getMessaging } from '@react-native-firebase/messaging';
|
||||
import { useEffect } from 'react';
|
||||
@@ -24,9 +25,18 @@ const initializeFirebase = async () => {
|
||||
|
||||
// Set auto initialization and background message handler
|
||||
mess.setAutoInitEnabled(true);
|
||||
// mess.setBackgroundMessageHandler(async remoteMessage => {
|
||||
// // console.log('Message handled in the background!', remoteMessage);
|
||||
// // pushToPage(String(remoteMessage?.data?.category), String(remoteMessage?.data?.content))
|
||||
// });
|
||||
|
||||
mess.setBackgroundMessageHandler(async remoteMessage => {
|
||||
// console.log('Message handled in the background!', remoteMessage);
|
||||
// pushToPage(String(remoteMessage?.data?.category), String(remoteMessage?.data?.content))
|
||||
const screen = remoteMessage?.data?.category;
|
||||
const content = remoteMessage?.data?.content;
|
||||
|
||||
if (screen && content) {
|
||||
await AsyncStorage.setItem('navigateOnOpen', JSON.stringify({ screen, content }));
|
||||
}
|
||||
});
|
||||
|
||||
return mess
|
||||
|
||||
Reference in New Issue
Block a user