webview cleanup
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
package net.helcel.cowspent.android.account
|
package net.helcel.cowspent.android.account
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
@@ -149,7 +148,7 @@ class AccountActivity : AppCompatActivity() {
|
|||||||
allowFileAccess = false
|
allowFileAccess = false
|
||||||
javaScriptEnabled = true
|
javaScriptEnabled = true
|
||||||
domStorageEnabled = true
|
domStorageEnabled = true
|
||||||
userAgentString = getWebLoginUserAgent(context)
|
userAgentString = getWebLoginUserAgent()
|
||||||
}
|
}
|
||||||
webViewClient = object : WebViewClient() {
|
webViewClient = object : WebViewClient() {
|
||||||
@Deprecated("Deprecated in Java")
|
@Deprecated("Deprecated in Java")
|
||||||
@@ -244,13 +243,9 @@ class AccountActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getWebLoginUserAgent(context: Context): String {
|
private fun getWebLoginUserAgent(): String {
|
||||||
val defaultUA = try {
|
val manufacturer = Build.MANUFACTURER.replaceFirstChar { it.titlecase(Locale.ROOT) }
|
||||||
android.webkit.WebSettings.getDefaultUserAgent(context)
|
return "$manufacturer ${Build.MODEL} (Cowspent/Android)"
|
||||||
} catch (_: Exception) {
|
|
||||||
Build.MANUFACTURER + " " + Build.MODEL
|
|
||||||
}
|
|
||||||
return "$defaultUA Cowspent/Android"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun parseAndLoginFromWebView(dataString: String) {
|
private fun parseAndLoginFromWebView(dataString: String) {
|
||||||
|
|||||||
Reference in New Issue
Block a user