diff --git a/android/app/build.gradle b/android/app/build.gradle index 09bec36..32e09c1 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -92,8 +92,8 @@ android { applicationId 'com.bip.hipmimobileapp' minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 1 - versionName "1.0.0" + versionCode 2 + versionName "1.0.1" buildConfigField "String", "REACT_NATIVE_RELEASE_LEVEL", "\"${findProperty('reactNativeReleaseLevel') ?: 'stable'}\"" } @@ -180,3 +180,5 @@ dependencies { implementation jscFlavor } } + +apply plugin: 'com.google.gms.google-services' \ No newline at end of file diff --git a/android/app/google-services.json b/android/app/google-services.json new file mode 100644 index 0000000..b8d5d82 --- /dev/null +++ b/android/app/google-services.json @@ -0,0 +1,29 @@ +{ + "project_info": { + "project_number": "608461535079", + "project_id": "hipmi-badung-connect", + "storage_bucket": "hipmi-badung-connect.firebasestorage.app" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:608461535079:android:4ff12ddc283fb3746761c2", + "android_client_info": { + "package_name": "com.bip.hipmimobileapp" + } + }, + "oauth_client": [], + "api_key": [ + { + "current_key": "AIzaSyBiDtIk3Q9zffFwIdJ5cjqY7e4390JGSkM" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 3fb12db..2963264 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -29,6 +29,12 @@ + + + + + + \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index 0554dd1..e39704a 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -6,6 +6,7 @@ buildscript { mavenCentral() } dependencies { + classpath 'com.google.gms:google-services:4.4.1' classpath('com.android.tools.build:gradle') classpath('com.facebook.react:react-native-gradle-plugin') classpath('org.jetbrains.kotlin:kotlin-gradle-plugin') diff --git a/app.config.js b/app.config.js index bad7663..0c6f37e 100644 --- a/app.config.js +++ b/app.config.js @@ -18,7 +18,7 @@ export default { ITSAppUsesNonExemptEncryption: false, }, associatedDomains: ["applinks:cld-dkr-staging-hipmi.wibudev.com"], - buildNumber: "5", + buildNumber: "7", }, android: { @@ -55,6 +55,7 @@ export default { plugins: [ "expo-router", + "expo-notifications", "expo-web-browser", [ "expo-splash-screen", diff --git a/app/_layout.tsx b/app/_layout.tsx index 462d8aa..51bdd8b 100644 --- a/app/_layout.tsx +++ b/app/_layout.tsx @@ -1,27 +1,10 @@ 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 ( <> diff --git a/bun.lock b/bun.lock index a681a37..2bfe326 100644 --- a/bun.lock +++ b/bun.lock @@ -29,13 +29,13 @@ "expo-image": "~3.0.8", "expo-image-picker": "~17.0.8", "expo-linking": "~8.0.8", - "expo-notifications": "~0.32.12", + "expo-notifications": "~0.32.13", "expo-router": "~6.0.1", "expo-splash-screen": "~31.0.9", "expo-status-bar": "~3.0.8", "expo-symbols": "~1.0.7", "expo-system-ui": "~6.0.7", - "expo-web-browser": "~15.0.7", + "expo-web-browser": "~15.0.9", "lodash": "^4.17.21", "react": "19.1.0", "react-dom": "19.1.0", @@ -1206,7 +1206,7 @@ "expo-modules-core": ["expo-modules-core@3.0.15", "", { "dependencies": { "invariant": "^2.2.4" }, "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-vGI7osd0/IjprldD08k4bckWSu7ID4HhZNP68l/UtilONQ8XZig8mWJd/Fm7i7KGvE3HyuF+HOXE9l671no42Q=="], - "expo-notifications": ["expo-notifications@0.32.12", "", { "dependencies": { "@expo/image-utils": "^0.8.7", "@ide/backoff": "^1.0.0", "abort-controller": "^3.0.0", "assert": "^2.0.0", "badgin": "^1.1.5", "expo-application": "~7.0.7", "expo-constants": "~18.0.9" }, "peerDependencies": { "expo": "*", "react": "*", "react-native": "*" } }, "sha512-FVJ5W4rOpKvmrLJ1Sd5pxiVTV4a7ApgTlKro+E5X8M2TBbXmEVOjs09klzdalXTjlzmU/Gu8aRw9xr7Ea/gZdw=="], + "expo-notifications": ["expo-notifications@0.32.13", "", { "dependencies": { "@expo/image-utils": "^0.8.7", "@ide/backoff": "^1.0.0", "abort-controller": "^3.0.0", "assert": "^2.0.0", "badgin": "^1.1.5", "expo-application": "~7.0.7", "expo-constants": "~18.0.10" }, "peerDependencies": { "expo": "*", "react": "*", "react-native": "*" } }, "sha512-PL0R1ulLVUgAswlXtRDKxBlcipNM3YA6+P5nB5JIhXbsjLJ7y+EKVaEhHhbaGzuK1QVsRQSJNm/4oISX+vsmFQ=="], "expo-router": ["expo-router@6.0.1", "", { "dependencies": { "@expo/metro-runtime": "6.1.1", "@expo/schema-utils": "^0.1.7", "@expo/server": "^0.7.4", "@radix-ui/react-slot": "1.2.0", "@radix-ui/react-tabs": "^1.1.12", "@react-navigation/bottom-tabs": "^7.4.0", "@react-navigation/native": "^7.1.8", "@react-navigation/native-stack": "^7.3.16", "client-only": "^0.0.1", "debug": "^4.3.4", "escape-string-regexp": "^4.0.0", "fast-deep-equal": "^3.1.3", "invariant": "^2.2.4", "nanoid": "^3.3.8", "query-string": "^7.1.3", "react-fast-compare": "^3.2.2", "react-native-is-edge-to-edge": "^1.1.6", "semver": "~7.6.3", "server-only": "^0.0.1", "sf-symbols-typescript": "^2.1.0", "shallowequal": "^1.1.0", "use-latest-callback": "^0.2.1", "vaul": "^1.1.2" }, "peerDependencies": { "@react-navigation/drawer": "^7.5.0", "@testing-library/react-native": ">= 12.0.0", "expo": "*", "expo-constants": "^18.0.8", "expo-linking": "^8.0.8", "react": "*", "react-dom": "*", "react-native": "*", "react-native-gesture-handler": "*", "react-native-reanimated": "*", "react-native-safe-area-context": ">= 5.4.0", "react-native-screens": "*", "react-native-web": "*", "react-server-dom-webpack": ">= 19.0.0" }, "optionalPeers": ["@react-navigation/drawer", "@testing-library/react-native", "react-dom", "react-native-gesture-handler", "react-native-reanimated", "react-native-web", "react-server-dom-webpack"] }, "sha512-5wXkWyNMqUbjCWH0PRkOM0P6UsgLVdgchDkiLz5FY7HfU00ToBcxij965bqtlaATBgoaIo4DuLu6EgxewrKJ8Q=="], @@ -1220,7 +1220,7 @@ "expo-updates-interface": ["expo-updates-interface@2.0.0", "", { "peerDependencies": { "expo": "*" } }, "sha512-pTzAIufEZdVPKql6iMi5ylVSPqV1qbEopz9G6TSECQmnNde2nwq42PxdFBaUEd8IZJ/fdJLQnOT3m6+XJ5s7jg=="], - "expo-web-browser": ["expo-web-browser@15.0.7", "", { "peerDependencies": { "expo": "*", "react-native": "*" } }, "sha512-eXnfO3FQ2WthTA8uEPNJ7SDRfPaLIU/P2k082HGEYIHAFZMwh2o9Wo+SDVytO3E95TAv1qwhggUjOrczYzxteQ=="], + "expo-web-browser": ["expo-web-browser@15.0.9", "", { "peerDependencies": { "expo": "*", "react-native": "*" } }, "sha512-Dj8kNFO+oXsxqCDNlUT/GhOrJnm10kAElH++3RplLydogFm5jTzXYWDEeNIDmV+F+BzGYs+sIhxiBf7RyaxXZg=="], "exponential-backoff": ["exponential-backoff@3.1.2", "", {}, "sha512-8QxYTVXUkuy7fIIoitQkPwGonB8F3Zj8eEO8Sqg9Zv/bkI7RJAzowee4gr81Hak/dUTpA2Z7VfQgoijjPNlUZA=="], diff --git a/ios/HIPMIBadungConnect/HIPMIBadungConnect.entitlements b/ios/HIPMIBadungConnect/HIPMIBadungConnect.entitlements index 7b1ae38..7a318c4 100644 --- a/ios/HIPMIBadungConnect/HIPMIBadungConnect.entitlements +++ b/ios/HIPMIBadungConnect/HIPMIBadungConnect.entitlements @@ -2,6 +2,8 @@ + aps-environment + development com.apple.developer.associated-domains applinks:cld-dkr-staging-hipmi.wibudev.com diff --git a/ios/HIPMIBadungConnect/Info.plist b/ios/HIPMIBadungConnect/Info.plist index e17defa..216ee66 100644 --- a/ios/HIPMIBadungConnect/Info.plist +++ b/ios/HIPMIBadungConnect/Info.plist @@ -39,7 +39,7 @@ CFBundleVersion - 5 + 7 ITSAppUsesNonExemptEncryption LSMinimumSystemVersion diff --git a/package.json b/package.json index 347f12c..5162d79 100644 --- a/package.json +++ b/package.json @@ -36,13 +36,13 @@ "expo-image": "~3.0.8", "expo-image-picker": "~17.0.8", "expo-linking": "~8.0.8", - "expo-notifications": "~0.32.12", + "expo-notifications": "~0.32.13", "expo-router": "~6.0.1", "expo-splash-screen": "~31.0.9", "expo-status-bar": "~3.0.8", "expo-symbols": "~1.0.7", "expo-system-ui": "~6.0.7", - "expo-web-browser": "~15.0.7", + "expo-web-browser": "~15.0.9", "lodash": "^4.17.21", "react": "19.1.0", "react-dom": "19.1.0", diff --git a/screens/Profile/ListPage.tsx b/screens/Profile/ListPage.tsx index 9e0d4b3..e0e7844 100644 --- a/screens/Profile/ListPage.tsx +++ b/screens/Profile/ListPage.tsx @@ -1,6 +1,7 @@ import { IMenuDrawerItem } from "@/components/_Interface/types"; import { AccentColor, MainColor } from "@/constants/color-palet"; import { ICON_SIZE_MEDIUM } from "@/constants/constans-value"; +import { useAuth } from "@/hooks/use-auth"; import { Ionicons } from "@expo/vector-icons"; export const drawerItemsProfile = ({ @@ -10,6 +11,8 @@ export const drawerItemsProfile = ({ id: string; isAdmin: boolean; }) => { + const { user } = useAuth(); + const adminItems: IMenuDrawerItem[] = [ { icon: ( @@ -21,6 +24,7 @@ export const drawerItemsProfile = ({ ), label: "Edit profile", path: `/(application)/profile/${id}/edit`, + value: "edit-profile", }, { icon: ( @@ -32,6 +36,7 @@ export const drawerItemsProfile = ({ ), label: "Ubah foto profile", path: `/(application)/profile/${id}/update-photo`, + value: "update-photo", }, { icon: ( @@ -43,6 +48,7 @@ export const drawerItemsProfile = ({ ), label: "Ubah latar belakang", path: `/(application)/profile/${id}/update-background`, + value: "update-background", }, { icon: ( @@ -54,6 +60,7 @@ export const drawerItemsProfile = ({ ), label: "Tambah portofolio", path: `/(application)/portofolio/${id}/create`, + value: "create-portofolio", }, { icon: ( @@ -65,6 +72,20 @@ export const drawerItemsProfile = ({ ), label: "Dashboard Admin", path: `/(application)/admin/dashboard`, + value: "dashboard-admin", + }, + { + icon: ( + + ), + label: "Hapus Akun", + color: MainColor.red, + path: `https://cld-dkr-staging-hipmi.wibudev.com/delete-account?phone=${user?.nomor}`, + value: "delete-account", }, { icon: ( @@ -77,6 +98,7 @@ export const drawerItemsProfile = ({ label: "Keluar", color: MainColor.red, path: "", + value: "logout", }, ]; @@ -91,6 +113,7 @@ export const drawerItemsProfile = ({ ), label: "Edit profile", path: `/(application)/profile/${id}/edit`, + value: "edit-profile", }, { icon: ( @@ -102,6 +125,7 @@ export const drawerItemsProfile = ({ ), label: "Ubah foto profile", path: `/(application)/profile/${id}/update-photo`, + value: "update-photo", }, { icon: ( @@ -113,6 +137,7 @@ export const drawerItemsProfile = ({ ), label: "Ubah latar belakang", path: `/(application)/profile/${id}/update-background`, + value: "update-background", }, { icon: ( @@ -124,6 +149,20 @@ export const drawerItemsProfile = ({ ), label: "Tambah portofolio", path: `/(application)/portofolio/${id}/create`, + value: "create-portofolio", + }, + { + icon: ( + + ), + label: "Hapus Akun", + color: MainColor.red, + path: `https://cld-dkr-staging-hipmi.wibudev.com/delete-account?phone=${user?.nomor}`, + value: "delete-account", }, { icon: ( @@ -136,6 +175,7 @@ export const drawerItemsProfile = ({ label: "Keluar", color: MainColor.red, path: "", + value: "logout", }, ]; diff --git a/screens/Profile/menuDrawerSection.tsx b/screens/Profile/menuDrawerSection.tsx index 58d08bb..89b4468 100644 --- a/screens/Profile/menuDrawerSection.tsx +++ b/screens/Profile/menuDrawerSection.tsx @@ -1,6 +1,8 @@ import { AlertDefaultSystem } from "@/components"; import { IMenuDrawerItem } from "@/components/_Interface/types"; import MenuDrawerDynamicGrid from "@/components/Drawer/MenuDrawerDynamicGird"; +import { useAuth } from "@/hooks/use-auth"; +import { openBrowser } from "@/utils/openBrower"; import { router } from "expo-router"; export default function Profile_MenuDrawerSection({ @@ -13,7 +15,8 @@ export default function Profile_MenuDrawerSection({ logout: () => Promise; }) { const handlePress = (item: IMenuDrawerItem) => { - if (item.label === "Keluar") { + // console.log("ITEM >> ", item); + if (item.value === "logout") { // console.log("Logout clicked"); // setShowLogoutAlert(true); AlertDefaultSystem({ @@ -27,6 +30,9 @@ export default function Profile_MenuDrawerSection({ }, onPressLeft: () => setIsDrawerOpen(false), }); + } else if (item.value === "delete-account") { + console.log("PATH >> ", item.path); + openBrowser(item.path as any); } else { console.log("PATH >> ", item.path); router.push(item.path as any); @@ -43,6 +49,7 @@ export default function Profile_MenuDrawerSection({ label: item.label, path: item.path as any, color: item.color, + value: item.value, }))} columns={4} // Ubah ke 2 jika ingin 2 kolom per baris onPressItem={(item) => handlePress(item as any)} diff --git a/utils/notifications.ts b/utils/notifications.ts index 9715c08..31879e1 100644 --- a/utils/notifications.ts +++ b/utils/notifications.ts @@ -1,7 +1,8 @@ // utils/notifications.ts -import * as Device from 'expo-device'; import * as Notifications from 'expo-notifications'; import Constants from 'expo-constants'; +import * as Device from 'expo-device'; + Notifications.setNotificationHandler({ handleNotification: async () => ({ @@ -13,7 +14,7 @@ Notifications.setNotificationHandler({ }), }); -export async function registerForPushNotificationsAsync() { +export default async function registerForPushNotificationsAsync() { if (!Device.isDevice) { console.warn("Push notifications don't work on simulator"); return null; diff --git a/utils/openBrower.ts b/utils/openBrower.ts new file mode 100644 index 0000000..37cb380 --- /dev/null +++ b/utils/openBrower.ts @@ -0,0 +1,9 @@ +import * as WebBrowser from "expo-web-browser"; + +export const openBrowser = async (url: string) => { + try { + await WebBrowser.openBrowserAsync(url); + } catch (error) { + console.error("Gagal membuka browser:", error); + } +}; \ No newline at end of file