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/(application)/(user)/_layout.tsx b/app/(application)/(user)/_layout.tsx index 657c4ce..b55638e 100644 --- a/app/(application)/(user)/_layout.tsx +++ b/app/(application)/(user)/_layout.tsx @@ -10,6 +10,13 @@ export default function UserLayout() { return ( <> + , + }} + /> { + if (text !== "Delete Account") { + return Toast.show({ + type: "error", + text1: "Ketik 'Delete Account' untuk menghapus akun", + }); + } + + AlertDefaultSystem({ + title: "Anda yakin akan menghapus akun ini?", + message: + "Semua data yang pernah anda buat akan terhapus secara permanen !", + textLeft: "Batal", + textRight: "Ya", + onPressRight: async () => { + try { + setLoading(true); + const response = await apiDeleteUser({ id: user?.id as string }); + + if (response.success) { + console.log("RESPONSE >> ", response); + Toast.show({ + type: "success", + text1: "Akun berhasil dihapus", + }); + + setTimeout(() => { + logout(); + setLoading(false); + }, 2000); + } else { + Toast.show({ + type: "error", + text1: "Gagal menghapus akun", + }); + setLoading(false); + } + } catch (error) { + console.log("ERROR >> ", error); + setLoading(false); + } + }, + }); + }; + + return ( + <> + + + + + + + + + Anda akan menghapus akun dengan nomor +{phone} + + + Ketik 'Delete Account' untuk menghapus akun + + + + + Submit + + + + + + + ); +} 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/assets/images/constants/logo-hipmi.png b/assets/images/constants/logo-hipmi.png index d182ad0..a1dedb3 100644 Binary files a/assets/images/constants/logo-hipmi.png and b/assets/images/constants/logo-hipmi.png differ diff --git a/assets/images/constants/logo-hipmi_back.png b/assets/images/constants/logo-hipmi_back.png new file mode 100644 index 0000000..d182ad0 Binary files /dev/null and b/assets/images/constants/logo-hipmi_back.png differ diff --git a/bun.lock b/bun.lock index a681a37..c15cfc7 100644 --- a/bun.lock +++ b/bun.lock @@ -19,9 +19,9 @@ "expo": "^54.0.0", "expo-camera": "~17.0.7", "expo-clipboard": "~8.0.7", - "expo-constants": "~18.0.10", + "expo-constants": "^18.0.10", "expo-dev-client": "~6.0.12", - "expo-device": "~8.0.9", + "expo-device": "^8.0.9", "expo-document-picker": "~14.0.7", "expo-file-system": "^19.0.15", "expo-font": "~14.0.8", @@ -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/components/Grid/GridCustom.tsx b/components/Grid/GridCustom.tsx index fdfc787..e23243e 100644 --- a/components/Grid/GridCustom.tsx +++ b/components/Grid/GridCustom.tsx @@ -109,6 +109,7 @@ const styles = StyleSheet.create({ flexDirection: "row", flexWrap: "wrap", justifyContent: "flex-start", - marginInline: 0.1 + // marginInline: 0.1 + margin: 0.1 }, }); diff --git a/ios/HIPMIBadungConnect.xcodeproj/project.pbxproj b/ios/HIPMIBadungConnect.xcodeproj/project.pbxproj index b574e81..88b92e1 100644 --- a/ios/HIPMIBadungConnect.xcodeproj/project.pbxproj +++ b/ios/HIPMIBadungConnect.xcodeproj/project.pbxproj @@ -294,8 +294,11 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-HIPMIBadungConnect/Pods-HIPMIBadungConnect-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/EXApplication/ExpoApplication_privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/EXConstants/EXConstants.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/EXConstants/ExpoConstants_privacy.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/EXNotifications/ExpoNotifications_privacy.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/ExpoDevice/ExpoDevice_privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/ExpoFileSystem/ExpoFileSystem_privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/ExpoSystemUI/ExpoSystemUI_privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/RNCAsyncStorage/RNCAsyncStorage_resources.bundle", @@ -328,8 +331,11 @@ ); name = "[CP] Copy Pods Resources"; outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoApplication_privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXConstants.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoConstants_privacy.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoNotifications_privacy.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoDevice_privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoFileSystem_privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoSystemUI_privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RNCAsyncStorage_resources.bundle", 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/ios/HIPMIBadungConnect/PrivacyInfo.xcprivacy b/ios/HIPMIBadungConnect/PrivacyInfo.xcprivacy index 5bb83c5..c6b452e 100644 --- a/ios/HIPMIBadungConnect/PrivacyInfo.xcprivacy +++ b/ios/HIPMIBadungConnect/PrivacyInfo.xcprivacy @@ -4,6 +4,16 @@ NSPrivacyAccessedAPITypes + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + C617.1 + 0A2A.1 + 3B52.1 + + NSPrivacyAccessedAPIType NSPrivacyAccessedAPICategoryUserDefaults @@ -14,12 +24,10 @@ NSPrivacyAccessedAPIType - NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPICategorySystemBootTime NSPrivacyAccessedAPITypeReasons - 0A2A.1 - 3B52.1 - C617.1 + 35F9.1 @@ -31,14 +39,6 @@ 85F4.1 - - NSPrivacyAccessedAPIType - NSPrivacyAccessedAPICategorySystemBootTime - NSPrivacyAccessedAPITypeReasons - - 35F9.1 - - NSPrivacyCollectedDataTypes diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 516649c..be278fd 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,5 +1,7 @@ PODS: - - EXConstants (18.0.8): + - EXApplication (7.0.7): + - ExpoModulesCore + - EXConstants (18.0.10): - ExpoModulesCore - EXImageLoader (6.0.0): - ExpoModulesCore @@ -7,6 +9,8 @@ PODS: - EXJSONUtils (0.15.0) - EXManifests (1.0.8): - ExpoModulesCore + - EXNotifications (0.32.13): + - ExpoModulesCore - Expo (54.0.2): - ExpoModulesCore - hermes-engine @@ -211,6 +215,8 @@ PODS: - ZXingObjC/PDF417 - ExpoClipboard (8.0.7): - ExpoModulesCore + - ExpoDevice (8.0.9): + - ExpoModulesCore - ExpoDocumentPicker (14.0.7): - ExpoModulesCore - ExpoFileSystem (19.0.15): @@ -264,7 +270,7 @@ PODS: - ExpoModulesCore - ExpoSystemUI (6.0.7): - ExpoModulesCore - - ExpoWebBrowser (15.0.7): + - ExpoWebBrowser (15.0.9): - ExpoModulesCore - EXUpdatesInterface (2.0.0): - ExpoModulesCore @@ -2422,10 +2428,12 @@ PODS: - ZXingObjC/Core DEPENDENCIES: + - EXApplication (from `../node_modules/expo-application/ios`) - EXConstants (from `../node_modules/expo-constants/ios`) - EXImageLoader (from `../node_modules/expo-image-loader/ios`) - EXJSONUtils (from `../node_modules/expo-json-utils/ios`) - EXManifests (from `../node_modules/expo-manifests/ios`) + - EXNotifications (from `../node_modules/expo-notifications/ios`) - Expo (from `../node_modules/expo`) - expo-dev-client (from `../node_modules/expo-dev-client/ios`) - expo-dev-launcher (from `../node_modules/expo-dev-launcher`) @@ -2434,6 +2442,7 @@ DEPENDENCIES: - ExpoAsset (from `../node_modules/expo-asset/ios`) - ExpoCamera (from `../node_modules/expo-camera/ios`) - ExpoClipboard (from `../node_modules/expo-clipboard/ios`) + - ExpoDevice (from `../node_modules/expo-device/ios`) - ExpoDocumentPicker (from `../node_modules/expo-document-picker/ios`) - ExpoFileSystem (from `../node_modules/expo-file-system/ios`) - ExpoFont (from `../node_modules/expo-font/ios`) @@ -2543,6 +2552,8 @@ SPEC REPOS: - ZXingObjC EXTERNAL SOURCES: + EXApplication: + :path: "../node_modules/expo-application/ios" EXConstants: :path: "../node_modules/expo-constants/ios" EXImageLoader: @@ -2551,6 +2562,8 @@ EXTERNAL SOURCES: :path: "../node_modules/expo-json-utils/ios" EXManifests: :path: "../node_modules/expo-manifests/ios" + EXNotifications: + :path: "../node_modules/expo-notifications/ios" Expo: :path: "../node_modules/expo" expo-dev-client: @@ -2567,6 +2580,8 @@ EXTERNAL SOURCES: :path: "../node_modules/expo-camera/ios" ExpoClipboard: :path: "../node_modules/expo-clipboard/ios" + ExpoDevice: + :path: "../node_modules/expo-device/ios" ExpoDocumentPicker: :path: "../node_modules/expo-document-picker/ios" ExpoFileSystem: @@ -2760,10 +2775,12 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/yoga" SPEC CHECKSUMS: - EXConstants: 7e4654405af367ff908c863fe77a8a22d60bd37d + EXApplication: 296622817d459f46b6c5fe8691f4aac44d2b79e7 + EXConstants: fd688cef4e401dcf798a021cfb5d87c890c30ba3 EXImageLoader: 189e3476581efe3ad4d1d3fb4735b7179eb26f05 EXJSONUtils: 1d3e4590438c3ee593684186007028a14b3686cd EXManifests: 224345a575fca389073c416297b6348163f28d1a + EXNotifications: a62e1f8e3edd258dc3b155d3caa49f32920f1c6c Expo: 9e6ddfbc1f5aefde22029899293c701f1d34c2b1 expo-dev-client: f3434d6ca09ecb14ae48c2a3912bdbb07464cc85 expo-dev-launcher: b9538b1e0dc3fd2ddad75017b6ee9c8dfb206925 @@ -2772,6 +2789,7 @@ SPEC CHECKSUMS: ExpoAsset: 84810d6fed8179f04d4a7a4a6b37028bbd726e26 ExpoCamera: ae1d6691b05b753261a845536d2b19a9788a8750 ExpoClipboard: af650d14765f19c60ce2a1eaf9dfe6445eff7365 + ExpoDevice: 148accb4071873d19fba80a2506c58ffa433d620 ExpoDocumentPicker: 2200eefc2817f19315fa18f0147e0b80ece86926 ExpoFileSystem: 5fb091ea11198e109ceef2bdef2e6e66523e62c4 ExpoFont: 86ceec09ffed1c99cfee36ceb79ba149074901b5 @@ -2785,7 +2803,7 @@ SPEC CHECKSUMS: ExpoSplashScreen: 0634b705953e6934a5156397162eefc1ee5d6a7c ExpoSymbols: 1ae04ce686de719b9720453b988d8bc5bf776c68 ExpoSystemUI: 6cd74248a2282adf6dec488a75fa532d69dee314 - ExpoWebBrowser: 533bc2a1b188eec1c10e4926decf658f1687b5e5 + ExpoWebBrowser: b973e1351fdcf5fec0c400997b1851f5a8219ec3 EXUpdatesInterface: 5adf50cb41e079c861da6d9b4b954c3db9a50734 FBLazyVector: 9e0cd874afd81d9a4d36679daca991b58b260d42 hermes-engine: 35c763d57c9832d0eef764316ca1c4d043581394 diff --git a/package.json b/package.json index 347f12c..d75d616 100644 --- a/package.json +++ b/package.json @@ -26,9 +26,9 @@ "expo": "^54.0.0", "expo-camera": "~17.0.7", "expo-clipboard": "~8.0.7", - "expo-constants": "~18.0.10", + "expo-constants": "^18.0.10", "expo-dev-client": "~6.0.12", - "expo-device": "~8.0.9", + "expo-device": "^8.0.9", "expo-document-picker": "~14.0.7", "expo-file-system": "^19.0.15", "expo-font": "~14.0.8", @@ -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/Authentication/VerificationView.tsx b/screens/Authentication/VerificationView.tsx index 6b4e9af..0be0100 100644 --- a/screens/Authentication/VerificationView.tsx +++ b/screens/Authentication/VerificationView.tsx @@ -5,6 +5,7 @@ import { MainColor } from "@/constants/color-palet"; import { useAuth } from "@/hooks/use-auth"; import { apiCheckCodeOtp } from "@/service/api-config"; import { GStyles } from "@/styles/global-styles"; +import { registerForPushNotificationsAsync } from "@/utils/notifications"; import AsyncStorage from "@react-native-async-storage/async-storage"; import { router, useLocalSearchParams } from "expo-router"; import { useEffect, useState } from "react"; @@ -28,7 +29,7 @@ export default function VerificationView() { nomor === "6282340374412"; // --- Context --- - const { validateOtp, isLoading } = useAuth(); + const { validateOtp, isLoading, loginWithNomor } = useAuth(); useEffect(() => { setUserNumber(nomor?.replace(/^\+/, "") || ""); @@ -70,6 +71,9 @@ export default function VerificationView() { try { setLoading(true); + await loginWithNomor(nomor as string); + setRecodeOtp(true); + // ❌ Kamu tidak punya nomor di sini, jadi pastikan `nomor` tersedia // Sebaiknya simpan nomor saat login, atau gunakan dari `useLocalSearchParams` router.setParams({ nomor }); // opsional @@ -100,6 +104,14 @@ export default function VerificationView() { // 🔁 VERIFIKASI NORMAL (untuk pengguna sungguhan) try { const response = await validateOtp(nomor as string); + // registerForPushNotificationsAsync().then((token) => { + // if (token) { + // console.log("Expo Push Token:", token); + // // TODO: Kirim token ke backend kamu + // } else { + // console.log("Failed to get Expo Push Token"); + // } + // }); router.replace(response); } catch (error) { console.log("Error verification", error); diff --git a/screens/Profile/ListPage.tsx b/screens/Profile/ListPage.tsx index 9e0d4b3..628accd 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: `/(application)/(user)/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: `/(application)/(user)/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..f16389d 100644 --- a/screens/Profile/menuDrawerSection.tsx +++ b/screens/Profile/menuDrawerSection.tsx @@ -1,6 +1,9 @@ import { AlertDefaultSystem } from "@/components"; import { IMenuDrawerItem } from "@/components/_Interface/types"; import MenuDrawerDynamicGrid from "@/components/Drawer/MenuDrawerDynamicGird"; +import { useAuth } from "@/hooks/use-auth"; +import { apiDeleteUser } from "@/service/api-client/api-user"; +import { openBrowser } from "@/utils/openBrower"; import { router } from "expo-router"; export default function Profile_MenuDrawerSection({ @@ -12,8 +15,11 @@ export default function Profile_MenuDrawerSection({ setIsDrawerOpen: (value: boolean) => void; logout: () => Promise; }) { + const { user } = useAuth(); + 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 +33,22 @@ export default function Profile_MenuDrawerSection({ }, onPressLeft: () => setIsDrawerOpen(false), }); + } else if (item.value === "delete-account") { + console.log("PATH >> ", item.path); + // openBrowser(item.path as any); + AlertDefaultSystem({ + title: "Apakah anda yakin ingin menghapus akun ini?", + message: + "Pilih 'Ya' untuk masuk ke halaman penghapusan akun", + textLeft: "Batal", + textRight: "Ya", + onPressRight: async () => { + router.push(item.path as any); + + setIsDrawerOpen(false); + }, + onPressLeft: () => setIsDrawerOpen(false), + }); } else { console.log("PATH >> ", item.path); router.push(item.path as any); @@ -43,6 +65,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/service/api-client/api-user.ts b/service/api-client/api-user.ts index 5e05653..0e4d854 100644 --- a/service/api-client/api-user.ts +++ b/service/api-client/api-user.ts @@ -10,3 +10,7 @@ export async function apiAllUser({ search }: { search: string }) { return response.data; } +export async function apiDeleteUser({id}:{id: string}) { + const response = await apiConfig.delete(`/mobile/user/${id}`); + return response.data; +} diff --git a/utils/notifications.ts b/utils/notifications.ts index 9715c08..ccafecf 100644 --- a/utils/notifications.ts +++ b/utils/notifications.ts @@ -1,18 +1,29 @@ // 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 () => ({ +// shouldShowAlert: true, +// shouldPlaySound: true, +// shouldSetBadge: false, +// shouldShowBanner: true, +// shouldShowList: true, +// }), +// }); Notifications.setNotificationHandler({ handleNotification: async () => ({ - shouldShowAlert: true, - shouldPlaySound: true, + shouldPlaySound: false, shouldSetBadge: false, shouldShowBanner: true, shouldShowList: true, }), }); + export async function registerForPushNotificationsAsync() { if (!Device.isDevice) { console.warn("Push notifications don't work on simulator"); 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