Replace custom download amount with next 25

Simplifies things and maybe discourages whacky downloading behavior?
Users can still range select in the chapters list to download custom amounts.
This commit is contained in:
arkon
2023-02-12 15:25:09 -05:00
parent 5ce64ac7ff
commit f6e6a7ddf1
8 changed files with 29 additions and 202 deletions
@@ -456,18 +456,8 @@ class LibraryScreenModel(
DownloadAction.NEXT_1_CHAPTER -> downloadUnreadChapters(mangas, 1)
DownloadAction.NEXT_5_CHAPTERS -> downloadUnreadChapters(mangas, 5)
DownloadAction.NEXT_10_CHAPTERS -> downloadUnreadChapters(mangas, 10)
DownloadAction.NEXT_25_CHAPTERS -> downloadUnreadChapters(mangas, 25)
DownloadAction.UNREAD_CHAPTERS -> downloadUnreadChapters(mangas, null)
DownloadAction.CUSTOM -> {
mutableState.update { state ->
state.copy(
dialog = Dialog.DownloadCustomAmount(
mangas,
selection.maxOf { it.unreadCount }.toInt(),
),
)
}
return
}
else -> {}
}
clearSelection()
@@ -479,7 +469,7 @@ class LibraryScreenModel(
* @param mangas the list of manga.
* @param amount the amount to queue or null to queue all
*/
fun downloadUnreadChapters(mangas: List<Manga>, amount: Int?) {
private fun downloadUnreadChapters(mangas: List<Manga>, amount: Int?) {
coroutineScope.launchNonCancellable {
mangas.forEach { manga ->
val chapters = getNextChapters.await(manga.id)
@@ -701,7 +691,6 @@ class LibraryScreenModel(
sealed class Dialog {
data class ChangeCategory(val manga: List<Manga>, val initialSelection: List<CheckboxState<Category>>) : Dialog()
data class DeleteManga(val manga: List<Manga>) : Dialog()
data class DownloadCustomAmount(val manga: List<Manga>, val max: Int) : Dialog()
}
@Immutable
@@ -38,7 +38,6 @@ import eu.kanade.presentation.components.LoadingScreen
import eu.kanade.presentation.components.Scaffold
import eu.kanade.presentation.library.components.LibraryContent
import eu.kanade.presentation.library.components.LibraryToolbar
import eu.kanade.presentation.manga.components.DownloadCustomAmountDialog
import eu.kanade.presentation.util.Tab
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
@@ -226,16 +225,6 @@ object LibraryTab : Tab {
},
)
}
is LibraryScreenModel.Dialog.DownloadCustomAmount -> {
DownloadCustomAmountDialog(
maxAmount = dialog.max,
onDismissRequest = onDismissRequest,
onConfirm = { amount ->
screenModel.downloadUnreadChapters(dialog.manga, amount)
screenModel.clearSelection()
},
)
}
null -> {}
}