Skip to content

Commit

Permalink
fix: #295 google login issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
plateaukao committed Oct 20, 2023
1 parent 5ef9b83 commit d25c110
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ import android.net.Uri
import android.os.Message
import android.view.View
import android.view.ViewGroup
import android.webkit.*
import android.webkit.WebView.*
import android.webkit.CookieManager
import android.webkit.GeolocationPermissions
import android.webkit.PermissionRequest
import android.webkit.ValueCallback
import android.webkit.WebChromeClient
import android.webkit.WebResourceRequest
import android.webkit.WebSettings
import android.webkit.WebView
import android.webkit.WebView.WebViewTransport
import android.webkit.WebViewClient
import info.plateaukao.einkbro.unit.HelperUnit
import info.plateaukao.einkbro.view.NinjaWebView

Expand Down Expand Up @@ -65,7 +73,9 @@ class NinjaWebChromeClient(
val webSettings = webView.settings
val defaultUserAgent = webSettings.userAgentString

webSettings.userAgentString = defaultUserAgent.replace("wv", "")
webSettings.userAgentString = defaultUserAgent
.replace("wv", "")
.replace(Regex("Version/\\d+\\.\\d+\\s"), "")
webSettings.cacheMode = WebSettings.LOAD_DEFAULT
webSettings.allowFileAccessFromFileURLs = true
webSettings.allowUniversalAccessFromFileURLs = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,9 @@ open class NinjaWebView(
}

fun updateUserAgentString() {
val defaultUserAgentString = WebSettings.getDefaultUserAgent(context).replace("wv", "")
val defaultUserAgentString = WebSettings.getDefaultUserAgent(context)
.replace("wv", "")
.replace(Regex("Version/\\d+\\.\\d+\\s"), "")
val prefix: String =
defaultUserAgentString.substring(0, defaultUserAgentString.indexOf(")") + 1)

Expand Down

0 comments on commit d25c110

Please sign in to comment.