Remove redundant userSelected from selection methods (mihonapp-mihon#2976)

(cherry picked from commit 9867c160f781b52cd297f7b1202cc6963b375df0)
This commit is contained in:
Cuong-Tran 2026-02-20 21:22:05 +07:00
parent 4c21f019c0
commit a52609b549
4 changed files with 11 additions and 15 deletions

View file

@ -194,7 +194,7 @@ fun MangaScreen(
onChapterSwipe: (ChapterList.Item, LibraryPreferences.ChapterSwipeAction) -> Unit,
// Chapter selection
onChapterSelected: (ChapterList.Item, Boolean, Boolean, Boolean) -> Unit,
onChapterSelected: (ChapterList.Item, Boolean, Boolean) -> Unit,
onAllChapterSelected: (Boolean) -> Unit,
onInvertSelection: () -> Unit,
@ -404,7 +404,7 @@ private fun MangaScreenSmallImpl(
onChapterSwipe: (ChapterList.Item, LibraryPreferences.ChapterSwipeAction) -> Unit,
// Chapter selection
onChapterSelected: (ChapterList.Item, Boolean, Boolean, Boolean) -> Unit,
onChapterSelected: (ChapterList.Item, Boolean, Boolean) -> Unit,
onAllChapterSelected: (Boolean) -> Unit,
onInvertSelection: () -> Unit,
@ -868,7 +868,7 @@ private fun MangaScreenLargeImpl(
onChapterSwipe: (ChapterList.Item, LibraryPreferences.ChapterSwipeAction) -> Unit,
// Chapter selection
onChapterSelected: (ChapterList.Item, Boolean, Boolean, Boolean) -> Unit,
onChapterSelected: (ChapterList.Item, Boolean, Boolean) -> Unit,
onAllChapterSelected: (Boolean) -> Unit,
onInvertSelection: () -> Unit,
@ -1307,7 +1307,7 @@ private fun LazyListScope.sharedChapterItems(
// SY <--
onChapterClicked: (Chapter) -> Unit,
onDownloadChapter: ((List<ChapterList.Item>, ChapterDownloadAction) -> Unit)?,
onChapterSelected: (ChapterList.Item, Boolean, Boolean, Boolean) -> Unit,
onChapterSelected: (ChapterList.Item, Boolean, Boolean) -> Unit,
onChapterSwipe: (ChapterList.Item, LibraryPreferences.ChapterSwipeAction) -> Unit,
) {
items(
@ -1376,14 +1376,14 @@ private fun LazyListScope.sharedChapterItems(
chapterSwipeStartAction = chapterSwipeStartAction,
chapterSwipeEndAction = chapterSwipeEndAction,
onLongClick = {
onChapterSelected(item, !item.selected, true, true)
onChapterSelected(item, !item.selected, true)
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
},
onClick = {
onChapterItemClick(
chapterItem = item,
isAnyChapterSelected = isAnyChapterSelected,
onToggleSelection = { onChapterSelected(item, !item.selected, true, false) },
onToggleSelection = { onChapterSelected(item, !item.selected, false) },
onChapterClicked = onChapterClicked,
)
},

View file

@ -171,7 +171,6 @@ internal fun LazyListScope.updatesUiItems(
// KMK -->
UpdateSelectionOptions(
selected = !updatesItem.selected,
userSelected = true,
fromLongPress = true,
isGroup = isLeader && item.isExpandable,
isExpanded = isExpanded,
@ -186,7 +185,6 @@ internal fun LazyListScope.updatesUiItems(
// KMK -->
UpdateSelectionOptions(
selected = !updatesItem.selected,
userSelected = true,
fromLongPress = false,
isGroup = isLeader && item.isExpandable,
isExpanded = isExpanded,

View file

@ -1725,7 +1725,6 @@ class MangaScreenModel(
fun toggleSelection(
item: ChapterList.Item,
selected: Boolean,
userSelected: Boolean = false,
fromLongPress: Boolean = false,
) {
updateSuccessState { successState ->
@ -1741,7 +1740,7 @@ class MangaScreenModel(
set(selectedIndex, selectedItem.copy(selected = selected))
selectedChapterIds.addOrRemove(item.id, selected)
if (selected && userSelected && fromLongPress) {
if (selected && fromLongPress) {
if (firstSelection) {
selectedPositions[0] = selectedIndex
selectedPositions[1] = selectedIndex
@ -1767,7 +1766,7 @@ class MangaScreenModel(
}
}
}
} else if (userSelected && !fromLongPress) {
} else if (!fromLongPress) {
if (!selected) {
if (selectedIndex == selectedPositions[0]) {
selectedPositions[0] = indexOfFirst { it.selected }

View file

@ -362,7 +362,6 @@ class UpdatesScreenModel(
/** Bundles all of the boolean flags for updateselection into one type */
data class UpdateSelectionOptions(
val selected: Boolean,
val userSelected: Boolean = false,
val fromLongPress: Boolean = false,
val isGroup: Boolean = false,
val isExpanded: Boolean = false,
@ -376,7 +375,7 @@ class UpdatesScreenModel(
// KMK <--
) {
// KMK -->
val (selected, userSelected, fromLongPress, isGroup, isExpanded) = selectionOptions
val (selected, fromLongPress, isGroup, isExpanded) = selectionOptions
// KMK <--
mutableState.update { state ->
// KMK -->
@ -410,7 +409,7 @@ class UpdatesScreenModel(
}
// KMK <--
if (selected && userSelected && fromLongPress) {
if (selected && fromLongPress) {
if (firstSelection) {
selectedPositions[0] = selectedIndex
selectedPositions[1] = selectedIndex
@ -436,7 +435,7 @@ class UpdatesScreenModel(
}
}
}
} else if (userSelected && !fromLongPress) {
} else if (!fromLongPress) {
if (!selected) {
if (selectedIndex == selectedPositions[0]) {
selectedPositions[0] = indexOfFirst { it.selected }