From ad7dbaf16261289af654d6346691e4c5723a3edf Mon Sep 17 00:00:00 2001 From: bagasbanuna Date: Tue, 3 Mar 2026 16:44:45 +0800 Subject: [PATCH 1/2] Fix Bug DB User Pages - app/(application)/(user)/home.tsx - app/(application)/(user)/portofolio/[id]/index.tsx - app/(application)/(user)/profile/[id]/index.tsx Home - screens/Home/bottomFeatureSection.tsx Components - components/Notification/NotificationInitializer.tsx - components/_ShareComponent/SkeletonCustom.tsx Service - service/api-device-token.ts Config & iOS - app.config.js - ios/HIPMIBadungConnect.xcodeproj/project.pbxproj - ios/HIPMIBadungConnect/Info.plist ### No Issue --- app.config.js | 2 +- app/(application)/(user)/home.tsx | 121 ++++++++++++------ .../(user)/portofolio/[id]/index.tsx | 8 +- .../(user)/profile/[id]/index.tsx | 12 +- .../Notification/NotificationInitializer.tsx | 8 +- components/_ShareComponent/SkeletonCustom.tsx | 2 +- .../project.pbxproj | 90 +++++++++++++ ios/HIPMIBadungConnect/Info.plist | 2 +- screens/Home/bottomFeatureSection.tsx | 4 - service/api-device-token.ts | 9 +- 10 files changed, 200 insertions(+), 58 deletions(-) diff --git a/app.config.js b/app.config.js index 2403739..6dedc3d 100644 --- a/app.config.js +++ b/app.config.js @@ -21,7 +21,7 @@ export default { "Aplikasi membutuhkan akses lokasi untuk menampilkan peta.", }, associatedDomains: ["applinks:cld-dkr-staging-hipmi.wibudev.com"], - buildNumber: "1", + buildNumber: "2", }, android: { diff --git a/app/(application)/(user)/home.tsx b/app/(application)/(user)/home.tsx index c0a1987..9d29187 100644 --- a/app/(application)/(user)/home.tsx +++ b/app/(application)/(user)/home.tsx @@ -1,21 +1,24 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable react-hooks/exhaustive-deps */ import { BasicWrapper, StackCustom, ViewWrapper } from "@/components"; +import CustomSkeleton from "@/components/_ShareComponent/SkeletonCustom"; import { MainColor } from "@/constants/color-palet"; import { useAuth } from "@/hooks/use-auth"; import { useNotificationStore } from "@/hooks/use-notification-store"; import Home_BottomFeatureSection from "@/screens/Home/bottomFeatureSection"; import HeaderBell from "@/screens/Home/HeaderBell"; +import { stylesHome } from "@/screens/Home/homeViewStyle"; import Home_ImageSection from "@/screens/Home/imageSection"; import TabSection from "@/screens/Home/tabSection"; import { tabsHome } from "@/screens/Home/tabsList"; import Home_FeatureSection from "@/screens/Home/topFeatureSection"; import { apiUser } from "@/service/api-client/api-user"; import { apiVersion } from "@/service/api-config"; +import { GStyles } from "@/styles/global-styles"; import { Ionicons } from "@expo/vector-icons"; import { Redirect, router, Stack, useFocusEffect } from "expo-router"; import { useCallback, useState } from "react"; -import { RefreshControl } from "react-native"; +import { RefreshControl, TouchableOpacity, View } from "react-native"; export default function Application() { const { token, user, userData } = useAuth(); @@ -27,24 +30,33 @@ export default function Application() { useCallback(() => { onLoadData(); checkVersion(); - userData(token as string); + userData(token as string).catch((error) => { + console.log("[ERROR userData]", error?.message); + console.log("[ERROR userData Response]", error?.response?.data); + }); syncUnreadCount(); }, [user?.id, token]), ); async function onLoadData() { - const response = await apiUser(user?.id as string); - console.log( - "[Profile ID]>>", - JSON.stringify(response?.data?.Profile?.id, null, 2), - ); - - setData(response.data); + try { + const response = await apiUser(user?.id as string); + setData(response.data); + } catch (error: any) { + console.log("[ERROR onLoadData]", error?.message); + console.log("[ERROR Response]", error?.response?.data); + // Set data tetap agar UI tidak stuck di loading + setData(null); + } } const checkVersion = async () => { - const response = await apiVersion(); - console.log("[Version] >>", JSON.stringify(response.data, null, 2)); + try { + const response = await apiVersion(); + console.log("[Version] >>", JSON.stringify(response.data, null, 2)); + } catch (error: any) { + console.log("[ERROR checkVersion]", error?.message); + } }; const onRefresh = useCallback(() => { @@ -54,11 +66,6 @@ export default function Application() { setRefreshing(false); }, []); - // if (user && user?.termsOfServiceAccepted === false) { - // console.log("User is not accept term service"); - // return ; - // } - if (data && data?.active === false) { console.log("User is not active"); return ( @@ -91,17 +98,25 @@ export default function Application() { ( - { - router.push("/user-search"); - }} - /> - ), - headerRight: () => , + headerLeft: () => + data ? ( + { + router.push("/user-search"); + }} + /> + ) : ( + + ), + headerRight: () => + data ? ( + + ) : ( + + ), }} /> } footerComponent={ - + data && data ? ( + + ) : ( + + + {Array.from({ length: 4 }).map((e, index) => ( + + ))} + + + ) } > - {/* router.push("./test-notifications")}> - Test Notif - */} - - + {data && data ? ( + + ) : ( + + {Array.from({ length: 4 }).map((item, index) => ( + + ))} + + )} - + {data ? ( + + ) : ( + + )} diff --git a/app/(application)/(user)/portofolio/[id]/index.tsx b/app/(application)/(user)/portofolio/[id]/index.tsx index 0d51e2d..5169bf9 100644 --- a/app/(application)/(user)/portofolio/[id]/index.tsx +++ b/app/(application)/(user)/portofolio/[id]/index.tsx @@ -10,6 +10,7 @@ import { } from "@/components"; import LeftButtonCustom from "@/components/Button/BackButton"; import GridTwoView from "@/components/_ShareComponent/GridTwoView"; +import CustomSkeleton from "@/components/_ShareComponent/SkeletonCustom"; import ViewWrapper from "@/components/_ShareComponent/ViewWrapper"; import { MainColor } from "@/constants/color-palet"; import { ICON_SIZE_SMALL } from "@/constants/constans-value"; @@ -64,6 +65,8 @@ export default function Portofolio() { setProfileId(response?.data?.Profile?.id); }; + + return ( <> {/* Header */} @@ -87,7 +90,10 @@ export default function Portofolio() { /> {!data || !profileId ? ( - + + + + ) : ( { @@ -69,7 +70,7 @@ export default function Profile() { const lastTwoByDate = response.data .sort( (a: any, b: any) => - new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime() + new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime(), ) // urut desc .slice(0, 2); setListPortofolio(lastTwoByDate); @@ -99,7 +100,10 @@ export default function Profile() { {/* Main View */} {!data || !dataToken ? ( - + + + + ) : ( <> diff --git a/components/Notification/NotificationInitializer.tsx b/components/Notification/NotificationInitializer.tsx index deb415e..f20bc13 100644 --- a/components/Notification/NotificationInitializer.tsx +++ b/components/Notification/NotificationInitializer.tsx @@ -77,8 +77,12 @@ export default function NotificationInitializer() { }); console.log("✅ Device token berhasil didaftarkan ke backend"); - } catch (error) { - console.error("❌ Gagal mendaftarkan device token:", error); + } catch (error: any) { + // Log error detail tapi jangan crash aplikasi + console.error("❌ Gagal mendaftarkan device token:", error?.message); + console.error("Response status:", error?.response?.status); + console.error("Response data:", error?.response?.data); + // Skip logout - biarkan user tetap bisa pakai app meski notif gagal } }; diff --git a/components/_ShareComponent/SkeletonCustom.tsx b/components/_ShareComponent/SkeletonCustom.tsx index 89b8ee3..a00b1e9 100644 --- a/components/_ShareComponent/SkeletonCustom.tsx +++ b/components/_ShareComponent/SkeletonCustom.tsx @@ -49,7 +49,7 @@ const CustomSkeleton: React.FC = ({ right: 0, height: 100, backgroundColor: MainColor.soft_darkblue, - borderRadius: 4, + borderRadius: 1, }} /> diff --git a/ios/HIPMIBadungConnect.xcodeproj/project.pbxproj b/ios/HIPMIBadungConnect.xcodeproj/project.pbxproj index 18e7185..7f01abc 100644 --- a/ios/HIPMIBadungConnect.xcodeproj/project.pbxproj +++ b/ios/HIPMIBadungConnect.xcodeproj/project.pbxproj @@ -171,6 +171,11 @@ EEC6AC8AF9C04E91AA81C190 /* Remove signature files (Xcode workaround) */, D2BED766D85C4781B154BD69 /* Remove signature files (Xcode workaround) */, E01278D305D540D5B29ED50A /* Remove signature files (Xcode workaround) */, + 72EDC26CA2144B90BEFE947F /* Remove signature files (Xcode workaround) */, + 0A09E19272A94BEBAAF5A27A /* Remove signature files (Xcode workaround) */, + 9B007D2599C64C7F8F525B86 /* Remove signature files (Xcode workaround) */, + 1393AE9C86924FA8B1F8D11E /* Remove signature files (Xcode workaround) */, + E1F9AE3DCABE4A088A05E180 /* Remove signature files (Xcode workaround) */, ); buildRules = ( ); @@ -779,6 +784,91 @@ rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\"; "; }; + 72EDC26CA2144B90BEFE947F /* Remove signature files (Xcode workaround) */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + name = "Remove signature files (Xcode workaround)"; + inputPaths = ( + ); + outputPaths = ( + ); + shellPath = /bin/sh; + shellScript = " + echo \"Remove signature files (Xcode workaround)\"; + rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\"; + "; + }; + 0A09E19272A94BEBAAF5A27A /* Remove signature files (Xcode workaround) */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + name = "Remove signature files (Xcode workaround)"; + inputPaths = ( + ); + outputPaths = ( + ); + shellPath = /bin/sh; + shellScript = " + echo \"Remove signature files (Xcode workaround)\"; + rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\"; + "; + }; + 9B007D2599C64C7F8F525B86 /* Remove signature files (Xcode workaround) */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + name = "Remove signature files (Xcode workaround)"; + inputPaths = ( + ); + outputPaths = ( + ); + shellPath = /bin/sh; + shellScript = " + echo \"Remove signature files (Xcode workaround)\"; + rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\"; + "; + }; + 1393AE9C86924FA8B1F8D11E /* Remove signature files (Xcode workaround) */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + name = "Remove signature files (Xcode workaround)"; + inputPaths = ( + ); + outputPaths = ( + ); + shellPath = /bin/sh; + shellScript = " + echo \"Remove signature files (Xcode workaround)\"; + rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\"; + "; + }; + E1F9AE3DCABE4A088A05E180 /* Remove signature files (Xcode workaround) */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + name = "Remove signature files (Xcode workaround)"; + inputPaths = ( + ); + outputPaths = ( + ); + shellPath = /bin/sh; + shellScript = " + echo \"Remove signature files (Xcode workaround)\"; + rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\"; + "; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/ios/HIPMIBadungConnect/Info.plist b/ios/HIPMIBadungConnect/Info.plist index a743c17..cc5cc95 100644 --- a/ios/HIPMIBadungConnect/Info.plist +++ b/ios/HIPMIBadungConnect/Info.plist @@ -39,7 +39,7 @@ CFBundleVersion - 1 + 2 ITSAppUsesNonExemptEncryption LSMinimumSystemVersion diff --git a/screens/Home/bottomFeatureSection.tsx b/screens/Home/bottomFeatureSection.tsx index 23bde4b..85b60b3 100644 --- a/screens/Home/bottomFeatureSection.tsx +++ b/screens/Home/bottomFeatureSection.tsx @@ -36,10 +36,6 @@ export default function Home_BottomFeatureSection() { }, []) ); - if (listData === null) { - return - } - return ( <> router.push("/job")}> diff --git a/service/api-device-token.ts b/service/api-device-token.ts index ff42c82..31c1562 100644 --- a/service/api-device-token.ts +++ b/service/api-device-token.ts @@ -15,13 +15,14 @@ export async function apiDeviceRegisterToken({ data: DeviceTokenData; }) { try { - const response = await apiConfig.post(`/mobile/auth/device-tokens`, { - data: data, - }); + const response = await apiConfig.post(`/mobile/auth/device-tokens`, data); return response.data; - } catch (error) { + } catch (error: any) { console.error("Failed to register device token:", error); + console.error("Response data:", error?.response?.data); + console.error("Response status:", error?.response?.status); + console.error("Request payload:", data); throw error; } } -- 2.49.1 From 3bbee15c3a1f8c8424588c61560c4027fcb7ff5f Mon Sep 17 00:00:00 2001 From: bagasbanuna Date: Wed, 4 Mar 2026 16:39:57 +0800 Subject: [PATCH 2/2] =?UTF-8?q?Perbaikan=20Bug=20&=20Error=20Handling:=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=E2=94=82=20=20=20=E2=94=82=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=E2=94=82=20=20=20=E2=94=82=20=20=20=201.=20Device=20Token?= =?UTF-8?q?=20Registration=20Error=20(HTTP=20500)=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=E2=94=82=20=20=20=E2=94=82=20=20=20?= =?UTF-8?q?=20=20=20=20-=20File:=20service/api-device-token.ts=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=E2=94=82=20=20=20=E2=94=82=20=20=20=20=20=20=20-=20Fix:=20Hapu?= =?UTF-8?q?s=20nested=20data=20wrapper=20pada=20payload=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=E2=94=82=20=20=20=E2=94=82=20=20=20=20?= =?UTF-8?q?=20=20=20-=20Improvement:=20Tambahkan=20error=20logging=20detai?= =?UTF-8?q?l=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=E2=94=82=20=20=20?= =?UTF-8?q?=E2=94=82=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=E2=94=82=20=20=20=E2=94=82=20=20=20=202.=20U?= =?UTF-8?q?ncaught=20Promise=20Errors=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=E2=94=82=20=20=20=E2=94=82=20=20=20=20=20=20=20-=20Fi?= =?UTF-8?q?le:=20components/Notification/NotificationInitializer.tsx=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=E2=94=82=20=20=20=E2=94=82=20=20=20=20=20=20=20-=20Fix:=20Bett?= =?UTF-8?q?er=20error=20handling=20untuk=20device=20token=20registration?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=E2=94=82=20=20=20=E2=94=82=20=20=20=20=20=20=20-=20File:=20app?= =?UTF-8?q?/(application)/(user)/home.tsx=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=E2=94=82=20=20=20=E2=94=82=20=20=20=20=20?= =?UTF-8?q?=20=20-=20Fix:=20Add=20.catch()=20untuk=20userData()=20dan=20er?= =?UTF-8?q?ror=20handling=20apiUser()=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=E2=94=82=20=20=20=E2=94=82=20=20=20=20=20=20=20-=20Fi?= =?UTF-8?q?le:=20app/(application)/(user)/profile/[id]/index.tsx=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=E2=94=82=20=20=20=E2=94=82=20=20=20=20=20=20=20-=20Fix:=20A?= =?UTF-8?q?dd=20error=20handling=20untuk=20apiProfile(),=20apiUser(),=20us?= =?UTF-8?q?erData()=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=E2=94=82=20=20?= =?UTF-8?q?=20=E2=94=82=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=E2=94=82=20=20=20=E2=94=82=20=20=20=203.?= =?UTF-8?q?=20UI=20Improvements=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=E2=94=82=20=20=20=E2=94=82=20=20=20?= =?UTF-8?q?=20=20=20=20-=20File:=20app/(application)/(user)/home.tsx=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=E2=94=82=20=20?= =?UTF-8?q?=20=E2=94=82=20=20=20=20=20=20=20-=20Feature:=204=20skeleton=20?= =?UTF-8?q?lingkaran=20untuk=20loading=20state=20grid=20features=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=E2=94=82=20=20=20=E2=94=82?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=E2=94=82=20=20=20=E2=94=82=20=20=20=204.=20Maps=20Mig?= =?UTF-8?q?ration=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=E2=94=82=20=20=20=E2=94=82=20=20=20=20=20=20=20?= =?UTF-8?q?-=20File:=20app/(application)/admin/maps.tsx=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=E2=94=82=20=20=20?= =?UTF-8?q?=E2=94=82=20=20=20=20=20=20=20-=20Change:=20Replace=20react-nat?= =?UTF-8?q?ive-maps=20dengan=20MapsV2Custom=20(Maplibre)=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=E2=94=82=20=20=20=E2=94=82=20=20=20=20?= =?UTF-8?q?=20=20=20-=20Cleanup:=20Hapus=20unused=20imports=20dan=20interf?= =?UTF-8?q?aces=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=E2=94=82=20=20=20?= =?UTF-8?q?=E2=94=82=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=E2=94=82=20=20=20=E2=94=82=20=20=20Files=20M?= =?UTF-8?q?odified=20(7)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=E2=94=82=20=20=20=E2=94=82=20=20=20=20?= =?UTF-8?q?-=20app/(application)/(user)/home.tsx=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=E2=94=82=20=20=20=E2=94=82=20=20=20=20-=20app/(application)/(u?= =?UTF-8?q?ser)/profile/[id]/index.tsx=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=E2=94=82=20=20=20=E2=94=82=20=20=20=20-=20app/(application)?= =?UTF-8?q?/admin/maps.tsx=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=E2=94=82=20=20=20=E2=94=82?= =?UTF-8?q?=20=20=20=20-=20components/Notification/NotificationInitializer?= =?UTF-8?q?.tsx=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=E2=94=82=20=20=20=E2=94=82=20?= =?UTF-8?q?=20=20=20-=20service/api-device-token.ts=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=E2=94=82=20=20=20=E2=94=82=20=20=20=20-=20const?= =?UTF-8?q?ants/constans-value.ts=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=E2=94=82=20=20=20=E2=94=82=20=20=20=20-=20screens/Home/bottomF?= =?UTF-8?q?eatureSection.tsx=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=E2=94=82=20=20=20=E2=94=82=20=20=20=20?= =?UTF-8?q?-=20screens/UserSeach/MainView=5FV2.tsx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### No Issue --- app/(application)/(user)/home.tsx | 35 +++++- .../(user)/profile/[id]/index.tsx | 49 ++++++-- app/(application)/admin/maps.tsx | 110 ++++-------------- constants/constans-value.ts | 2 +- .../project.pbxproj | 36 ++++++ screens/Home/bottomFeatureSection.tsx | 38 +----- screens/UserSeach/MainView_V2.tsx | 4 +- 7 files changed, 139 insertions(+), 135 deletions(-) diff --git a/app/(application)/(user)/home.tsx b/app/(application)/(user)/home.tsx index 9d29187..b6c5996 100644 --- a/app/(application)/(user)/home.tsx +++ b/app/(application)/(user)/home.tsx @@ -12,23 +12,26 @@ import Home_ImageSection from "@/screens/Home/imageSection"; import TabSection from "@/screens/Home/tabSection"; import { tabsHome } from "@/screens/Home/tabsList"; import Home_FeatureSection from "@/screens/Home/topFeatureSection"; +import { apiJobGetAll } from "@/service/api-client/api-job"; import { apiUser } from "@/service/api-client/api-user"; import { apiVersion } from "@/service/api-config"; import { GStyles } from "@/styles/global-styles"; import { Ionicons } from "@expo/vector-icons"; import { Redirect, router, Stack, useFocusEffect } from "expo-router"; import { useCallback, useState } from "react"; -import { RefreshControl, TouchableOpacity, View } from "react-native"; +import { RefreshControl, View } from "react-native"; export default function Application() { const { token, user, userData } = useAuth(); const [data, setData] = useState(); const [refreshing, setRefreshing] = useState(false); const { syncUnreadCount } = useNotificationStore(); + const [listData, setListData] = useState(null); useFocusEffect( useCallback(() => { onLoadData(); + onLoadDataJob(); checkVersion(); userData(token as string).catch((error) => { console.log("[ERROR userData]", error?.message); @@ -50,6 +53,29 @@ export default function Application() { } } + const onLoadDataJob = async () => { + try { + const response = await apiJobGetAll({ + category: "beranda", + }); + const result = response.data + .sort( + (a: any, b: any) => + new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime() + ) + .slice(0, 2); + setListData(result); + } catch (error) { + console.log("[ERROR]", error); + } + }; + + useFocusEffect( + useCallback(() => { + onLoadData(); + }, []) + ); + const checkVersion = async () => { try { const response = await apiVersion(); @@ -62,12 +88,13 @@ export default function Application() { const onRefresh = useCallback(() => { setRefreshing(true); onLoadData(); + onLoadDataJob(); checkVersion(); setRefreshing(false); }, []); if (data && data?.active === false) { - console.log("User is not active"); + console.warn("User is not active"); return ( @@ -76,7 +103,7 @@ export default function Application() { } if (data && data?.Profile === null) { - console.log("Profile is null"); + console.warn("Profile is null"); return ( @@ -170,7 +197,7 @@ export default function Application() { )} {data ? ( - + ) : ( )} diff --git a/app/(application)/(user)/profile/[id]/index.tsx b/app/(application)/(user)/profile/[id]/index.tsx index a7eda85..06c3339 100644 --- a/app/(application)/(user)/profile/[id]/index.tsx +++ b/app/(application)/(user)/profile/[id]/index.tsx @@ -1,7 +1,6 @@ /* eslint-disable react-hooks/exhaustive-deps */ -import { LoaderCustom, StackCustom } from "@/components"; +import { NewWrapper, StackCustom } from "@/components"; import CustomSkeleton from "@/components/_ShareComponent/SkeletonCustom"; -import ViewWrapper from "@/components/_ShareComponent/ViewWrapper"; import LeftButtonCustom from "@/components/Button/BackButton"; import DrawerCustom from "@/components/Drawer/DrawerCustom"; import { MainColor } from "@/constants/color-palet"; @@ -17,8 +16,8 @@ import { GStyles } from "@/styles/global-styles"; import { IProfile } from "@/types/Type-Profile"; import { Ionicons } from "@expo/vector-icons"; import { Stack, useFocusEffect, useLocalSearchParams } from "expo-router"; -import React, { useCallback, useState } from "react"; -import { TouchableOpacity } from "react-native"; +import { useCallback, useState } from "react"; +import { RefreshControl, TouchableOpacity } from "react-native"; export default function Profile() { const { id } = useLocalSearchParams(); @@ -26,6 +25,7 @@ export default function Profile() { const [data, setData] = useState(); const [dataToken, setDataToken] = useState(); const [listPortofolio, setListPortofolio] = useState(); + const [refreshing, setRefreshing] = useState(false); const { token, logout, isAdmin, user, userData } = useAuth(); @@ -55,13 +55,21 @@ export default function Profile() { }; const onLoadData = async (id: string) => { - const response = await apiProfile({ id: id }); - setData(response.data); + try { + const response = await apiProfile({ id: id }); + setData(response.data); + } catch (error) { + console.log("[ERROR onLoadData]", error); + } }; const onLoadUserByToken = async () => { - const response = await apiUser(user?.id as string); - setDataToken(response?.data?.Profile); + try { + const response = await apiUser(user?.id as string); + setDataToken(response?.data?.Profile); + } catch (error) { + console.log("[ERROR onLoadUserByToken]", error); + } }; const onLoadPortofolio = async (id: string) => { @@ -75,10 +83,20 @@ export default function Profile() { .slice(0, 2); setListPortofolio(lastTwoByDate); } catch (error) { - console.log("[ERROR]", error); + console.log("[ERROR onLoadPortofolio]", error); } }; + const onRefresh = useCallback(() => { + setRefreshing(true); + onLoadData(id as string); + onLoadPortofolio(id as string); + onLoadUserByToken(); + isUserCheck(); + userData(token as string); + setRefreshing(false); + }, [id, token]); + return ( <> {/* Main View */} - + + } + > {!data || !dataToken ? ( @@ -114,7 +141,7 @@ export default function Profile() { /> )} - + {/* Drawer Komponen Eksternal */} (null); const [loadList, setLoadList] = useState(false); @@ -72,74 +54,30 @@ export default function AdminMaps() { } }; + const markers: MapMarker[] = list?.map((item) => ({ + id: item.id, + coordinate: [item.longitude, item.latitude] as [number, number], + imageId: item.Portofolio?.logoId, + onSelected: () => { + setOpenDrawer(true); + setSelected({ + id: item?.id, + bidangBisnis: item?.Portofolio?.MasterBidangBisnis?.name, + nomorTelepon: item?.Portofolio?.tlpn, + alamatBisnis: item?.Portofolio?.alamatKantor, + namePin: item?.namePin, + imageId: item?.imageId, + portofolioId: item?.Portofolio?.id, + latitude: item?.latitude, + longitude: item?.longitude, + }); + }, + })) || []; + return ( <> - {/* */} - - {loadList ? ( - - ) : ( - - {list?.map((item: any, index: number) => { - return ( - { - setOpenDrawer(true); - setSelected({ - id: item?.id, - bidangBisnis: - item?.Portofolio?.MasterBidangBisnis?.name, - nomorTelepon: item?.Portofolio?.tlpn, - alamatBisnis: item?.Portofolio?.alamatKantor, - namePin: item?.namePin, - imageId: item?.imageId, - portofolioId: item?.Portofolio?.id, - latitude: item?.latitude, - longitude: item?.longitude, - }); - }} - // Gunakan gambar kustom jika tersedia - > - - - - - ); - })} - - )} - + setOpenDrawer(false)} height={"auto"} > - + {selected.imageId && ( + + )} (null); - - const onLoadData = async () => { - try { - const response = await apiJobGetAll({ - category: "beranda", - }); - - console.log("[DATA JOB]", JSON.stringify(response.data, null, 2)); - const result = response.data - .sort( - (a: any, b: any) => - new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime() - ) - .slice(0, 2); - setListData(result); - } catch (error) { - console.log("[ERROR]", error); - } - }; - - useFocusEffect( - useCallback(() => { - onLoadData(); - }, []) - ); +export default function Home_BottomFeatureSection({ + listData, +}: { + listData: any[] | null; +}) { return ( <> router.push("/job")}> diff --git a/screens/UserSeach/MainView_V2.tsx b/screens/UserSeach/MainView_V2.tsx index 0be71d8..9632072 100644 --- a/screens/UserSeach/MainView_V2.tsx +++ b/screens/UserSeach/MainView_V2.tsx @@ -139,8 +139,8 @@ export default function UserSearchMainView_V2() { searchQuery: search, emptyMessage: "Tidak ada pengguna ditemukan", emptySearchMessage: "Tidak ada hasil pencarian", - skeletonCount: 5, - skeletonHeight: 150, + skeletonCount: PAGINATION_DEFAULT_TAKE, + skeletonHeight: 100, loadingFooterText: "Memuat lebih banyak pengguna...", isInitialLoad, }); -- 2.49.1