feat(api): implement API configuration validation and error handling in home screen and update section

This commit is contained in:
zimplexing
2025-08-14 14:08:11 +08:00
parent cb3f694cdc
commit 10a806a657
7 changed files with 263 additions and 35 deletions

View File

@@ -195,7 +195,7 @@ const VideoCard = forwardRef<View, VideoCardProps>(
{isContinueWatching && (
<View style={styles.infoRow}>
<ThemedText style={styles.continueLabel}>
{episodeIndex! + 1} {Math.round((progress || 0) * 100)}%
{episodeIndex} {Math.round((progress || 0) * 100)}%
</ThemedText>
</View>
)}
@@ -343,4 +343,4 @@ const styles = StyleSheet.create({
color: Colors.dark.primary,
fontSize: 12,
},
});
});

View File

@@ -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,