Skip to content

Commit

Permalink
change delete cover from cache order
Browse files Browse the repository at this point in the history
  • Loading branch information
nonproto committed Mar 4, 2020
1 parent 0f1f262 commit 22040a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.data.notification.NotificationReceiver
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.HttpSource
import eu.kanade.tachiyomi.ui.base.controller.DialogController
Expand All @@ -64,17 +63,17 @@ import eu.kanade.tachiyomi.util.getUriCompat
import eu.kanade.tachiyomi.util.snack
import eu.kanade.tachiyomi.util.toast
import eu.kanade.tachiyomi.util.truncateCenter
import java.io.File
import java.text.DecimalFormat
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale
import jp.wasabeef.glide.transformations.CropSquareTransformation
import jp.wasabeef.glide.transformations.MaskTransformation
import kotlinx.android.synthetic.main.main_activity.*
import kotlinx.android.synthetic.main.manga_info_controller.*
import timber.log.Timber
import uy.kohesive.injekt.injectLazy
import java.io.File
import java.text.DecimalFormat
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale

/**
* Fragment that shows manga information.
Expand Down Expand Up @@ -207,7 +206,7 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
* @param manga manga object containing information about manga.
* @param source the source of the manga.
*/
fun onNextManga(manga: Manga, source: Source) {
fun onNextManga(manga: Manga) {
if (manga.initialized) {
// Update view.
setMangaInfo(manga)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ import eu.kanade.tachiyomi.data.download.DownloadManager
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
import eu.kanade.tachiyomi.util.DiskUtil
import java.io.File
import java.io.FileOutputStream
import java.io.OutputStream
import java.util.Date
import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
Expand All @@ -29,6 +25,10 @@ import rx.android.schedulers.AndroidSchedulers
import rx.schedulers.Schedulers
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.io.File
import java.io.FileOutputStream
import java.io.OutputStream
import java.util.Date

/**
* Presenter of MangaInfoFragment.
Expand Down Expand Up @@ -74,7 +74,7 @@ class MangaInfoPresenter(
* Sends the active manga to the view.
*/
fun sendMangaToView() {
view?.onNextManga(manga, source)
view?.onNextManga(manga)
}

/**
Expand All @@ -89,10 +89,10 @@ class MangaInfoPresenter(
job = launch(CoroutineExceptionHandler { _, _ ->
GlobalScope.launch(Dispatchers.Main) { MangaInfoController::onFetchMangaError }
}) {
coverCache.deleteFromCache(manga.thumbnail_url)
val networkManga = source.fetchMangaDetails(manga)
manga.copyFrom(networkManga)
manga.initialized = true
coverCache.deleteFromCache(manga.thumbnail_url)
db.insertManga(manga).executeAsBlocking()

withContext(Dispatchers.Main) {
Expand Down

0 comments on commit 22040a2

Please sign in to comment.