mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 10:45:57 +00:00
feat: log webkit version
This commit is contained in:
parent
427c1d634b
commit
30bcaf00a0
3 changed files with 24 additions and 1 deletions
|
|
@ -15,6 +15,7 @@ import androidx.activity.addCallback
|
|||
import com.anggrayudi.storage.SimpleStorageHelper
|
||||
import com.getcapacitor.BridgeActivity
|
||||
import com.getcapacitor.BridgeWebViewClient
|
||||
import com.superproductivity.superproductivity.util.printWebViewVersion
|
||||
import com.superproductivity.superproductivity.webview.JavaScriptInterface
|
||||
import com.superproductivity.superproductivity.webview.WebHelper
|
||||
import com.superproductivity.superproductivity.webview.WebViewRequestHandler
|
||||
|
|
@ -31,11 +32,11 @@ class CapacitorMainActivity : BridgeActivity() {
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
printWebViewVersion(bridge.webView)
|
||||
|
||||
// Register Plugin
|
||||
// TODO: The changes to the compatible logic are too complex, so they will not be added for now
|
||||
// (separate branch, there will be opportunities to add it later)
|
||||
|
||||
// DEBUG ONLY
|
||||
if (BuildConfig.DEBUG) {
|
||||
Toast.makeText(this, "DEBUG: Offline Mode", Toast.LENGTH_SHORT).show()
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import androidx.annotation.RequiresApi
|
|||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.anggrayudi.storage.SimpleStorageHelper
|
||||
import com.superproductivity.superproductivity.app.LaunchDecider
|
||||
import com.superproductivity.superproductivity.util.printWebViewVersion
|
||||
import com.superproductivity.superproductivity.webview.JavaScriptInterface
|
||||
import com.superproductivity.superproductivity.webview.WebHelper
|
||||
import com.superproductivity.superproductivity.webview.WebViewRequestHandler
|
||||
|
|
@ -144,6 +145,7 @@ class FullscreenActivity : AppCompatActivity() {
|
|||
// webView.clearHistory()
|
||||
WebView.setWebContentsDebuggingEnabled(true); // necessary to enable chrome://inspect of webviews on physical remote Android devices, but not for AVD emulator, as the latter automatically enables debug build features
|
||||
}
|
||||
printWebViewVersion(webView)
|
||||
|
||||
webView.loadUrl(appUrl)
|
||||
supportActionBar?.hide()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package com.superproductivity.superproductivity.util
|
||||
|
||||
import android.os.Build
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebView.getCurrentWebViewPackage
|
||||
|
||||
fun printWebViewVersion(webView: WebView) {
|
||||
val userAgent = webView.settings.userAgentString
|
||||
var webViewVersion: String? = null
|
||||
userAgent?.let {
|
||||
val startIndex = it.indexOf("AppleWebKit/") + "AppleWebKit/".length
|
||||
if (startIndex > 0) {
|
||||
webViewVersion = it.substring(startIndex)
|
||||
}
|
||||
}
|
||||
println("WEBVIEW WkWebView version: ${webViewVersion ?: "unknown"}")
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
println("WEBVIEW versionName ${getCurrentWebViewPackage()?.versionName ?: "unknown"} ")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue