mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 03:07:25 +01:00
UpdatesScreen: Fix selection state after deleting download (#8100)
This commit is contained in:
parent
f19c288bec
commit
633bd6eb46
@ -196,8 +196,8 @@ private fun UpdateScreenContent(
|
|||||||
UpdatesDeleteConfirmationDialog(
|
UpdatesDeleteConfirmationDialog(
|
||||||
onDismissRequest = onDismissDialog,
|
onDismissRequest = onDismissDialog,
|
||||||
onConfirm = {
|
onConfirm = {
|
||||||
presenter.deleteChapters(dialog.toDelete)
|
|
||||||
presenter.toggleAllSelection(false)
|
presenter.toggleAllSelection(false)
|
||||||
|
presenter.deleteChapters(dialog.toDelete)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -161,6 +161,7 @@ class MangaController : FullComposeController<MangaPresenter> {
|
|||||||
DeleteChaptersDialog(
|
DeleteChaptersDialog(
|
||||||
onDismissRequest = onDismissRequest,
|
onDismissRequest = onDismissRequest,
|
||||||
onConfirm = {
|
onConfirm = {
|
||||||
|
presenter.toggleAllSelection(false)
|
||||||
deleteChapters(dialog.chapters)
|
deleteChapters(dialog.chapters)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -646,6 +646,7 @@ class MangaPresenter(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the given list of chapter.
|
* Deletes the given list of chapter.
|
||||||
|
*
|
||||||
* @param chapters the list of chapters to delete.
|
* @param chapters the list of chapters to delete.
|
||||||
*/
|
*/
|
||||||
fun deleteChapters(chapters: List<DomainChapter>) {
|
fun deleteChapters(chapters: List<DomainChapter>) {
|
||||||
@ -673,7 +674,6 @@ class MangaPresenter(
|
|||||||
}
|
}
|
||||||
successState.copy(chapters = newChapters)
|
successState.copy(chapters = newChapters)
|
||||||
}
|
}
|
||||||
toggleAllSelection(false)
|
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
logcat(LogPriority.ERROR, e)
|
logcat(LogPriority.ERROR, e)
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ class UpdatesPresenter(
|
|||||||
if (deletedUpdates.isEmpty()) return@launchNonCancellable
|
if (deletedUpdates.isEmpty()) return@launchNonCancellable
|
||||||
|
|
||||||
// TODO: Don't do this fake status update
|
// TODO: Don't do this fake status update
|
||||||
state.items = items.toMutableList().apply {
|
state.items = state.items.toMutableList().apply {
|
||||||
deletedUpdates.forEach { deletedUpdate ->
|
deletedUpdates.forEach { deletedUpdate ->
|
||||||
val modifiedIndex = indexOf(deletedUpdate)
|
val modifiedIndex = indexOf(deletedUpdate)
|
||||||
val item = removeAt(modifiedIndex).copy(
|
val item = removeAt(modifiedIndex).copy(
|
||||||
|
Loading…
Reference in New Issue
Block a user