Update tracking sites after finishing chapter (#2044)

* Added second updateTrackLastChapterRead() called whenever a chapter has been read in the reader

* Removed old updateTrackLastChapterRead() so that it's not called twice.
This commit is contained in:
Jannis Becker 2019-05-25 13:46:20 +02:00 committed by inorichi
parent a32572fc96
commit 15f225537e

View File

@ -147,10 +147,9 @@ class ReaderPresenter(
/** /**
* Called when the user pressed the back button and is going to leave the reader. Used to * Called when the user pressed the back button and is going to leave the reader. Used to
* update tracking services and trigger deletion of the downloaded chapters. * trigger deletion of the downloaded chapters.
*/ */
fun onBackPressed() { fun onBackPressed() {
updateTrackLastChapterRead()
deletePendingChapters() deletePendingChapters()
} }
@ -308,7 +307,7 @@ class ReaderPresenter(
/** /**
* Called every time a page changes on the reader. Used to mark the flag of chapters being * Called every time a page changes on the reader. Used to mark the flag of chapters being
* read, enqueue downloaded chapter deletion, and updating the active chapter if this * read, update tracking services, enqueue downloaded chapter deletion, and updating the active chapter if this
* [page]'s chapter is different from the currently active. * [page]'s chapter is different from the currently active.
*/ */
fun onPageSelected(page: ReaderPage) { fun onPageSelected(page: ReaderPage) {
@ -320,6 +319,7 @@ class ReaderPresenter(
selectedChapter.chapter.last_page_read = page.index selectedChapter.chapter.last_page_read = page.index
if (selectedChapter.pages?.lastIndex == page.index) { if (selectedChapter.pages?.lastIndex == page.index) {
selectedChapter.chapter.read = true selectedChapter.chapter.read = true
updateTrackLastChapterRead()
enqueueDeleteReadChapters(selectedChapter) enqueueDeleteReadChapters(selectedChapter)
} }