mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-01 20:35:18 -05:00
Fix deleting history not refreshing the view (#3882)
Fix deleting history not refreshing the view
This commit is contained in:
parent
25d1c40cda
commit
e88cbc2769
2 changed files with 8 additions and 4 deletions
|
@ -171,10 +171,10 @@ class HistoryController :
|
||||||
override fun removeHistory(manga: Manga, history: History, all: Boolean) {
|
override fun removeHistory(manga: Manga, history: History, all: Boolean) {
|
||||||
if (all) {
|
if (all) {
|
||||||
// Reset last read of chapter to 0L
|
// Reset last read of chapter to 0L
|
||||||
presenter.removeAllFromHistory(manga.id!!)
|
presenter.removeAllFromHistory(manga.id!!, query)
|
||||||
} else {
|
} else {
|
||||||
// Remove all chapters belonging to manga from library
|
// Remove all chapters belonging to manga from library
|
||||||
presenter.removeFromHistory(history)
|
presenter.removeFromHistory(history, query)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,9 +73,12 @@ class HistoryPresenter : BasePresenter<HistoryController>() {
|
||||||
* Reset last read of chapter to 0L
|
* Reset last read of chapter to 0L
|
||||||
* @param history history belonging to chapter
|
* @param history history belonging to chapter
|
||||||
*/
|
*/
|
||||||
fun removeFromHistory(history: History) {
|
fun removeFromHistory(history: History, currentSearch: String = "") {
|
||||||
history.last_read = 0L
|
history.last_read = 0L
|
||||||
db.updateHistoryLastRead(history).asRxObservable()
|
db.updateHistoryLastRead(history).asRxObservable()
|
||||||
|
.doOnNext {
|
||||||
|
updateList(currentSearch)
|
||||||
|
}
|
||||||
.subscribe()
|
.subscribe()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,11 +100,12 @@ class HistoryPresenter : BasePresenter<HistoryController>() {
|
||||||
* Removes all chapters belonging to manga from history.
|
* Removes all chapters belonging to manga from history.
|
||||||
* @param mangaId id of manga
|
* @param mangaId id of manga
|
||||||
*/
|
*/
|
||||||
fun removeAllFromHistory(mangaId: Long) {
|
fun removeAllFromHistory(mangaId: Long, currentSearch: String = "") {
|
||||||
db.getHistoryByMangaId(mangaId).asRxSingle()
|
db.getHistoryByMangaId(mangaId).asRxSingle()
|
||||||
.map { list ->
|
.map { list ->
|
||||||
list.forEach { it.last_read = 0L }
|
list.forEach { it.last_read = 0L }
|
||||||
db.updateHistoryLastRead(list).executeAsBlocking()
|
db.updateHistoryLastRead(list).executeAsBlocking()
|
||||||
|
updateList(currentSearch)
|
||||||
}
|
}
|
||||||
.subscribe()
|
.subscribe()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue