Notification firts commit

### No Issue
This commit is contained in:
2025-12-12 17:50:49 +08:00
parent 2c0198b1b7
commit 43c8c105cf
4 changed files with 139 additions and 20 deletions

View File

@@ -1,10 +1,32 @@
import { AuthProvider } from "@/context/AuthContext";
import AppRoot from "@/screens/RootLayout/AppRoot";
import { useEffect } from "react";
import "react-native-gesture-handler";
import { SafeAreaProvider } from "react-native-safe-area-context";
import Toast from "react-native-toast-message";
import messaging from "@react-native-firebase/messaging";
export default function RootLayout() {
useEffect(() => {
const testFCM = async () => {
if (!messaging().isSupported()) {
console.warn("Firebase Messaging not supported (e.g. Expo Go)");
return;
}
const authStatus = await messaging().requestPermission();
if (authStatus !== messaging.AuthorizationStatus.AUTHORIZED) {
console.warn("Permission not granted");
return;
}
const token = await messaging().getToken();
console.log("✅ FCM Token:", token);
};
testFCM();
}, []);
return (
<>
<SafeAreaProvider>