master
Koitharu 1 year ago
parent f11a9d8235
commit e65a3b43f6
Signed by: Koitharu
GPG Key ID: 676DEE768C17A9D7

@ -78,6 +78,9 @@ open class BaseApp : Application(), Configuration.Provider {
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
if (ACRA.isACRASenderServiceProcess()) {
return
}
AppCompatDelegate.setDefaultNightMode(settings.theme) AppCompatDelegate.setDefaultNightMode(settings.theme)
AppCompatDelegate.setApplicationLocales(settings.appLocales) AppCompatDelegate.setApplicationLocales(settings.appLocales)
// TLS 1.3 support for Android < 10 // TLS 1.3 support for Android < 10

@ -1,3 +1,3 @@
package org.koitharu.kotatsu.core.exceptions package org.koitharu.kotatsu.core.exceptions
class CaughtException(cause: Throwable, override val message: String?) : RuntimeException(cause) class CaughtException(cause: Throwable) : RuntimeException("${cause.javaClass.simpleName}(${cause.message})", cause)

@ -79,7 +79,9 @@ class ParserMangaRepository(
} }
override suspend fun getPageUrl(page: MangaPage): String = mirrorSwitchInterceptor.withMirrorSwitching { override suspend fun getPageUrl(page: MangaPage): String = mirrorSwitchInterceptor.withMirrorSwitching {
parser.getPageUrl(page) parser.getPageUrl(page).also { result ->
check(result.isNotEmpty()) { "Page url is empty" }
}
} }
override suspend fun getFilterOptions(): MangaListFilterOptions = filterOptionsLazy.get() override suspend fun getFilterOptions(): MangaListFilterOptions = filterOptionsLazy.get()

@ -58,7 +58,7 @@ class ErrorDetailsDialog : AlertDialogFragment<DialogErrorDetailsBinding>() {
if (exception.isReportable()) { if (exception.isReportable()) {
builder.setPositiveButton(R.string.report) { _, _ -> builder.setPositiveButton(R.string.report) { _, _ ->
dismiss() dismiss()
exception.report() exception.report(silent = true)
} }
} }
return builder return builder

@ -9,6 +9,7 @@ import okhttp3.Response
import okio.FileNotFoundException import okio.FileNotFoundException
import okio.IOException import okio.IOException
import okio.ProtocolException import okio.ProtocolException
import org.acra.ktx.sendSilentlyWithAcra
import org.acra.ktx.sendWithAcra import org.acra.ktx.sendWithAcra
import org.jsoup.HttpStatusException import org.jsoup.HttpStatusException
import org.koitharu.kotatsu.R import org.koitharu.kotatsu.R
@ -37,9 +38,9 @@ import org.koitharu.kotatsu.parsers.exception.NotFoundException
import org.koitharu.kotatsu.parsers.exception.ParseException import org.koitharu.kotatsu.parsers.exception.ParseException
import org.koitharu.kotatsu.parsers.exception.TooManyRequestExceptions import org.koitharu.kotatsu.parsers.exception.TooManyRequestExceptions
import org.koitharu.kotatsu.scrobbling.common.domain.ScrobblerAuthRequiredException import org.koitharu.kotatsu.scrobbling.common.domain.ScrobblerAuthRequiredException
import java.io.ObjectOutputStream
import java.net.ConnectException import java.net.ConnectException
import java.net.NoRouteToHostException import java.net.NoRouteToHostException
import java.io.ObjectOutputStream
import java.net.SocketTimeoutException import java.net.SocketTimeoutException
import java.net.UnknownHostException import java.net.UnknownHostException
import java.util.Locale import java.util.Locale
@ -193,10 +194,14 @@ fun Throwable.isNetworkError(): Boolean {
return this is UnknownHostException || this is SocketTimeoutException return this is UnknownHostException || this is SocketTimeoutException
} }
fun Throwable.report() { fun Throwable.report(silent: Boolean = false) {
val exception = CaughtException(this, "${javaClass.simpleName}($message)") val exception = CaughtException(this)
if (silent) {
exception.sendSilentlyWithAcra()
} else {
exception.sendWithAcra() exception.sendWithAcra()
} }
}
fun Throwable.isWebViewUnavailable(): Boolean { fun Throwable.isWebViewUnavailable(): Boolean {
val trace = stackTraceToString() val trace = stackTraceToString()

Loading…
Cancel
Save