[optimize] Optimize API call logic, do not create crashes

This commit is contained in:
acite
2025-08-25 17:22:09 +08:00
parent 0398caf3e5
commit 8fa9dfc809
4 changed files with 41 additions and 14 deletions

View File

@@ -914,6 +914,7 @@ fun VideoPlayerLandscape(videoPlayerViewModel: VideoPlayerViewModel)
@Composable
fun MiniVideoCard(modifier: Modifier, video: Video, onClick: () -> Unit)
{
var isImageLoaded by remember { mutableStateOf(false) }
Card(
modifier = modifier.height(80.dp).fillMaxWidth(),
colors = CardColors(
@@ -932,6 +933,11 @@ fun MiniVideoCard(modifier: Modifier, video: Video, onClick: () -> Unit)
.data(video.getCover())
.memoryCacheKey("${video.klass}/${video.id}/cover")
.diskCacheKey("${video.klass}/${video.id}/cover")
.listener(
onStart = { },
onSuccess = { _, _ -> isImageLoaded = true },
onError = { _, _ -> }
)
.build(),
contentDescription = null,
modifier = Modifier