test(mobile): stallion intergration starts
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import * as Updates from "expo-updates";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
@@ -8,14 +9,13 @@ import {
|
|||||||
TextInput,
|
TextInput,
|
||||||
View,
|
View,
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
import * as Updates from 'expo-updates';
|
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const [buffer, setBuffer] = useState("");
|
const [buffer, setBuffer] = useState("");
|
||||||
const [items, setItems] = useState<string[]>([]);
|
const [items, setItems] = useState<string[]>([]);
|
||||||
const [status, setStatus] = useState("");
|
const [status, setStatus] = useState("");
|
||||||
|
|
||||||
const [updates, setUpdates] = useState("")
|
const [updates, setUpdates] = useState("");
|
||||||
|
|
||||||
const handleChange = (text: string) => {
|
const handleChange = (text: string) => {
|
||||||
// Scanner "types" characters then appends Enter (\n)
|
// Scanner "types" characters then appends Enter (\n)
|
||||||
@@ -28,37 +28,36 @@ export default function App() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
async function checkServerUpdate() {
|
async function checkServerUpdate() {
|
||||||
setUpdates('Checking for updates...');
|
setUpdates("Checking for updates...");
|
||||||
try {
|
try {
|
||||||
|
const cacheBuster = `?t=${Date.now()}`;
|
||||||
|
|
||||||
const cacheBuster = `?t=${Date.now()}`;
|
const res = await Updates.checkForUpdateAsync();
|
||||||
|
console.log("Update check result:", res);
|
||||||
|
|
||||||
const res = await Updates.checkForUpdateAsync();
|
if (res.isAvailable) {
|
||||||
console.log('Update check result:', res);
|
setUpdates("Update available! Downloading...");
|
||||||
|
const fetchResult = await Updates.fetchUpdateAsync();
|
||||||
if (res.isAvailable) {
|
console.log("Fetch result:", fetchResult);
|
||||||
setUpdates('Update available! Downloading...');
|
|
||||||
const fetchResult = await Updates.fetchUpdateAsync();
|
if (fetchResult.isNew) {
|
||||||
console.log('Fetch result:', fetchResult);
|
setUpdates("Update downloaded! Reloading app...");
|
||||||
|
// Add a small delay to ensure everything is ready
|
||||||
if (fetchResult.isNew) {
|
setTimeout(() => {
|
||||||
setUpdates('Update downloaded! Reloading app...');
|
Updates.reloadAsync();
|
||||||
// Add a small delay to ensure everything is ready
|
}, 1000);
|
||||||
setTimeout(() => {
|
} else {
|
||||||
Updates.reloadAsync();
|
setUpdates("Update download completed but no new bundle?");
|
||||||
}, 1000);
|
}
|
||||||
} else {
|
} else {
|
||||||
setUpdates('Update download completed but no new bundle?');
|
setUpdates("No new update available.");
|
||||||
}
|
}
|
||||||
} else {
|
} catch (e: any) {
|
||||||
setUpdates('No new update available.');
|
console.error("Update error:", e);
|
||||||
}
|
setUpdates(`Update failed: ${e.message}`);
|
||||||
} catch (e: any) {
|
}
|
||||||
console.error('Update error:', e);
|
}
|
||||||
setUpdates(`Update failed: ${e.message}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleScan = (code: string) => {
|
const handleScan = (code: string) => {
|
||||||
//console.log("Scanned:", code);
|
//console.log("Scanned:", code);
|
||||||
@@ -87,9 +86,8 @@ async function checkServerUpdate() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
|
<Text>But maybe later i will be </Text>
|
||||||
<Text>But maybe later i will be </Text>
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
title="Clear Items"
|
title="Clear Items"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
@@ -112,16 +110,19 @@ async function checkServerUpdate() {
|
|||||||
width: 0,
|
width: 0,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Pressable onPress={checkServerUpdate}style={{
|
<Pressable
|
||||||
marginVertical: 12,
|
onPress={checkServerUpdate}
|
||||||
padding: 12,
|
style={{
|
||||||
backgroundColor: '#007AFF',
|
marginVertical: 12,
|
||||||
borderRadius: 6,
|
padding: 12,
|
||||||
}}>
|
backgroundColor: "#007AFF",
|
||||||
|
borderRadius: 6,
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Text>Check Update</Text>
|
<Text>Check Update</Text>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
<Text>Update Data</Text>
|
<Text>Update Data</Text>
|
||||||
<Text>{updates}</Text>
|
<Text>{updates}</Text>
|
||||||
<FlatList
|
<FlatList
|
||||||
data={items}
|
data={items}
|
||||||
keyExtractor={(_, i) => i.toString()}
|
keyExtractor={(_, i) => i.toString()}
|
||||||
@@ -129,9 +130,7 @@ async function checkServerUpdate() {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Text style={styles.status}>{status}</Text>
|
<Text style={styles.status}>{status}</Text>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
17
mobileLst/babel.config.js
Normal file
17
mobileLst/babel.config.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
module.exports = function (api) {
|
||||||
|
api.cache(true);
|
||||||
|
return {
|
||||||
|
presets: ["babel-preset-expo"],
|
||||||
|
plugins: [
|
||||||
|
[
|
||||||
|
"module-resolver",
|
||||||
|
{
|
||||||
|
root: ["./"],
|
||||||
|
alias: {
|
||||||
|
"@": "./",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
};
|
||||||
|
};
|
||||||
12
mobileLst/metro.config.ts
Normal file
12
mobileLst/metro.config.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
const { getDefaultConfig } = require("@expo/metro-config");
|
||||||
|
const path = require("path");
|
||||||
|
|
||||||
|
const projectRoot = __dirname;
|
||||||
|
const config = getDefaultConfig(projectRoot);
|
||||||
|
|
||||||
|
config.resolver.alias = {
|
||||||
|
...config.resolver.alias,
|
||||||
|
"@": path.resolve(projectRoot),
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = config;
|
||||||
1866
mobileLst/package-lock.json
generated
1866
mobileLst/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -49,7 +49,11 @@
|
|||||||
"react-native-worklets": "0.5.1"
|
"react-native-worklets": "0.5.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@react-native-community/cli": "^20.0.2",
|
||||||
|
"@react-native/metro-config": "^0.82.1",
|
||||||
"@types/react": "~19.1.0",
|
"@types/react": "~19.1.0",
|
||||||
|
"babel-plugin-module-resolver": "^5.0.2",
|
||||||
|
"babel-preset-expo": "^54.0.7",
|
||||||
"eslint": "^9.25.0",
|
"eslint": "^9.25.0",
|
||||||
"eslint-config-expo": "~10.0.0",
|
"eslint-config-expo": "~10.0.0",
|
||||||
"typescript": "~5.9.2"
|
"typescript": "~5.9.2"
|
||||||
|
|||||||
5757
package-lock.json
generated
5757
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -73,6 +73,8 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "2.2.6",
|
"@biomejs/biome": "2.2.6",
|
||||||
|
"@react-native-community/cli": "^20.0.2",
|
||||||
|
"@react-native/metro-config": "^0.82.1",
|
||||||
"@types/express": "^5.0.3",
|
"@types/express": "^5.0.3",
|
||||||
"@types/morgan": "^1.9.10",
|
"@types/morgan": "^1.9.10",
|
||||||
"@types/mssql": "^9.1.8",
|
"@types/mssql": "^9.1.8",
|
||||||
@@ -82,6 +84,8 @@
|
|||||||
"@types/pg": "^8.15.5",
|
"@types/pg": "^8.15.5",
|
||||||
"@types/swagger-jsdoc": "^6.0.4",
|
"@types/swagger-jsdoc": "^6.0.4",
|
||||||
"@types/swagger-ui-express": "^4.1.8",
|
"@types/swagger-ui-express": "^4.1.8",
|
||||||
|
"babel-plugin-module-resolver": "^5.0.2",
|
||||||
|
"babel-preset-expo": "^54.0.7",
|
||||||
"concurrently": "^9.2.1",
|
"concurrently": "^9.2.1",
|
||||||
"cz-conventional-changelog": "^3.3.0",
|
"cz-conventional-changelog": "^3.3.0",
|
||||||
"standard-version": "^9.5.0",
|
"standard-version": "^9.5.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user