From c75929789d8bc0a108942c1f3af4971384847854 Mon Sep 17 00:00:00 2001 From: FooIbar <118464521+FooIbar@users.noreply.github.com> Date: Mon, 25 Nov 2024 19:31:15 +0800 Subject: [PATCH] Show favorite name in HistoryScreen --- .../kotlin/com/hippo/ehviewer/ui/screen/HistoryScreen.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/hippo/ehviewer/ui/screen/HistoryScreen.kt b/app/src/main/kotlin/com/hippo/ehviewer/ui/screen/HistoryScreen.kt index 46dd1718d..9f55a1995 100644 --- a/app/src/main/kotlin/com/hippo/ehviewer/ui/screen/HistoryScreen.kt +++ b/app/src/main/kotlin/com/hippo/ehviewer/ui/screen/HistoryScreen.kt @@ -42,6 +42,7 @@ import androidx.paging.cachedIn import androidx.paging.compose.collectAsLazyPagingItems import androidx.paging.compose.itemContentType import androidx.paging.compose.itemKey +import androidx.paging.map import com.hippo.ehviewer.EhDB import com.hippo.ehviewer.R import com.hippo.ehviewer.Settings @@ -63,6 +64,7 @@ import com.ramcosta.composedestinations.annotation.RootGraph import com.ramcosta.composedestinations.navigation.DestinationsNavigator import kotlin.math.roundToInt import kotlinx.coroutines.delay +import kotlinx.coroutines.flow.map import kotlinx.coroutines.launch @Destination @@ -86,7 +88,12 @@ fun AnimatedVisibilityScope.HistoryScreen(navigator: DestinationsNavigator) = co } else { EhDB.historyLazyList } - }.flow.cachedIn(viewModelScope) + }.flow.map { data -> + val favCat = Settings.favCat + data.map { + it.apply { favoriteName = favCat.getOrNull(favoriteSlot) } + } + }.cachedIn(viewModelScope) }.collectAsLazyPagingItems() FavouriteStatusRouter.Observe(historyData) SearchBarScreen(