mirror of
https://github.com/zimplexing/OrionTV.git
synced 2026-02-28 06:54:42 +08:00
feat(api): implement API configuration validation and error handling in home screen and update section
This commit is contained in:
@@ -6,8 +6,16 @@ import { useUpdateStore } from "@/stores/updateStore";
|
||||
// import { UPDATE_CONFIG } from "@/constants/UpdateConfig";
|
||||
|
||||
export function UpdateSection() {
|
||||
const { currentVersion, remoteVersion, updateAvailable, downloading, downloadProgress, checkForUpdate } =
|
||||
useUpdateStore();
|
||||
const {
|
||||
currentVersion,
|
||||
remoteVersion,
|
||||
updateAvailable,
|
||||
downloading,
|
||||
downloadProgress,
|
||||
checkForUpdate,
|
||||
isLatestVersion,
|
||||
error
|
||||
} = useUpdateStore();
|
||||
|
||||
const [checking, setChecking] = React.useState(false);
|
||||
|
||||
@@ -36,6 +44,20 @@ export function UpdateSection() {
|
||||
</View>
|
||||
)}
|
||||
|
||||
{isLatestVersion && remoteVersion && (
|
||||
<View style={styles.row}>
|
||||
<ThemedText style={styles.label}>状态</ThemedText>
|
||||
<ThemedText style={[styles.value, styles.latestVersion]}>已是最新版本</ThemedText>
|
||||
</View>
|
||||
)}
|
||||
|
||||
{error && (
|
||||
<View style={styles.row}>
|
||||
<ThemedText style={styles.label}>检查结果</ThemedText>
|
||||
<ThemedText style={[styles.value, styles.errorText]}>{error}</ThemedText>
|
||||
</View>
|
||||
)}
|
||||
|
||||
{downloading && (
|
||||
<View style={styles.row}>
|
||||
<ThemedText style={styles.label}>下载进度</ThemedText>
|
||||
@@ -96,6 +118,14 @@ const styles = StyleSheet.create({
|
||||
color: "#00bb5e",
|
||||
fontWeight: "bold",
|
||||
},
|
||||
latestVersion: {
|
||||
color: "#00bb5e",
|
||||
fontWeight: "500",
|
||||
},
|
||||
errorText: {
|
||||
color: "#ff6b6b",
|
||||
fontWeight: "500",
|
||||
},
|
||||
buttonContainer: {
|
||||
flexDirection: "row",
|
||||
gap: 12,
|
||||
|
||||
Reference in New Issue
Block a user