mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-16 23:12:12 +00:00
Remove pending removal item functionality
Removed pending removal item logic and modal from LibraryScreen.
This commit is contained in:
parent
2d7bbd4fba
commit
485e1d2c65
1 changed files with 4 additions and 17 deletions
|
|
@ -37,6 +37,7 @@ import kotlinx.coroutines.launch
|
|||
fun LibraryScreen(
|
||||
modifier: Modifier = Modifier,
|
||||
onPosterClick: ((LibraryItem) -> Unit)? = null,
|
||||
onPosterLongClick: ((LibraryItem) -> Unit)? = null,
|
||||
onSectionViewAllClick: ((LibrarySection) -> Unit)? = null,
|
||||
) {
|
||||
val uiState by remember {
|
||||
|
|
@ -44,11 +45,12 @@ fun LibraryScreen(
|
|||
LibraryRepository.uiState
|
||||
}.collectAsStateWithLifecycle()
|
||||
val networkStatusUiState by NetworkStatusRepository.uiState.collectAsStateWithLifecycle()
|
||||
var pendingRemovalItem by remember { mutableStateOf<LibraryItem?>(null) }
|
||||
// var pendingRemovalItem by remember { mutableStateOf<LibraryItem?>(null) }
|
||||
var observedOfflineState by remember { mutableStateOf(false) }
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
val isTraktSource = uiState.sourceMode == LibrarySourceMode.TRAKT
|
||||
|
||||
|
||||
LaunchedEffect(networkStatusUiState.condition, isTraktSource) {
|
||||
when (networkStatusUiState.condition) {
|
||||
NetworkCondition.NoInternet,
|
||||
|
|
@ -156,27 +158,12 @@ fun LibraryScreen(
|
|||
onPosterClick = onPosterClick,
|
||||
onSectionViewAllClick = onSectionViewAllClick,
|
||||
onPosterLongClick = { item ->
|
||||
if (!isTraktSource) {
|
||||
pendingRemovalItem = item
|
||||
}
|
||||
onPosterLongClick?.invoke(item)
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NuvioStatusModal(
|
||||
title = "Remove from Library?",
|
||||
message = pendingRemovalItem?.let { "Remove ${it.name} from your library?" }.orEmpty(),
|
||||
isVisible = pendingRemovalItem != null,
|
||||
confirmText = "Remove",
|
||||
dismissText = "Cancel",
|
||||
onConfirm = {
|
||||
pendingRemovalItem?.id?.let(LibraryRepository::remove)
|
||||
pendingRemovalItem = null
|
||||
},
|
||||
onDismiss = { pendingRemovalItem = null },
|
||||
)
|
||||
}
|
||||
|
||||
private fun LazyListScope.librarySections(
|
||||
|
|
|
|||
Loading…
Reference in a new issue