1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-10 13:02:35 +01:00

Fix login webview

This commit is contained in:
Allan Wang 2018-01-10 22:15:17 -05:00
parent fd5f2a82eb
commit 6e648bfc6b

View File

@ -31,12 +31,8 @@ class LoginWebView @JvmOverloads constructor(
private lateinit var loginCallback: (CookieModel) -> Unit
private lateinit var progressCallback: (Int) -> Unit
init {
FbCookie.reset(this::setupWebview)
}
@SuppressLint("SetJavaScriptEnabled")
fun setupWebview() {
private fun setupWebview() {
settings.javaScriptEnabled = true
setLayerType(View.LAYER_TYPE_HARDWARE, null)
webViewClient = LoginClient()
@ -47,7 +43,10 @@ class LoginWebView @JvmOverloads constructor(
this.progressCallback = progressCallback
this.loginCallback = loginCallback
L.d { "Begin loading login" }
loadUrl(FB_LOGIN_URL)
FbCookie.reset {
setupWebview()
loadUrl(FB_LOGIN_URL)
}
}
private inner class LoginClient : BaseWebViewClient() {
@ -86,7 +85,7 @@ class LoginWebView @JvmOverloads constructor(
}
}
inner class LoginChromeClient : WebChromeClient() {
private inner class LoginChromeClient : WebChromeClient() {
override fun onConsoleMessage(consoleMessage: ConsoleMessage): Boolean {
L.v { "Login Console ${consoleMessage.lineNumber()}: ${consoleMessage.message()}" }
return true