Remove download all chapters menu item

Users can still select all the chapters (long press + select all) to download them.

(cherry picked from commit 09acc534835d6aa664b037b54401a817ed44fb45)

# Conflicts:
#	app/src/main/java/eu/kanade/presentation/library/LibrarySettingsDialog.kt
This commit is contained in:
arkon 2023-03-07 22:38:27 -05:00 committed by Jobobby04
parent 6fbf250796
commit d71dbdd2f8
5 changed files with 2 additions and 14 deletions

View File

@ -13,7 +13,6 @@ fun DownloadDropdownMenu(
expanded: Boolean, expanded: Boolean,
onDismissRequest: () -> Unit, onDismissRequest: () -> Unit,
onDownloadClicked: (DownloadAction) -> Unit, onDownloadClicked: (DownloadAction) -> Unit,
includeDownloadAllOption: Boolean = true,
) { ) {
DropdownMenu( DropdownMenu(
expanded = expanded, expanded = expanded,
@ -25,7 +24,6 @@ fun DownloadDropdownMenu(
DownloadAction.NEXT_10_CHAPTERS to pluralStringResource(R.plurals.download_amount, 10, 10), DownloadAction.NEXT_10_CHAPTERS to pluralStringResource(R.plurals.download_amount, 10, 10),
DownloadAction.NEXT_25_CHAPTERS to pluralStringResource(R.plurals.download_amount, 25, 25), DownloadAction.NEXT_25_CHAPTERS to pluralStringResource(R.plurals.download_amount, 25, 25),
DownloadAction.UNREAD_CHAPTERS to stringResource(R.string.download_unread), DownloadAction.UNREAD_CHAPTERS to stringResource(R.string.download_unread),
(DownloadAction.ALL_CHAPTERS to stringResource(R.string.download_all)).takeIf { includeDownloadAllOption },
).map { (downloadAction, string) -> ).map { (downloadAction, string) ->
DropdownMenuItem( DropdownMenuItem(
text = { Text(text = string) }, text = { Text(text = string) },

View File

@ -6,7 +6,6 @@ enum class DownloadAction {
NEXT_10_CHAPTERS, NEXT_10_CHAPTERS,
NEXT_25_CHAPTERS, NEXT_25_CHAPTERS,
UNREAD_CHAPTERS, UNREAD_CHAPTERS,
ALL_CHAPTERS,
} }
enum class EditCoverAction { enum class EditCoverAction {

View File

@ -294,7 +294,6 @@ fun LibraryBottomActionMenu(
expanded = downloadExpanded, expanded = downloadExpanded,
onDismissRequest = onDismissRequest, onDismissRequest = onDismissRequest,
onDownloadClicked = onDownloadClicked, onDownloadClicked = onDownloadClicked,
includeDownloadAllOption = false,
) )
} }
} }

View File

@ -999,13 +999,6 @@ class MangaInfoScreenModel(
} }
} }
/**
* Returns the list of filtered or all chapter items if [skipFiltered] is false.
*/
private fun getChapterItems(): List<ChapterItem> {
return if (skipFiltered) filteredChapters.orEmpty().toList() else allChapters.orEmpty()
}
/** /**
* Returns the next unread chapter or null if everything is read. * Returns the next unread chapter or null if everything is read.
*/ */
@ -1015,7 +1008,8 @@ class MangaInfoScreenModel(
} }
private fun getUnreadChapters(): List<Chapter> { private fun getUnreadChapters(): List<Chapter> {
return getChapterItems() val chapterItems = if (skipFiltered) filteredChapters.orEmpty().toList() else allChapters.orEmpty()
return chapterItems
.filter { (chapter, dlStatus) -> !chapter.read && dlStatus == Download.State.NOT_DOWNLOADED } .filter { (chapter, dlStatus) -> !chapter.read && dlStatus == Download.State.NOT_DOWNLOADED }
.map { it.chapter } .map { it.chapter }
} }
@ -1093,7 +1087,6 @@ class MangaInfoScreenModel(
DownloadAction.NEXT_10_CHAPTERS -> getUnreadChaptersSorted().take(10) DownloadAction.NEXT_10_CHAPTERS -> getUnreadChaptersSorted().take(10)
DownloadAction.NEXT_25_CHAPTERS -> getUnreadChaptersSorted().take(25) DownloadAction.NEXT_25_CHAPTERS -> getUnreadChaptersSorted().take(25)
DownloadAction.UNREAD_CHAPTERS -> getUnreadChapters() DownloadAction.UNREAD_CHAPTERS -> getUnreadChapters()
DownloadAction.ALL_CHAPTERS -> getChapterItems().map { it.chapter }
} }
if (chaptersToDownload.isNotEmpty()) { if (chaptersToDownload.isNotEmpty()) {
startDownload(chaptersToDownload, false) startDownload(chaptersToDownload, false)

View File

@ -659,7 +659,6 @@
<item quantity="one">Next chapter</item> <item quantity="one">Next chapter</item>
<item quantity="other">Next %d chapters</item> <item quantity="other">Next %d chapters</item>
</plurals> </plurals>
<string name="download_all">All</string>
<string name="download_unread">Unread</string> <string name="download_unread">Unread</string>
<string name="custom_cover">Custom cover</string> <string name="custom_cover">Custom cover</string>
<string name="manga_cover">Cover</string> <string name="manga_cover">Cover</string>