diff --git a/app.config.js b/app.config.js
index daa473e..f8becda 100644
--- a/app.config.js
+++ b/app.config.js
@@ -19,7 +19,7 @@ export default {
"NSLocationWhenInUseUsageDescription": "Aplikasi membutuhkan akses lokasi untuk menampilkan peta.",
},
associatedDomains: ["applinks:cld-dkr-staging-hipmi.wibudev.com"],
- buildNumber: "10",
+ buildNumber: "12",
},
android: {
diff --git a/context/AuthContext.tsx b/context/AuthContext.tsx
index f2ffd82..53da0d5 100644
--- a/context/AuthContext.tsx
+++ b/context/AuthContext.tsx
@@ -72,10 +72,13 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
const loginWithNomor = async (nomor: string) => {
setIsLoading(true);
try {
+ console.log("[Masuk provider]", nomor);
const response = await apiLogin({ nomor: nomor });
console.log("[RESPONSE AUTH]", JSON.stringify(response));
+
if (response.success) {
+ console.log("[Keluar provider]", nomor);
Toast.show({
type: "success",
text1: "Sukses",
@@ -83,10 +86,15 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
});
await AsyncStorage.setItem("kode_otp", response.kodeId);
- router.replace(`/verification?nomor=${nomor}`);
+ router.push(`/verification?nomor=${nomor}`);
return;
} else {
- router.replace(`/register?nomor=${nomor}`);
+ router.push(`/register?nomor=${nomor}`);
+ Toast.show({
+ type: "info",
+ text1: "Info",
+ text2: "Silahkan mendaftar",
+ });
return;
}
} catch (error: any) {
diff --git a/ios/HIPMIBadungConnect/Info.plist b/ios/HIPMIBadungConnect/Info.plist
index 715a448..fa0d347 100644
--- a/ios/HIPMIBadungConnect/Info.plist
+++ b/ios/HIPMIBadungConnect/Info.plist
@@ -39,7 +39,7 @@
CFBundleVersion
- 10
+ 12
ITSAppUsesNonExemptEncryption
LSMinimumSystemVersion
diff --git a/screens/Authentication/LoginView.tsx b/screens/Authentication/LoginView.tsx
index 7238cd1..c80833d 100644
--- a/screens/Authentication/LoginView.tsx
+++ b/screens/Authentication/LoginView.tsx
@@ -1,3 +1,4 @@
+import { NewWrapper } from "@/components";
import ButtonCustom from "@/components/Button/ButtonCustom";
import Spacing from "@/components/_ShareComponent/Spacing";
import ViewWrapper from "@/components/_ShareComponent/ViewWrapper";
@@ -5,9 +6,11 @@ import { MainColor } from "@/constants/color-palet";
import { useAuth } from "@/hooks/use-auth";
import { apiVersion } from "@/service/api-config";
import { GStyles } from "@/styles/global-styles";
-import { Redirect, router } from "expo-router";
+import versionBadge from "@/utils/viersionBadge";
+import VersionBadge from "@/utils/viersionBadge";
+import { Redirect } from "expo-router";
import { useEffect, useState } from "react";
-import { Text, View } from "react-native";
+import { RefreshControl, Text, View } from "react-native";
import PhoneInput, { ICountry } from "react-native-international-phone-number";
import Toast from "react-native-toast-message";
@@ -16,6 +19,7 @@ export default function LoginView() {
const [selectedCountry, setSelectedCountry] = useState(null);
const [inputValue, setInputValue] = useState("");
const [loading, setLoading] = useState(false);
+ const [refreshing, setRefreshing] = useState(false);
const { loginWithNomor, token, isAdmin, isUserActive } = useAuth();
@@ -25,7 +29,18 @@ export default function LoginView() {
async function onLoadVersion() {
const res = await apiVersion();
- setVersion(res.data);
+
+ if (res.success) {
+ setVersion(versionBadge());
+ }
+ }
+
+ async function handleRefresh() {
+ setRefreshing(true);
+ await onLoadVersion();
+ setInputValue("");
+ setLoading(false);
+ setRefreshing(false);
}
function handleInputValue(phoneNumber: string) {
@@ -65,8 +80,6 @@ export default function LoginView() {
const isValid = await validateData();
if (!isValid) return;
- // const callingCode = selectedCountry?.callingCode.replace(/^\+/, "") || "";
- // const fixNumber = inputValue.replace(/\s+/g, "");
const callingCode = selectedCountry?.callingCode.replace(/^\+/, "") || "";
let fixNumber = inputValue.replace(/\s+/g, "").replace(/^0+/, "");
@@ -74,9 +87,7 @@ export default function LoginView() {
try {
setLoading(true);
- const response = await loginWithNomor(realNumber);
- console.log("[RESPONSE UI]", response);
-
+ await loginWithNomor(realNumber);
} catch (error) {
console.log("Error login", error);
Toast.show({
@@ -130,7 +141,12 @@ export default function LoginView() {
}
return (
-
+
+ }
+ >
@@ -174,6 +190,6 @@ export default function LoginView() {
Coba
*/}
-
+
);
}
diff --git a/screens/Authentication/VerificationView.tsx b/screens/Authentication/VerificationView.tsx
index 37a39e6..7ed8add 100644
--- a/screens/Authentication/VerificationView.tsx
+++ b/screens/Authentication/VerificationView.tsx
@@ -17,6 +17,8 @@ import Toast from "react-native-toast-message";
export default function VerificationView() {
const { nomor } = useLocalSearchParams<{ nomor: string }>();
+ console.log("[NOMOR]", nomor);
+
const [inputOtp, setInputOtp] = useState("");
const [userNumber, setUserNumber] = useState("");
const [loading, setLoading] = useState(false);
@@ -52,7 +54,7 @@ export default function VerificationView() {
try {
const response = await apiCheckCodeOtp({ kodeId });
console.log(
- "Response check code otp >>",
+ "[OTP] >>",
JSON.stringify(response.otp, null, 2)
);
// Kita tidak perlu simpan codeOtp di state karena verifikasi dilakukan di backend
diff --git a/service/api-config.ts b/service/api-config.ts
index 276cba7..c0518fe 100644
--- a/service/api-config.ts
+++ b/service/api-config.ts
@@ -14,6 +14,7 @@ apiConfig.interceptors.request.use(
async (config) => {
console.log("API_BASE_URL >>", API_BASE_URL);
const token = await AsyncStorage.getItem("authToken");
+ // console.log("[TOKEN] >>", token);
if (token) {
// config.timeout = 10000;
config.headers["Content-Type"] = "application/json";
@@ -33,7 +34,7 @@ export async function apiVersion() {
}
export async function apiLogin({ nomor }: { nomor: string }) {
- const response = await apiConfig.post("/mobile/auth/login", {
+ const response = await apiConfig.post("/auth/mobile-login", {
nomor: nomor,
});
return response.data;;
@@ -45,7 +46,7 @@ export async function apiCheckCodeOtp({ kodeId }: { kodeId: string }) {
}
export async function apiValidationCode({ nomor }: { nomor: string }) {
- const response = await apiConfig.post(`/auth/validasi`, {
+ const response = await apiConfig.post(`/auth/mobile-validasi`, {
nomor: nomor,
});
return response.data;
@@ -56,7 +57,7 @@ export async function apiRegister({
}: {
data: { nomor: string; username: string; termsOfServiceAccepted: boolean };
}) {
- const response = await apiConfig.post(`/mobile/auth/register`, {
+ const response = await apiConfig.post(`/auth/mobile-register`, {
data: data,
});
return response.data;
diff --git a/utils/viersionBadge.ts b/utils/viersionBadge.ts
new file mode 100644
index 0000000..0a0c659
--- /dev/null
+++ b/utils/viersionBadge.ts
@@ -0,0 +1,18 @@
+// VersionBadge.tsx
+import Constants from "expo-constants";
+import { Platform } from "react-native";
+
+export default function versionBadge() {
+ const expoConfig = Constants.expoConfig;
+
+ const version = expoConfig?.version; // "1.0.1"
+ const iosBuild = expoConfig?.ios?.buildNumber; // "10"
+ const androidBuild = expoConfig?.android?.versionCode; // 2
+
+ const build =
+ Platform.OS === "ios" ? iosBuild : androidBuild;
+
+ const result = `${version} ( ${build} )`;
+
+ return result
+}