Merge pull request 'amalia/03-sept-25' (#34) from amalia/03-sept-25 into join
Reviewed-on: bip/mobile-darmasaba#34
This commit is contained in:
@@ -4,7 +4,7 @@ export default {
|
||||
expo: {
|
||||
name: "mobile-darmasaba",
|
||||
slug: "mobile-darmasaba",
|
||||
version: "1.0.0",
|
||||
version: "1.0.2",
|
||||
jsEngine: "jsc",
|
||||
orientation: "portrait",
|
||||
icon: "./assets/images/icon.png",
|
||||
@@ -21,12 +21,19 @@ export default {
|
||||
},
|
||||
android: {
|
||||
package: "mobiledarmasaba.app",
|
||||
versionCode: 1,
|
||||
versionCode: 6,
|
||||
adaptiveIcon: {
|
||||
foregroundImage: "./assets/images/splash-icon.png",
|
||||
backgroundColor: "#ffffff"
|
||||
},
|
||||
googleServicesFile: "./google-services.json"
|
||||
googleServicesFile: "./google-services.json",
|
||||
permissions: [
|
||||
"READ_EXTERNAL_STORAGE",
|
||||
"WRITE_EXTERNAL_STORAGE",
|
||||
"READ_MEDIA_IMAGES", // Android 13+
|
||||
"READ_MEDIA_VIDEO", // Android 13+
|
||||
"READ_MEDIA_AUDIO" // Android 13+
|
||||
]
|
||||
},
|
||||
web: {
|
||||
bundler: "metro",
|
||||
|
||||
@@ -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>
|
||||
)
|
||||
|
||||
38
bump-version.js
Normal file
38
bump-version.js
Normal file
@@ -0,0 +1,38 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const configPath = path.join(__dirname, "app.config.js");
|
||||
let configFile = fs.readFileSync(configPath, "utf8");
|
||||
|
||||
// --- Update versionCode ---
|
||||
const codeRegex = /versionCode:\s*(\d+)/;
|
||||
const codeMatch = configFile.match(codeRegex);
|
||||
|
||||
if (!codeMatch) {
|
||||
console.error("❌ Tidak menemukan versionCode di app.config.js");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const currentCode = parseInt(codeMatch[1], 10);
|
||||
const newCode = currentCode + 1;
|
||||
configFile = configFile.replace(codeRegex, `versionCode: ${newCode}`);
|
||||
|
||||
// --- Update versionName ---
|
||||
const nameRegex = /version:\s*"(.*?)"/;
|
||||
const nameMatch = configFile.match(nameRegex);
|
||||
|
||||
if (!nameMatch) {
|
||||
console.error("❌ Tidak menemukan version di app.config.js");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
let [major, minor, patch] = nameMatch[1].split(".").map(Number);
|
||||
patch += 1; // bump patch version
|
||||
const newName = `${major}.${minor}.${patch}`;
|
||||
configFile = configFile.replace(nameRegex, `version: "${newName}"`);
|
||||
|
||||
// --- Simpan file ---
|
||||
fs.writeFileSync(configPath, configFile, "utf8");
|
||||
|
||||
console.log(`✅ versionCode: ${currentCode} → ${newCode}`);
|
||||
console.log(`✅ versionName: ${nameMatch[1]} → ${newName}`);
|
||||
@@ -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 }}>
|
||||
|
||||
@@ -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 }}>
|
||||
|
||||
4
eas.json
4
eas.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"cli": {
|
||||
"version": ">= 16.10.0",
|
||||
"appVersionSource": "remote"
|
||||
"appVersionSource": "local"
|
||||
},
|
||||
"build": {
|
||||
"development": {
|
||||
@@ -53,4 +53,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
});
|
||||
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
"ios": "expo run:ios",
|
||||
"web": "expo start --web",
|
||||
"test": "jest --watchAll",
|
||||
"lint": "expo lint"
|
||||
"lint": "expo lint",
|
||||
"bump": "node bump-version.js",
|
||||
"build:android": "npm run bump && eas build -p android --profile production"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "jest-expo"
|
||||
|
||||
Reference in New Issue
Block a user