From e88cbc27699cad12c8b883f68ae40edc7aba6408 Mon Sep 17 00:00:00 2001 From: jobobby04 Date: Fri, 2 Oct 2020 13:19:16 -0400 Subject: [PATCH] Fix deleting history not refreshing the view (#3882) Fix deleting history not refreshing the view --- .../tachiyomi/ui/recent/history/HistoryController.kt | 4 ++-- .../tachiyomi/ui/recent/history/HistoryPresenter.kt | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryController.kt index e6378176d5..c3a546e229 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryController.kt @@ -171,10 +171,10 @@ class HistoryController : override fun removeHistory(manga: Manga, history: History, all: Boolean) { if (all) { // Reset last read of chapter to 0L - presenter.removeAllFromHistory(manga.id!!) + presenter.removeAllFromHistory(manga.id!!, query) } else { // Remove all chapters belonging to manga from library - presenter.removeFromHistory(history) + presenter.removeFromHistory(history, query) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryPresenter.kt index 7970039958..4de981a2fd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryPresenter.kt @@ -73,9 +73,12 @@ class HistoryPresenter : BasePresenter() { * Reset last read of chapter to 0L * @param history history belonging to chapter */ - fun removeFromHistory(history: History) { + fun removeFromHistory(history: History, currentSearch: String = "") { history.last_read = 0L db.updateHistoryLastRead(history).asRxObservable() + .doOnNext { + updateList(currentSearch) + } .subscribe() } @@ -97,11 +100,12 @@ class HistoryPresenter : BasePresenter() { * Removes all chapters belonging to manga from history. * @param mangaId id of manga */ - fun removeAllFromHistory(mangaId: Long) { + fun removeAllFromHistory(mangaId: Long, currentSearch: String = "") { db.getHistoryByMangaId(mangaId).asRxSingle() .map { list -> list.forEach { it.last_read = 0L } db.updateHistoryLastRead(list).executeAsBlocking() + updateList(currentSearch) } .subscribe() }