feat(intial auth): intial auth setup for the scanner
Some checks failed
Build and Push LST Docker Image / docker (push) Has been cancelled

This commit is contained in:
2026-05-05 19:48:36 -05:00
parent 4e0cf8c54c
commit cd13360cfb
46 changed files with 7847 additions and 206 deletions

View File

@@ -1,13 +1,26 @@
import React from 'react'
import { Text, View } from 'react-native'
import React from "react";
import { Text, View } from "react-native";
import { Button } from "../../components/ui/button";
export default function Logs() {
return (
<View style={{
const getInfo = async () => {
const info = "ho";
console.log(info);
};
return (
<View
style={{
flex: 1,
//justifyContent: "center",
alignItems: "center",
marginTop: 50,
}}><Text>Logs</Text></View>
)
}}
>
<Text>Logs</Text>
<Button onPress={getInfo}>
<Text>Check info</Text>
</Button>
</View>
);
}

View File

@@ -1,11 +1,9 @@
import React from "react";
import { View } from "react-native";
import { useAppStore } from "../../hooks/useAppStore";
import ProdScanner from "../../components/ProdScanner";
import { View } from "react-native";
import LSTScanner from "../../components/LSTScanner";
import ProdScanner from "../../components/ProdScanner";
import { useAppStore } from "../../hooks/useAppStore";
export default function scanner() {
export default function Scanner() {
const serverPort = useAppStore((s) => s.serverPort);
return (
<View
@@ -16,7 +14,11 @@ export default function scanner() {
marginTop: 50,
}}
>
{parseInt(serverPort || "0", 10) >= 50000 ? <ProdScanner /> : <LSTScanner />}
{parseInt(serverPort || "0", 10) >= 50000 ? (
<ProdScanner />
) : (
<LSTScanner />
)}
</View>
);
}

View File

@@ -4,6 +4,7 @@ import { Redirect, useRouter } from "expo-router";
import { useEffect, useState } from "react";
import { ActivityIndicator, Text, View } from "react-native";
import { useAppStore } from "../hooks/useAppStore";
import { useMobileAuthStore } from "../hooks/useMobileAuth";
import { useServerStore } from "../hooks/useServerCheck";
import { devDelay } from "../lib/devMode";
@@ -12,6 +13,7 @@ export default function Index() {
const [message, setMessage] = useState(<Text>Starting app...</Text>);
const [ready, setReady] = useState(false);
const setServerVersion = useServerStore((s) => s.setServerVersion);
//const { isUnlocked } = useMobileAuthStore();
const hasHydrated = useAppStore((s) => s.hasHydrated);
const serverPort = useAppStore((s) => s.serverPort);
@@ -86,7 +88,7 @@ export default function Index() {
// TODO if theres an update go to update screen message :D
setMessage(<Text>Opening LST scan app</Text>);
await devDelay(3250);
//router.replace("/scanner");
setReady(true);
} catch (error) {
console.log("Startup error", error);
@@ -104,6 +106,9 @@ export default function Index() {
setServerVersion,
]);
// if (ready && !isUnlocked) {
// return <Redirect href={"/login"} />;
// }
if (ready) {
return <Redirect href="/(tabs)/scanner" />;
}

View File

@@ -0,0 +1,52 @@
import axios from "axios";
import Constants from "expo-constants";
import { useRouter } from "expo-router";
import { useState } from "react";
import { Alert, Button, Text, View } from "react-native";
import { Input } from "../components/ui/input";
import { useAppStore } from "../hooks/useAppStore";
import { useMobileAuthStore } from "../hooks/useMobileAuth";
export default function Login() {
const { setUser } = useMobileAuthStore();
const serverPort = useAppStore((s) => s.serverPort);
const serverIp = useAppStore((s) => s.serverIp);
const onLogin = async () => {
try {
const res = await axios.get(
`http://${serverIp}:${parseInt(serverPort || "0", 10) >= 50000 ? "3000" : serverPort}/lst/api/mobile/version`,
{
timeout: 5000,
},
);
console.log(res.data);
} catch (error) {}
};
return (
<View
style={{
flex: 1,
//justifyContent: "center",
alignItems: "center",
marginTop: 50,
}}
>
<View className="flex items-center m-5">
<Text style={{ fontSize: 20, fontWeight: "600" }}>
LST Scanner Login
</Text>
<View className="w-64 p-4">
<Input
className="w-fit"
keyboardType="number-pad"
textContentType="oneTimeCode"
placeholder="Pin number"
/>
</View>
</View>
<Button title="Login" onPress={onLogin} />
</View>
);
}

View File

@@ -154,10 +154,10 @@ export default function Setup() {
marginBottom: 12,
}}
>
<Text className="text-[12] color-#666">
<Text className="text-sm color-[#312f2f]">
App v{version}-{build}
</Text>
<Text className="text-[12] color-#666">
<Text className="text-sm color-[#312f2f]">
Server version - v{server?.versionName}-{server?.versionCode}
</Text>
</View>