upd: notifikasi diskusi umum

This commit is contained in:
2025-08-06 11:58:54 +08:00
parent 1e2069ca42
commit 5db712d4b9
2 changed files with 34 additions and 4 deletions

View File

@@ -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