-  google-services.json
- utils/notifications.ts

Fix:
- app.config.js : tambah access googleServicesFile
- app/_layout.tsx : tambah untuk push notifikasi
- package.json: install install expo-notifications expo-device expo-constants

### No Issue
This commit is contained in:
2025-11-14 17:44:22 +08:00
parent 8c3aec8e57
commit 76debfd6a6
6 changed files with 137 additions and 4 deletions

View File

@@ -1,10 +1,27 @@
import { AuthProvider } from "@/context/AuthContext";
import AppRoot from "@/screens/RootLayout/AppRoot";
import { registerForPushNotificationsAsync } from "@/utils/notifications";
import { useEffect } from "react";
import "react-native-gesture-handler";
import { SafeAreaProvider } from "react-native-safe-area-context";
import Toast from "react-native-toast-message";
export default function RootLayout() {
useEffect(() => {
// Jalankan sekali saat app pertama kali dibuka
registerForPushNotificationsAsync().then((token) => {
if (token) {
// TODO: Kirim token ke backend kamu
// Contoh:
// fetch('https://api.hipmibadung.id/save-token', {
// method: 'POST',
// headers: { 'Content-Type': 'application/json' },
// body: JSON.stringify({ token })
// });
}
});
}, []);
return (
<>
<SafeAreaProvider>