Compare commits

...

3 Commits

Author SHA1 Message Date
1122e51047 upd: color status bar
Deskripsi:
- status bar pada login dan halaman konfirmasi otp

No Issues
2025-09-02 11:48:38 +08:00
265656413d upd: login tanpa verifikasi otp
Deskripsi:
- dibuat untuk pengecekan aplikasi oleh tim google play store

No Issues
2025-09-02 11:08:58 +08:00
db0f0ecd6c upd: version app 2025-09-02 11:07:06 +08:00
5 changed files with 24 additions and 16 deletions

View File

@@ -4,7 +4,7 @@ export default {
expo: {
name: "mobile-darmasaba",
slug: "mobile-darmasaba",
version: "1.0.0",
version: "1.0.1",
jsEngine: "jsc",
orientation: "portrait",
icon: "./assets/images/icon.png",
@@ -21,7 +21,7 @@ export default {
},
android: {
package: "mobiledarmasaba.app",
versionCode: 1,
versionCode: 2,
adaptiveIcon: {
foregroundImage: "./assets/images/splash-icon.png",
backgroundColor: "#ffffff"

View File

@@ -148,7 +148,7 @@ export default function RootLayout() {
}}
/>
</Stack>
<StatusBar style="light" translucent={false} backgroundColor="black" />
<StatusBar style="inverted" translucent={false} backgroundColor="black" />
<ToastCustom />
</Provider>
)

View File

@@ -1,8 +1,10 @@
import Styles from "@/constants/Styles"
import { apiCheckPhoneLogin, apiSendOtp } from "@/lib/api"
import { useAuthSession } from "@/providers/AuthProvider"
import AsyncStorage from "@react-native-async-storage/async-storage"
import { StatusBar } from "expo-status-bar"
import { useState } from "react"
import { Image, SafeAreaView, View } from "react-native"
import { Image, Platform, SafeAreaView, View } from "react-native"
import Toast from "react-native-toast-message"
import { ButtonForm } from "../buttonForm"
import { InputForm } from "../inputForm"
@@ -10,7 +12,6 @@ import ModalLoading from "../modalLoading"
import Text from "../Text"
import ToastCustom from "../toastCustom"
type Props = {
onValidate: ({ phone, otp }: { phone: string, otp: number }) => void
}
@@ -19,20 +20,27 @@ export default function ViewLogin({ onValidate }: Props) {
const [loadingLogin, setLoadingLogin] = useState(false)
const [disableLogin, setDisableLogin] = useState(true)
const [phone, setPhone] = useState('')
const { signIn, encryptToken } = useAuthSession();
const handleCheckPhone = async () => {
try {
setLoadingLogin(true)
const response = await apiCheckPhoneLogin({ phone: `62${phone}` });
const response = await apiCheckPhoneLogin({ phone: `62${phone}` })
if (response.success) {
const otp = Math.floor(1000 + Math.random() * 9000)
const responseOtp = await apiSendOtp({ phone: `62${phone}`, otp })
if (responseOtp == 200) {
await AsyncStorage.setItem('user', response.id);
return onValidate({ phone: `62${phone}`, otp })
if (response.isWithoutOTP) {
const encrypted = await encryptToken(response.id)
signIn(encrypted)
} else {
const otp = Math.floor(1000 + Math.random() * 9000)
const responseOtp = await apiSendOtp({ phone: `62${phone}`, otp })
if (responseOtp == 200) {
await AsyncStorage.setItem('user', response.id)
return onValidate({ phone: `62${phone}`, otp })
}
}
} else {
return Toast.show({ type: 'small', text1: response.message, position: 'top' })
}
return Toast.show({ type: 'small', text1: response.message, position: 'top' })
} catch (error) {
return Toast.show({ type: 'small', text1: 'Terjadi kesalahan', position: 'top' })
} finally {
@@ -42,6 +50,7 @@ export default function ViewLogin({ onValidate }: Props) {
return (
<SafeAreaView>
<StatusBar style={Platform.OS === 'ios' ? 'auto' : 'light'} translucent={false} backgroundColor="black" />
<ToastCustom />
<View style={[Styles.p20, Styles.h100]}>
<View style={{ alignItems: "center", marginVertical: 50 }}>

View File

@@ -2,8 +2,9 @@ import Styles from "@/constants/Styles";
import { apiSendOtp } from "@/lib/api";
import { useAuthSession } from "@/providers/AuthProvider";
import AsyncStorage from "@react-native-async-storage/async-storage";
import { StatusBar } from "expo-status-bar";
import { useState } from "react";
import { Image, View } from "react-native";
import { Image, Platform, View } from "react-native";
import { OtpInput } from "react-native-otp-entry";
import Toast from 'react-native-toast-message';
import { ButtonForm } from "../buttonForm";
@@ -56,6 +57,7 @@ export default function ViewVerification({ phone, otp }: Props) {
return (
<>
<StatusBar style={Platform.OS === 'ios' ? 'auto' : 'light'} translucent={false} backgroundColor="black"/>
<ToastCustom />
<View style={Styles.wrapLogin} >
<View style={{ alignItems: "center", marginVertical: 50 }}>

View File

@@ -2,9 +2,6 @@ import axios from 'axios';
import Constants from 'expo-constants';
const api = axios.create({
// baseURL: 'http://10.0.2.2:3000/api',
// baseURL: 'https://stg-darmasaba.wibudev.com/api',
// baseURL: 'http://192.168.154.198:3000/api',
baseURL: Constants?.expoConfig?.extra?.URL_API
});