|
@@ -85,7 +85,7 @@ class ReaderPresenter : BasePresenter<ReaderActivity>() {
|
|
{ view, pair -> view.onAdjacentChapters(pair.first, pair.second) })
|
|
{ view, pair -> view.onAdjacentChapters(pair.first, pair.second) })
|
|
|
|
|
|
startable(PRELOAD_NEXT_CHAPTER, { getPreloadNextChapterObservable() },
|
|
startable(PRELOAD_NEXT_CHAPTER, { getPreloadNextChapterObservable() },
|
|
- { },
|
|
|
|
|
|
+ { },
|
|
{ error -> Timber.e("Error preloading chapter") })
|
|
{ error -> Timber.e("Error preloading chapter") })
|
|
|
|
|
|
|
|
|
|
@@ -335,10 +335,32 @@ class ReaderPresenter : BasePresenter<ReaderActivity>() {
|
|
// Save current progress of the chapter. Mark as read if the chapter is finished
|
|
// Save current progress of the chapter. Mark as read if the chapter is finished
|
|
if (activePage.isLastPage) {
|
|
if (activePage.isLastPage) {
|
|
chapter.read = true
|
|
chapter.read = true
|
|
|
|
+
|
|
|
|
+ // Check if remove after read is selected by user
|
|
|
|
+ if (prefs.removeAfterRead()) {
|
|
|
|
+ if (prefs.removeAfterReadPrevious() ) {
|
|
|
|
+ if (previousChapter != null) {
|
|
|
|
+ deleteChapter(previousChapter!!, manga)
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ deleteChapter(chapter, manga)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
db.insertChapter(chapter).asRxObservable().subscribe()
|
|
db.insertChapter(chapter).asRxObservable().subscribe()
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Delete selected chapter
|
|
|
|
+ * @param chapter chapter that is selected
|
|
|
|
+ * *
|
|
|
|
+ * @param manga manga that belongs to chapter
|
|
|
|
+ */
|
|
|
|
+ fun deleteChapter(chapter: Chapter, manga: Manga) {
|
|
|
|
+ val source = sourceManager.get(manga.source)!!
|
|
|
|
+ downloadManager.deleteChapter(source, manga, chapter)
|
|
|
|
+ }
|
|
|
|
+
|
|
// If the current chapter has been read, we check with this one
|
|
// If the current chapter has been read, we check with this one
|
|
// If not, we check if the previous chapter has been read
|
|
// If not, we check if the previous chapter has been read
|
|
// We know the chapter we have to check, but we don't know yet if an update is required.
|
|
// We know the chapter we have to check, but we don't know yet if an update is required.
|
|
@@ -417,5 +439,4 @@ class ReaderPresenter : BasePresenter<ReaderActivity>() {
|
|
manga.viewer = viewer
|
|
manga.viewer = viewer
|
|
db.insertManga(manga).executeAsBlocking()
|
|
db.insertManga(manga).executeAsBlocking()
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|