diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/coil/MangaCoverFetcher.kt b/app/src/main/java/eu/kanade/tachiyomi/data/coil/MangaCoverFetcher.kt index 33c3e55b1..21895c7d2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/coil/MangaCoverFetcher.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/coil/MangaCoverFetcher.kt @@ -14,7 +14,6 @@ import eu.kanade.domain.manga.model.MangaCover import eu.kanade.tachiyomi.data.cache.CoverCache import eu.kanade.tachiyomi.data.coil.MangaCoverFetcher.Companion.USE_CUSTOM_COVER import eu.kanade.tachiyomi.data.database.models.Manga -import eu.kanade.tachiyomi.network.CACHE_CONTROL_NO_STORE import eu.kanade.tachiyomi.network.await import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.source.online.HttpSource @@ -334,6 +333,7 @@ class MangaCoverFetcher( companion object { const val USE_CUSTOM_COVER = "use_custom_cover" + private val CACHE_CONTROL_NO_STORE = CacheControl.Builder().noStore().build() private val CACHE_CONTROL_NO_NETWORK_NO_CACHE = CacheControl.Builder().noCache().onlyIfCached().build() } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateService.kt index 7cd6abd34..b3d9bd8f2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateService.kt @@ -14,7 +14,7 @@ import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.NetworkHelper import eu.kanade.tachiyomi.network.ProgressListener import eu.kanade.tachiyomi.network.await -import eu.kanade.tachiyomi.network.newCallWithProgress +import eu.kanade.tachiyomi.network.newCachelessCallWithProgress import eu.kanade.tachiyomi.util.lang.launchIO import eu.kanade.tachiyomi.util.storage.getUriCompat import eu.kanade.tachiyomi.util.storage.saveTo @@ -119,7 +119,7 @@ class AppUpdateService : Service() { try { // Download the new update. - val call = network.client.newCallWithProgress(GET(url), progressListener) + val call = network.client.newCachelessCallWithProgress(GET(url), progressListener) runningCall = call val response = call.await() diff --git a/core/src/main/java/eu/kanade/tachiyomi/network/OkHttpExtensions.kt b/core/src/main/java/eu/kanade/tachiyomi/network/OkHttpExtensions.kt index ad4845327..fd68e81fe 100644 --- a/core/src/main/java/eu/kanade/tachiyomi/network/OkHttpExtensions.kt +++ b/core/src/main/java/eu/kanade/tachiyomi/network/OkHttpExtensions.kt @@ -101,7 +101,7 @@ fun Call.asObservableSuccess(): Observable { } } -fun OkHttpClient.newCallWithProgress(request: Request, listener: ProgressListener): Call { +fun OkHttpClient.newCachelessCallWithProgress(request: Request, listener: ProgressListener): Call { val progressClient = newBuilder() .cache(null) .addNetworkInterceptor { chain -> diff --git a/core/src/main/java/eu/kanade/tachiyomi/network/Requests.kt b/core/src/main/java/eu/kanade/tachiyomi/network/Requests.kt index 082543dc4..8fb5ec2aa 100644 --- a/core/src/main/java/eu/kanade/tachiyomi/network/Requests.kt +++ b/core/src/main/java/eu/kanade/tachiyomi/network/Requests.kt @@ -10,7 +10,6 @@ import java.util.concurrent.TimeUnit.MINUTES private val DEFAULT_CACHE_CONTROL = CacheControl.Builder().maxAge(10, MINUTES).build() private val DEFAULT_HEADERS = Headers.Builder().build() private val DEFAULT_BODY: RequestBody = FormBody.Builder().build() -val CACHE_CONTROL_NO_STORE = CacheControl.Builder().noStore().build() fun GET( url: String, diff --git a/source-api/src/main/java/eu/kanade/tachiyomi/source/online/HttpSource.kt b/source-api/src/main/java/eu/kanade/tachiyomi/source/online/HttpSource.kt index 1d83198c7..e6ae0a217 100644 --- a/source-api/src/main/java/eu/kanade/tachiyomi/source/online/HttpSource.kt +++ b/source-api/src/main/java/eu/kanade/tachiyomi/source/online/HttpSource.kt @@ -1,10 +1,9 @@ package eu.kanade.tachiyomi.source.online -import eu.kanade.tachiyomi.network.CACHE_CONTROL_NO_STORE import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.NetworkHelper import eu.kanade.tachiyomi.network.asObservableSuccess -import eu.kanade.tachiyomi.network.newCallWithProgress +import eu.kanade.tachiyomi.network.newCachelessCallWithProgress import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage @@ -301,11 +300,8 @@ abstract class HttpSource : CatalogueSource { * @param page the page whose source image has to be downloaded. */ fun fetchImage(page: Page): Observable { - val request = imageRequest(page).newBuilder() - // images will be cached or saved manually, so don't take up network cache - .cacheControl(CACHE_CONTROL_NO_STORE) - .build() - return client.newCallWithProgress(request, page) + // images will be cached or saved manually, so don't take up network cache + return client.newCachelessCallWithProgress(imageRequest(page), page) .asObservableSuccess() }