UpdatesScreen: Fix selection state after deleting download (#8100)

(cherry picked from commit 633bd6eb46)
This commit is contained in:
Ivan Iskandar
2022-09-28 04:44:41 +07:00
committed by Jobobby04
parent b1b05fa313
commit 1f444185da
4 changed files with 4 additions and 3 deletions
@@ -196,8 +196,8 @@ private fun UpdateScreenContent(
UpdatesDeleteConfirmationDialog(
onDismissRequest = onDismissDialog,
onConfirm = {
presenter.deleteChapters(dialog.toDelete)
presenter.toggleAllSelection(false)
presenter.deleteChapters(dialog.toDelete)
},
)
}
@@ -219,6 +219,7 @@ class MangaController : FullComposeController<MangaPresenter> {
DeleteChaptersDialog(
onDismissRequest = onDismissRequest,
onConfirm = {
presenter.toggleAllSelection(false)
deleteChapters(dialog.chapters)
},
)
@@ -1136,6 +1136,7 @@ class MangaPresenter(
/**
* Deletes the given list of chapter.
*
* @param chapters the list of chapters to delete.
*/
fun deleteChapters(chapters: List<DomainChapter>) {
@@ -1163,7 +1164,6 @@ class MangaPresenter(
}
successState.copy(chapters = newChapters)
}
toggleAllSelection(false)
} catch (e: Throwable) {
logcat(LogPriority.ERROR, e)
}
@@ -276,7 +276,7 @@ class UpdatesPresenter(
if (deletedUpdates.isEmpty()) return@launchNonCancellable
// TODO: Don't do this fake status update
state.items = items.toMutableList().apply {
state.items = state.items.toMutableList().apply {
deletedUpdates.forEach { deletedUpdate ->
val modifiedIndex = indexOf(deletedUpdate)
val item = removeAt(modifiedIndex).copy(