test(mobile): more testing on ota
This commit is contained in:
@@ -11,16 +11,6 @@
|
|||||||
"ios": {
|
"ios": {
|
||||||
"supportsTablet": true
|
"supportsTablet": true
|
||||||
},
|
},
|
||||||
"updates": {
|
|
||||||
"enabled": true,
|
|
||||||
"url": "http://10.193.0.56:4000/api/mobile/updates",
|
|
||||||
"fallbackToCacheTimeout": 30000,
|
|
||||||
"codeSigningCertificate": "./certs/certificate.pem",
|
|
||||||
"codeSigningMetadata": {
|
|
||||||
"keyid": "self-hosted",
|
|
||||||
"alg": "rsa-v1_5-sha256"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtimeVersion": "1.0.0",
|
"runtimeVersion": "1.0.0",
|
||||||
"android": {
|
"android": {
|
||||||
"adaptiveIcon": {
|
"adaptiveIcon": {
|
||||||
@@ -31,6 +21,7 @@
|
|||||||
},
|
},
|
||||||
"package": "com.company.lstscanner",
|
"package": "com.company.lstscanner",
|
||||||
"versionCode": 1,
|
"versionCode": 1,
|
||||||
|
"runtimeVersion": "1.0.0",
|
||||||
"edgeToEdgeEnabled": true,
|
"edgeToEdgeEnabled": true,
|
||||||
"predictiveBackGestureEnabled": false
|
"predictiveBackGestureEnabled": false
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -31,16 +31,32 @@ 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 res = await Updates.checkForUpdateAsync();
|
const res = await Updates.checkForUpdateAsync();
|
||||||
|
console.log('Update check result:', res);
|
||||||
|
|
||||||
if (res.isAvailable) {
|
if (res.isAvailable) {
|
||||||
setUpdates('Update available! Fetching and reloading...');
|
setUpdates('Update available! Downloading...');
|
||||||
await Updates.fetchUpdateAsync();
|
const fetchResult = await Updates.fetchUpdateAsync();
|
||||||
await Updates.reloadAsync();
|
console.log('Fetch result:', fetchResult);
|
||||||
|
|
||||||
|
if (fetchResult.isNew) {
|
||||||
|
setUpdates('Update downloaded! Reloading app...');
|
||||||
|
// Add a small delay to ensure everything is ready
|
||||||
|
setTimeout(() => {
|
||||||
|
Updates.reloadAsync();
|
||||||
|
}, 1000);
|
||||||
|
} else {
|
||||||
|
setUpdates('Update download completed but no new bundle?');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setUpdates('No new update available.');
|
setUpdates('No new update available.');
|
||||||
}
|
}
|
||||||
} catch (e:any) {
|
} catch (e: any) {
|
||||||
setUpdates(`Update check failed: ${e.message}`);
|
console.error('Update error:', e);
|
||||||
|
setUpdates(`Update failed: ${e.message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,6 +87,9 @@ async function checkServerUpdate() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
|
|
||||||
|
<Text>But maybe later i will be </Text>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
title="Clear Items"
|
title="Clear Items"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
@@ -110,7 +129,9 @@ async function checkServerUpdate() {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Text style={styles.status}>{status}</Text>
|
<Text style={styles.status}>{status}</Text>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
11
mobileLst/package-lock.json
generated
11
mobileLst/package-lock.json
generated
@@ -37,6 +37,7 @@
|
|||||||
"react-native-reanimated": "~4.1.1",
|
"react-native-reanimated": "~4.1.1",
|
||||||
"react-native-safe-area-context": "~5.6.0",
|
"react-native-safe-area-context": "~5.6.0",
|
||||||
"react-native-screens": "~4.16.0",
|
"react-native-screens": "~4.16.0",
|
||||||
|
"react-native-stallion": "^2.2.0",
|
||||||
"react-native-web": "~0.21.0",
|
"react-native-web": "~0.21.0",
|
||||||
"react-native-worklets": "0.5.1"
|
"react-native-worklets": "0.5.1"
|
||||||
},
|
},
|
||||||
@@ -10916,6 +10917,16 @@
|
|||||||
"react-native": "*"
|
"react-native": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/react-native-stallion": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-native-stallion/-/react-native-stallion-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-odbXYXxsYTMQLpt1w5J7ZjCgYrvVG+lsRGQrWb1bCgsEB1PA5Vs9BR5WfA4UPjYWcDfeaUyFQvAzGH1Rpj7iCA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "*",
|
||||||
|
"react-native": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/react-native-web": {
|
"node_modules/react-native-web": {
|
||||||
"version": "0.21.2",
|
"version": "0.21.2",
|
||||||
"resolved": "https://registry.npmjs.org/react-native-web/-/react-native-web-0.21.2.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-web/-/react-native-web-0.21.2.tgz",
|
||||||
|
|||||||
@@ -9,11 +9,10 @@
|
|||||||
"ios": "expo run:ios",
|
"ios": "expo run:ios",
|
||||||
"web": "expo start --web",
|
"web": "expo start --web",
|
||||||
"lint": "expo lint",
|
"lint": "expo lint",
|
||||||
"build:clean": "expo prebuild --clean && cd android && gradlew.bat assembleRelease && npm run ",
|
"build:apk": "expo prebuild --clean && cd android && gradlew.bat assembleRelease ",
|
||||||
"build:android": "cd android && gradlew.bat assembleRelease",
|
"build:ota": "set EXPO_NO_EAS_UPDATE=1 && npx expo export --platform android --experimental-bundle",
|
||||||
"build:ota": "set EXPO_NO_EAS_UPDATE=1 && npx expo export --platform android --output-dir dist --experimental-bundle",
|
|
||||||
"update": "adb install android/app/build/outputs/apk/release/app-release.apk",
|
"update": "adb install android/app/build/outputs/apk/release/app-release.apk",
|
||||||
"debug": "adb logcat | Select-String \"Expo"
|
"debug": "adb logcat | Select-String \"lstscanner"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@expo/vector-icons": "^15.0.3",
|
"@expo/vector-icons": "^15.0.3",
|
||||||
@@ -45,6 +44,7 @@
|
|||||||
"react-native-reanimated": "~4.1.1",
|
"react-native-reanimated": "~4.1.1",
|
||||||
"react-native-safe-area-context": "~5.6.0",
|
"react-native-safe-area-context": "~5.6.0",
|
||||||
"react-native-screens": "~4.16.0",
|
"react-native-screens": "~4.16.0",
|
||||||
|
"react-native-stallion": "^2.2.0",
|
||||||
"react-native-web": "~0.21.0",
|
"react-native-web": "~0.21.0",
|
||||||
"react-native-worklets": "0.5.1"
|
"react-native-worklets": "0.5.1"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"**/*.ts",
|
"**/*.ts",
|
||||||
"**/*.tsx"
|
"**/*.tsx",
|
||||||
|
".expo/types/**/*.ts",
|
||||||
|
"expo-env.d.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user