test(mobile): more testing on ota
This commit is contained in:
@@ -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 (
|
||||
<View style={styles.container}>
|
||||
|
||||
<Text>But maybe later i will be </Text>
|
||||
|
||||
<Button
|
||||
title="Clear Items"
|
||||
onPress={() => {
|
||||
@@ -110,7 +129,9 @@ async function checkServerUpdate() {
|
||||
/>
|
||||
|
||||
<Text style={styles.status}>{status}</Text>
|
||||
|
||||
</View>
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user