From 0014e8ef06367e357991df20ac8e098f1d8875b4 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 25 Nov 2019 17:32:27 +0100 Subject: [PATCH] Login screens: rename variables --- .../riotx/features/login/LoginCaptchaFragment.kt | 8 ++++---- .../vector/riotx/features/login/LoginWebFragment.kt | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) 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)) }