mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-07 15:41:38 +01:00
Login screens: rename variables
This commit is contained in:
parent
311d8ddf7b
commit
0014e8ef06
@ -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))
|
||||
}
|
||||
}
|
||||
|
@ -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))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user