diff --git a/app.json b/app.json index a620a94..9166324 100644 --- a/app.json +++ b/app.json @@ -18,7 +18,7 @@ "android": { "package": "mobiledarmasaba.app", "adaptiveIcon": { - "foregroundImage": "./assets/images/adaptive-icon.png", + "foregroundImage": "./assets/images/splash-icon.png", "backgroundColor": "#ffffff" }, "googleServicesFile": "./google-services.json" diff --git a/components/auth/viewLogin.tsx b/components/auth/viewLogin.tsx index b0d7788..efa875f 100644 --- a/components/auth/viewLogin.tsx +++ b/components/auth/viewLogin.tsx @@ -33,7 +33,7 @@ export default function ViewLogin({ onValidate }: Props) { return ToastAndroid.show(response.message, ToastAndroid.SHORT) } catch (error) { console.error('Error fetching data:', error); - return ToastAndroid.show('Terjadi kesalahan', ToastAndroid.SHORT) + return ToastAndroid.show(`Terjadi kesalahan ${error}`, ToastAndroid.SHORT) } finally { setLoadingLogin(false) } diff --git a/eas.json b/eas.json index 145f1bf..4804edb 100644 --- a/eas.json +++ b/eas.json @@ -9,7 +9,10 @@ "distribution": "internal" }, "preview": { - "distribution": "internal" + "distribution": "internal", + "android": { + "buildType": "apk" + } }, "production": { "autoIncrement": true diff --git a/providers/NotificationProvider.tsx b/providers/NotificationProvider.tsx deleted file mode 100644 index 9ae06dc..0000000 --- a/providers/NotificationProvider.tsx +++ /dev/null @@ -1,89 +0,0 @@ -import { registerForPushNotificationsAsync } from "@/lib/registerForPushNotificationsAsync"; -import { Subscription } from "expo-modules-core"; -import * as Notifications from "expo-notifications"; -import React, { - createContext, - ReactNode, - useContext, - useEffect, - useRef, - useState, -} from "react"; - -interface NotificationContextType { - expoPushToken: string | null; - notification: Notifications.Notification | null; - error: Error | null; -} - -const NotificationContext = createContext( - undefined -); - -export const useNotification = () => { - const context = useContext(NotificationContext); - if (context === undefined) { - throw new Error( - "useNotification must be used within a NotificationProvider" - ); - } - return context; -}; - -interface NotificationProviderProps { - children: ReactNode; -} - -export const NotificationProvider: React.FC = ({ - children, -}) => { - const [expoPushToken, setExpoPushToken] = useState(null); - const [notification, setNotification] = - useState(null); - const [error, setError] = useState(null); - - const notificationListener = useRef(); - const responseListener = useRef(); - - useEffect(() => { - registerForPushNotificationsAsync().then( - (token) => setExpoPushToken(token), - (error) => setError(error) - ); - - notificationListener.current = - Notifications.addNotificationReceivedListener((notification) => { - console.log("🔔 Notification Received: ", notification); - setNotification(notification); - }); - - responseListener.current = - Notifications.addNotificationResponseReceivedListener((response) => { - console.log( - "🔔 Notification Response: ", - JSON.stringify(response, null, 2), - JSON.stringify(response.notification.request.content.data, null, 2) - ); - // Handle the notification response here - }); - - return () => { - if (notificationListener.current) { - Notifications.removeNotificationSubscription( - notificationListener.current - ); - } - if (responseListener.current) { - Notifications.removeNotificationSubscription(responseListener.current); - } - }; - }, []); - - return ( - - {children} - - ); -}; \ No newline at end of file