Change crash log info to just have actual WebView version
This commit is contained in:
parent
e572abb041
commit
22df12a680
@ -1,7 +1,6 @@
|
||||
package eu.kanade.presentation.more.settings.screen.debug
|
||||
|
||||
import android.os.Build
|
||||
import android.webkit.WebView
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.ReadOnlyComposable
|
||||
import androidx.compose.runtime.getValue
|
||||
@ -16,6 +15,7 @@ import eu.kanade.presentation.more.settings.screen.about.AboutScreen
|
||||
import eu.kanade.presentation.util.Screen
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
||||
import eu.kanade.tachiyomi.util.system.WebViewUtil
|
||||
import kotlinx.coroutines.guava.await
|
||||
|
||||
class DebugInfoScreen : Screen() {
|
||||
@ -68,15 +68,7 @@ class DebugInfoScreen : Screen() {
|
||||
@Composable
|
||||
@ReadOnlyComposable
|
||||
private fun getWebViewVersion(): String {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val webView = WebView.getCurrentWebViewPackage() ?: return "how did you get here?"
|
||||
val pm = LocalContext.current.packageManager
|
||||
val label = webView.applicationInfo.loadLabel(pm)
|
||||
val version = webView.versionName
|
||||
return "$label $version"
|
||||
} else {
|
||||
return "Unknown"
|
||||
}
|
||||
return WebViewUtil.getVersion(LocalContext.current)
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
@ -36,7 +36,7 @@ class CrashLogUtil(private val context: Context) {
|
||||
Device name: ${Build.DEVICE}
|
||||
Device model: ${Build.MODEL}
|
||||
Device product name: ${Build.PRODUCT}
|
||||
WebView user agent: ${WebViewUtil.getInferredUserAgent(context)}
|
||||
WebView: ${WebViewUtil.getVersion(context)}
|
||||
""".trimIndent()
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.util.system
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Build
|
||||
import android.webkit.CookieManager
|
||||
import android.webkit.WebSettings
|
||||
import android.webkit.WebView
|
||||
@ -33,6 +34,18 @@ object WebViewUtil {
|
||||
.replace("Version/.* Chrome/".toRegex(), "Chrome/")
|
||||
}
|
||||
|
||||
fun getVersion(context: Context): String {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val webView = WebView.getCurrentWebViewPackage() ?: return "how did you get here?"
|
||||
val pm = context.packageManager
|
||||
val label = webView.applicationInfo.loadLabel(pm)
|
||||
val version = webView.versionName
|
||||
"$label $version"
|
||||
} else {
|
||||
"Unknown"
|
||||
}
|
||||
}
|
||||
|
||||
fun supportsWebView(context: Context): Boolean {
|
||||
try {
|
||||
// May throw android.webkit.WebViewFactory$MissingWebViewPackageException if WebView
|
||||
|
Loading…
Reference in New Issue
Block a user