diff --git a/vector/src/main/java/im/vector/riotx/features/login/LoginCaptchaFragment.kt b/vector/src/main/java/im/vector/riotx/features/login/LoginCaptchaFragment.kt index e50a764fdb..d21ffa2b7f 100644 --- a/vector/src/main/java/im/vector/riotx/features/login/LoginCaptchaFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/login/LoginCaptchaFragment.kt @@ -158,18 +158,18 @@ class LoginCaptchaFragment @Inject constructor( override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean { if (url?.startsWith("js:") == true) { var json = url.substring(3) - var parameters: JavascriptResponse? = null + var javascriptResponse: JavascriptResponse? = null try { // URL decode json = URLDecoder.decode(json, "UTF-8") - parameters = MoshiProvider.providesMoshi().adapter(JavascriptResponse::class.java).fromJson(json) + javascriptResponse = MoshiProvider.providesMoshi().adapter(JavascriptResponse::class.java).fromJson(json) } catch (e: Exception) { Timber.e(e, "## shouldOverrideUrlLoading(): failed") } - val response = parameters?.response - if (parameters?.action == "verifyCallback" && response != null) { + val response = javascriptResponse?.response + if (javascriptResponse?.action == "verifyCallback" && response != null) { loginViewModel.handle(LoginAction.CaptchaDone(response)) } } diff --git a/vector/src/main/java/im/vector/riotx/features/login/LoginWebFragment.kt b/vector/src/main/java/im/vector/riotx/features/login/LoginWebFragment.kt index 01b5aae513..ede3f6a20f 100644 --- a/vector/src/main/java/im/vector/riotx/features/login/LoginWebFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/login/LoginWebFragment.kt @@ -196,25 +196,25 @@ class LoginWebFragment @Inject constructor( override fun shouldOverrideUrlLoading(view: WebView, url: String?): Boolean { if (null != url && url.startsWith("js:")) { var json = url.substring(3) - var parameters: JavascriptResponse? = null + var javascriptResponse: JavascriptResponse? = null try { // URL decode json = URLDecoder.decode(json, "UTF-8") val adapter = MoshiProvider.providesMoshi().adapter(JavascriptResponse::class.java) - parameters = adapter.fromJson(json) + javascriptResponse = adapter.fromJson(json) } catch (e: Exception) { Timber.e(e, "## shouldOverrideUrlLoading() : fromJson failed") } // succeeds to parse parameters - if (parameters != null) { - val action = parameters.action + if (javascriptResponse != null) { + val action = javascriptResponse.action if (signMode == SignMode.SignIn) { try { if (action == "onLogin") { - val credentials = parameters.credentials + val credentials = javascriptResponse.credentials if (credentials != null) { loginViewModel.handle(LoginAction.WebLoginSuccess(credentials)) } @@ -226,7 +226,7 @@ class LoginWebFragment @Inject constructor( // MODE_REGISTER // check the required parameters if (action == "onRegistered") { - val credentials = parameters.credentials + val credentials = javascriptResponse.credentials if (credentials != null) { loginViewModel.handle(LoginAction.WebLoginSuccess(credentials)) }