5.2.4 Added logging to fix app crashing
This commit is contained in:
@@ -198,7 +198,7 @@ class Pupil : Application() {
|
||||
webChromeClient = object: WebChromeClient() {
|
||||
override fun onConsoleMessage(consoleMessage: ConsoleMessage?): Boolean {
|
||||
FirebaseCrashlytics.getInstance().log(
|
||||
"onConsoleMessage: $consoleMessage"
|
||||
"onConsoleMessage: ${consoleMessage?.message()}"
|
||||
)
|
||||
|
||||
return super.onConsoleMessage(consoleMessage)
|
||||
|
||||
@@ -43,10 +43,6 @@ const val protocol = "https:"
|
||||
val evaluations = Collections.newSetFromMap<String>(ConcurrentHashMap())
|
||||
|
||||
suspend fun WebView.evaluate(script: String): String = withContext(Dispatchers.Main) {
|
||||
if (webViewFailed) {
|
||||
Toast.makeText(Pupil.instance, "Failed to load scripts. Please restart the app.", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
|
||||
while (webViewFailed || !webViewReady) yield()
|
||||
|
||||
val uid = UUID.randomUUID().toString()
|
||||
@@ -65,10 +61,6 @@ suspend fun WebView.evaluate(script: String): String = withContext(Dispatchers.M
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
suspend fun WebView.evaluatePromise(script: String, then: String = ".then(result => Callback.onResult(%uid, JSON.stringify(result))).catch(err => Callback.onError(%uid, JSON.stringify(error)))"): String? = withContext(Dispatchers.Main) {
|
||||
if (webViewFailed) {
|
||||
Toast.makeText(Pupil.instance, "Failed to load the scripts. Please restart the app.", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
|
||||
while (webViewFailed || !webViewReady) yield()
|
||||
|
||||
val uid = UUID.randomUUID().toString()
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package xyz.quaver.pupil.util
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
||||
import kotlinx.serialization.json.*
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
@@ -103,7 +104,15 @@ suspend fun GalleryInfo.getRequestBuilders(): List<Request.Builder> {
|
||||
|
||||
return this.files.map {
|
||||
Request.Builder()
|
||||
.url(imageUrlFromImage(galleryID, it, !lowQuality))
|
||||
.url(
|
||||
runCatching {
|
||||
imageUrlFromImage(galleryID, it, !lowQuality)
|
||||
}
|
||||
.onFailure {
|
||||
FirebaseCrashlytics.getInstance().recordException(it)
|
||||
}
|
||||
.getOrDefault("https://a/")
|
||||
)
|
||||
.header("Referer", "https://hitomi.la/")
|
||||
.header("User-Agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user