From 75c0659658cbbb7e983df5538538d6429a325379 Mon Sep 17 00:00:00 2001 From: blake Date: Sun, 16 Nov 2025 20:11:34 -0600 Subject: [PATCH] test(mobile): more testing on ota --- mobileLst/app.json | 11 +---------- mobileLst/app/index.tsx | 31 ++++++++++++++++++++++++++----- mobileLst/package-lock.json | 11 +++++++++++ mobileLst/package.json | 8 ++++---- mobileLst/tsconfig.json | 4 +++- 5 files changed, 45 insertions(+), 20 deletions(-) diff --git a/mobileLst/app.json b/mobileLst/app.json index 1d4db5f..1e0f770 100644 --- a/mobileLst/app.json +++ b/mobileLst/app.json @@ -11,16 +11,6 @@ "ios": { "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", "android": { "adaptiveIcon": { @@ -31,6 +21,7 @@ }, "package": "com.company.lstscanner", "versionCode": 1, + "runtimeVersion": "1.0.0", "edgeToEdgeEnabled": true, "predictiveBackGestureEnabled": false }, diff --git a/mobileLst/app/index.tsx b/mobileLst/app/index.tsx index cecf889..1da4d61 100644 --- a/mobileLst/app/index.tsx +++ b/mobileLst/app/index.tsx @@ -31,16 +31,32 @@ export default function App() { async function checkServerUpdate() { setUpdates('Checking for updates...'); try { + + const cacheBuster = `?t=${Date.now()}`; + const res = await Updates.checkForUpdateAsync(); + console.log('Update check result:', res); + if (res.isAvailable) { - setUpdates('Update available! Fetching and reloading...'); - await Updates.fetchUpdateAsync(); - await Updates.reloadAsync(); + setUpdates('Update available! Downloading...'); + const fetchResult = await Updates.fetchUpdateAsync(); + 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 { setUpdates('No new update available.'); } - } catch (e:any) { - setUpdates(`Update check failed: ${e.message}`); + } catch (e: any) { + console.error('Update error:', e); + setUpdates(`Update failed: ${e.message}`); } } @@ -71,6 +87,9 @@ async function checkServerUpdate() { return ( + + But maybe later i will be +