Major improvements to upload progress.

This commit is contained in:
Patrick Fic
2025-10-31 08:18:32 -07:00
parent 8e63ef0d6d
commit ab8703a524
7 changed files with 185 additions and 61 deletions

View File

@@ -7,6 +7,7 @@ import AsyncStorage from "@react-native-async-storage/async-storage";
import * as Application from "expo-application";
import Constants from "expo-constants";
import * as Notifications from "expo-notifications";
import * as Updates from "expo-updates";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { Alert, ScrollView, StyleSheet, View } from "react-native";
@@ -182,6 +183,44 @@ function Tab({ bodyshop, currentUser, signOutStart }) {
number: `${Constants.expoConfig.version}(${Application.nativeBuildVersion} - ${Constants.expoConfig.extra.expover})`,
})}
</Text>
<Button
mode="text"
onPress={() => {
Updates.checkForUpdateAsync()
.then(async (update) => {
if (update.isAvailable) {
const reloaded = await Updates.fetchUpdateAsync();
if (reloaded.isNew) {
Alert.alert(
"Update downloaded",
"The app will now restart to apply the update.",
[
{
text: "Restart Now",
onPress: () => {
Updates.reloadAsync();
},
},
]
);
}
} else {
Alert.alert(
"No Update Available",
"You are using the latest version of the app."
);
}
})
.catch((error) => {
Alert.alert(
"Update Error",
`An error occurred while checking for updates: ${error.message}`
);
});
}}
>
Check for Update
</Button>
</ScrollView>
</SafeAreaView>
);