Filter console dan clean code

Add:
- service/api-device-token.ts

Fix:
- app/(application)/(user)/home.tsx
- app/(application)/(user)/test-notifications.tsx
- app/_layout.tsx
- components/_ShareComponent/NotificationInitializer.tsx
- context/AuthContext.tsx
- hooks/use-foreground-notifications.ts
- screens/Home/HeaderBell.tsx
- service/api-notifications.ts

### No Issue
This commit is contained in:
2025-12-17 17:46:28 +08:00
parent 05c1cac10f
commit a01a9bd93f
9 changed files with 110 additions and 116 deletions

View File

@@ -1,5 +1,7 @@
import { useEffect } from "react";
import messaging, {
import {
getMessaging,
onMessage,
FirebaseMessagingTypes,
} from "@react-native-firebase/messaging";
@@ -10,7 +12,9 @@ export function useForegroundNotifications(
onMessageReceived: (message: RemoteMessage) => void
) {
useEffect(() => {
const unsubscribe = messaging().onMessage((remoteMessage) => {
const messaging = getMessaging();
const unsubscribe = onMessage(messaging, (remoteMessage) => {
console.log(
"🔔 Notifikasi diterima saat app aktif:",
JSON.stringify(remoteMessage, null, 2)
@@ -20,4 +24,4 @@ export function useForegroundNotifications(
return unsubscribe;
}, [onMessageReceived]);
}
}