fix: load recent photo prices independently of photo results

This commit is contained in:
2026-09-15 16:21:44 +08:00
parent fa827fdd99
commit 2231c38792
2 changed files with 62 additions and 6 deletions
@@ -74,7 +74,11 @@ class FaceRecognitionResultViewModel @Inject constructor(
toPage(AppRoutes.buildRecentPhotosRoute())
}
fun loadRecentPhotos() = recentLoader.load()
fun loadRecentPhotos() {
// Pricing belongs to the page, not to a successful/non-empty photo response.
if (recentPhotosState.value == RecentPhotosState.IDLE) verifyResult(emptyList())
recentLoader.load()
}
fun retryRecentPhotos() = recentLoader.load(retry = true)
// 原始结果列表(用于获取图片id)
@@ -177,6 +181,7 @@ class FaceRecognitionResultViewModel @Inject constructor(
// Returning from a pushed recent-photos page must retain selection, pricing and image state.
if (faceResultsInitialized) return
faceResultsInitialized = true
verifyResult(emptyList())
viewModelScope.launch { applyPhotoList(results) }
}
@@ -215,8 +220,6 @@ class FaceRecognitionResultViewModel @Inject constructor(
// 初始化加载状态
_imageLoadStates.value = initialPhotos.associate { it.url to ImageLoadState() }
// 页面初始化时调用验证接口(空列表,type: 2),获取默认价格
verifyResult(emptyList())
LogUtils.d(TAG, "图片列表初始化完成,共 ${initialPhotos.size} 张,宽高比将在图片加载成功后逐张更新")
}