chore(migrate-manga): Allow open manga by clicking cover while in selection mode (#924)

This commit is contained in:
Cuong-Tran 2025-05-26 15:36:20 +07:00 committed by GitHub
parent cfa9f6bfef
commit 49c012e548
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 16 deletions

View file

@ -60,7 +60,7 @@ fun MigrateMangaScreen(
navigateUp: () -> Unit, navigateUp: () -> Unit,
title: String, title: String,
state: MigrateMangaScreenModel.State, state: MigrateMangaScreenModel.State,
onClickItem: (MigrateMangaItem) -> Unit, onClickItem: (Manga) -> Unit,
onClickCover: (Manga) -> Unit, onClickCover: (Manga) -> Unit,
// KMK --> // KMK -->
onMultiMigrateClicked: (() -> Unit), onMultiMigrateClicked: (() -> Unit),
@ -145,7 +145,7 @@ fun MigrateMangaScreen(
private fun MigrateMangaContent( private fun MigrateMangaContent(
contentPadding: PaddingValues, contentPadding: PaddingValues,
state: MigrateMangaScreenModel.State, state: MigrateMangaScreenModel.State,
onClickItem: (MigrateMangaItem) -> Unit, onClickItem: (Manga) -> Unit,
onClickCover: (Manga) -> Unit, onClickCover: (Manga) -> Unit,
// KMK --> // KMK -->
onMangaSelected: (MigrateMangaItem, Boolean, Boolean, Boolean) -> Unit, onMangaSelected: (MigrateMangaItem, Boolean, Boolean, Boolean) -> Unit,
@ -156,23 +156,21 @@ private fun MigrateMangaContent(
state = listState, state = listState,
) { ) {
// KMK <-- // KMK <--
items(items = state.titles) { items(items = state.titles) { item ->
MigrateMangaItem( MigrateMangaItem(
manga = it.manga, manga = item.manga,
onClickItem = { onClickItem = {
// KMK --> // KMK -->
when { when {
state.selectionMode -> onMangaSelected(it, !it.selected, true, false) state.selectionMode -> onMangaSelected(item, !item.selected, true, false)
// KMK <-- // KMK <--
else -> onClickItem(it) else -> onClickItem(it)
} }
}, },
onClickCover = { onClickCover = onClickCover,
onClickCover(it.manga) // KMK -->
// KMK --> onLongClick = { onMangaSelected(item, !item.selected, true, true) },
}.takeIf { !state.selectionMode }, selected = item.selected,
onLongClick = { onMangaSelected(it, !it.selected, true, true) },
selected = it.selected,
modifier = Modifier.animateItemFastScroll(), modifier = Modifier.animateItemFastScroll(),
// KMK <-- // KMK <--
) )
@ -183,8 +181,8 @@ private fun MigrateMangaContent(
@Composable @Composable
private fun MigrateMangaItem( private fun MigrateMangaItem(
manga: Manga, manga: Manga,
onClickItem: () -> Unit, onClickItem: (Manga) -> Unit,
onClickCover: (() -> Unit)?, onClickCover: (Manga) -> Unit,
// KMK --> // KMK -->
onLongClick: () -> Unit, onLongClick: () -> Unit,
selected: Boolean, selected: Boolean,
@ -194,8 +192,8 @@ private fun MigrateMangaItem(
BaseMangaListItem( BaseMangaListItem(
modifier = modifier, modifier = modifier,
manga = manga, manga = manga,
onClickItem = onClickItem, onClickItem = { onClickItem(manga) },
onClickCover = { onClickCover?.invoke() }, onClickCover = { onClickCover(manga) },
// KMK --> // KMK -->
onLongClick = onLongClick, onLongClick = onLongClick,
selected = selected, selected = selected,

View file

@ -47,7 +47,7 @@ data class MigrateMangaScreen(
PreMigrationScreen.navigateToMigration( PreMigrationScreen.navigateToMigration(
Injekt.get<UnsortedPreferences>().skipPreMigration().get(), Injekt.get<UnsortedPreferences>().skipPreMigration().get(),
navigator, navigator,
listOf(it.manga.id), listOf(it.id),
) )
// SY <-- // SY <--
}, },