|
|
|
@ -2,11 +2,8 @@ package org.koitharu.kotatsu.main.domain
|
|
|
|
|
|
|
|
|
|
|
|
import androidx.collection.ArraySet
|
|
|
|
import androidx.collection.ArraySet
|
|
|
|
import coil.intercept.Interceptor
|
|
|
|
import coil.intercept.Interceptor
|
|
|
|
import coil.network.HttpException
|
|
|
|
|
|
|
|
import coil.request.ErrorResult
|
|
|
|
import coil.request.ErrorResult
|
|
|
|
import coil.request.ImageResult
|
|
|
|
import coil.request.ImageResult
|
|
|
|
import okio.FileNotFoundException
|
|
|
|
|
|
|
|
import org.jsoup.HttpStatusException
|
|
|
|
|
|
|
|
import org.koitharu.kotatsu.bookmarks.domain.Bookmark
|
|
|
|
import org.koitharu.kotatsu.bookmarks.domain.Bookmark
|
|
|
|
import org.koitharu.kotatsu.bookmarks.domain.BookmarksRepository
|
|
|
|
import org.koitharu.kotatsu.bookmarks.domain.BookmarksRepository
|
|
|
|
import org.koitharu.kotatsu.core.model.findById
|
|
|
|
import org.koitharu.kotatsu.core.model.findById
|
|
|
|
@ -15,13 +12,10 @@ import org.koitharu.kotatsu.core.parser.MangaDataRepository
|
|
|
|
import org.koitharu.kotatsu.core.parser.MangaRepository
|
|
|
|
import org.koitharu.kotatsu.core.parser.MangaRepository
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.ifNullOrEmpty
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.ifNullOrEmpty
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.printStackTraceDebug
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.printStackTraceDebug
|
|
|
|
import org.koitharu.kotatsu.parsers.exception.ParseException
|
|
|
|
|
|
|
|
import org.koitharu.kotatsu.parsers.model.Manga
|
|
|
|
import org.koitharu.kotatsu.parsers.model.Manga
|
|
|
|
import org.koitharu.kotatsu.parsers.util.runCatchingCancellable
|
|
|
|
import org.koitharu.kotatsu.parsers.util.runCatchingCancellable
|
|
|
|
import java.net.UnknownHostException
|
|
|
|
|
|
|
|
import java.util.Collections
|
|
|
|
import java.util.Collections
|
|
|
|
import javax.inject.Inject
|
|
|
|
import javax.inject.Inject
|
|
|
|
import javax.net.ssl.SSLException
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CoverRestoreInterceptor @Inject constructor(
|
|
|
|
class CoverRestoreInterceptor @Inject constructor(
|
|
|
|
private val dataRepository: MangaDataRepository,
|
|
|
|
private val dataRepository: MangaDataRepository,
|
|
|
|
@ -116,11 +110,6 @@ class CoverRestoreInterceptor @Inject constructor(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun Throwable.shouldRestore(): Boolean {
|
|
|
|
private fun Throwable.shouldRestore(): Boolean {
|
|
|
|
return this is HttpException
|
|
|
|
return this is Exception // any Exception but not Error
|
|
|
|
|| this is HttpStatusException
|
|
|
|
|
|
|
|
|| this is SSLException
|
|
|
|
|
|
|
|
|| this is ParseException
|
|
|
|
|
|
|
|
|| this is UnknownHostException
|
|
|
|
|
|
|
|
|| this is FileNotFoundException
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|