Merge pull request 'Try to notification' (#13) from qc/18-nov-25 into staging

Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi-mobile/pulls/13
This commit is contained in:
2025-11-18 17:48:03 +08:00
7 changed files with 72 additions and 26 deletions

View File

@@ -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,7 +29,7 @@
"expo-image": "~3.0.8",
"expo-image-picker": "~17.0.8",
"expo-linking": "~8.0.8",
"expo-notifications": "~0.32.13",
"expo-notifications": "^0.32.13",
"expo-router": "~6.0.1",
"expo-splash-screen": "~31.0.9",
"expo-status-bar": "~3.0.8",

View File

@@ -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",

View File

@@ -4,6 +4,16 @@
<dict>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>C617.1</string>
<string>0A2A.1</string>
<string>3B52.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
@@ -14,12 +24,10 @@
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>0A2A.1</string>
<string>3B52.1</string>
<string>C617.1</string>
<string>35F9.1</string>
</array>
</dict>
<dict>
@@ -31,14 +39,6 @@
<string>85F4.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>35F9.1</string>
</array>
</dict>
</array>
<key>NSPrivacyCollectedDataTypes</key>
<array/>

View File

@@ -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

View File

@@ -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,7 +36,7 @@
"expo-image": "~3.0.8",
"expo-image-picker": "~17.0.8",
"expo-linking": "~8.0.8",
"expo-notifications": "~0.32.13",
"expo-notifications": "^0.32.13",
"expo-router": "~6.0.1",
"expo-splash-screen": "~31.0.9",
"expo-status-bar": "~3.0.8",

View File

@@ -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);

View File

@@ -4,17 +4,27 @@ 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 default async function registerForPushNotificationsAsync() {
export async function registerForPushNotificationsAsync() {
if (!Device.isDevice) {
console.warn("Push notifications don't work on simulator");
return null;