mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-19 00:11:45 +00:00
add watched badge in library screen
This commit is contained in:
parent
4804bc6966
commit
52b2d232de
1 changed files with 9 additions and 0 deletions
|
|
@ -31,6 +31,8 @@ import com.nuvio.app.features.home.components.HomeEmptyStateCard
|
||||||
import com.nuvio.app.features.home.components.HomePosterCard
|
import com.nuvio.app.features.home.components.HomePosterCard
|
||||||
import com.nuvio.app.features.home.components.HomeSkeletonRow
|
import com.nuvio.app.features.home.components.HomeSkeletonRow
|
||||||
import com.nuvio.app.features.profiles.ProfileRepository
|
import com.nuvio.app.features.profiles.ProfileRepository
|
||||||
|
import com.nuvio.app.features.watched.WatchedRepository
|
||||||
|
import com.nuvio.app.features.watching.application.WatchingState
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import nuvio.composeapp.generated.resources.*
|
import nuvio.composeapp.generated.resources.*
|
||||||
import org.jetbrains.compose.resources.stringResource
|
import org.jetbrains.compose.resources.stringResource
|
||||||
|
|
@ -56,6 +58,7 @@ fun LibraryScreen(
|
||||||
LibraryRepository.pullFromServer(ProfileRepository.activeProfileId)
|
LibraryRepository.pullFromServer(ProfileRepository.activeProfileId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val watchedUiState by WatchedRepository.uiState.collectAsStateWithLifecycle()
|
||||||
|
|
||||||
LaunchedEffect(networkStatusUiState.condition, isTraktSource) {
|
LaunchedEffect(networkStatusUiState.condition, isTraktSource) {
|
||||||
when (networkStatusUiState.condition) {
|
when (networkStatusUiState.condition) {
|
||||||
|
|
@ -162,6 +165,7 @@ fun LibraryScreen(
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
librarySections(
|
librarySections(
|
||||||
|
watchedKeys = watchedUiState.watchedKeys,
|
||||||
sections = uiState.sections,
|
sections = uiState.sections,
|
||||||
onPosterClick = onPosterClick,
|
onPosterClick = onPosterClick,
|
||||||
onSectionViewAllClick = onSectionViewAllClick,
|
onSectionViewAllClick = onSectionViewAllClick,
|
||||||
|
|
@ -193,6 +197,7 @@ fun LibraryScreen(
|
||||||
|
|
||||||
private fun LazyListScope.librarySections(
|
private fun LazyListScope.librarySections(
|
||||||
sections: List<LibrarySection>,
|
sections: List<LibrarySection>,
|
||||||
|
watchedKeys: Set<String>,
|
||||||
onPosterClick: ((LibraryItem) -> Unit)?,
|
onPosterClick: ((LibraryItem) -> Unit)?,
|
||||||
onSectionViewAllClick: ((LibrarySection) -> Unit)?,
|
onSectionViewAllClick: ((LibrarySection) -> Unit)?,
|
||||||
onPosterLongClick: (LibraryItem) -> Unit,
|
onPosterLongClick: (LibraryItem) -> Unit,
|
||||||
|
|
@ -216,6 +221,10 @@ private fun LazyListScope.librarySections(
|
||||||
key = { item -> "${item.type}:${item.id}" },
|
key = { item -> "${item.type}:${item.id}" },
|
||||||
) { item ->
|
) { item ->
|
||||||
HomePosterCard(
|
HomePosterCard(
|
||||||
|
isWatched = WatchingState.isPosterWatched(
|
||||||
|
watchedKeys = watchedKeys,
|
||||||
|
item = item.toMetaPreview(),
|
||||||
|
),
|
||||||
item = item.toMetaPreview(),
|
item = item.toMetaPreview(),
|
||||||
onClick = onPosterClick?.let { { it(item) } },
|
onClick = onPosterClick?.let { { it(item) } },
|
||||||
onLongClick = { onPosterLongClick(item) },
|
onLongClick = { onPosterLongClick(item) },
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue