Review: Added optional to stage and renamed to "InteractiveAuthenticationFlow"

This commit is contained in:
Benoit Marty 2019-06-14 16:06:07 +02:00
parent d353e9314b
commit 8f6f72ca48
4 changed files with 14 additions and 10 deletions

View File

@ -20,14 +20,14 @@ import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass import com.squareup.moshi.JsonClass


/** /**
* A Login flow. * An interactive authentication flow.
*/ */
@JsonClass(generateAdapter = true) @JsonClass(generateAdapter = true)
internal data class LoginFlow( internal data class InteractiveAuthenticationFlow(


@Json(name = "type") @Json(name = "type")
val type: String? = null, val type: String? = null,


@Json(name = "stages") @Json(name = "stages")
val stages: List<String> val stages: List<String>? = null
) )

View File

@ -16,7 +16,11 @@


package im.vector.matrix.android.internal.auth.data package im.vector.matrix.android.internal.auth.data


import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass import com.squareup.moshi.JsonClass


@JsonClass(generateAdapter = true) @JsonClass(generateAdapter = true)
internal data class LoginFlowResponse(val flows: List<LoginFlow>) internal data class LoginFlowResponse(
@Json(name = "flows")
val flows: List<InteractiveAuthenticationFlow>
)

View File

@ -19,16 +19,16 @@ package im.vector.matrix.android.internal.auth.registration
import com.squareup.moshi.Json import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass import com.squareup.moshi.JsonClass
import im.vector.matrix.android.api.util.JsonDict import im.vector.matrix.android.api.util.JsonDict
import im.vector.matrix.android.internal.auth.data.LoginFlow import im.vector.matrix.android.internal.auth.data.InteractiveAuthenticationFlow


@JsonClass(generateAdapter = true) @JsonClass(generateAdapter = true)
internal data class RegistrationFlowResponse( internal data class RegistrationFlowResponse(


/** /**
* The list of stages the client has completed successfully. * The list of flows.
*/ */
@Json(name = "flows") @Json(name = "flows")
var loginFlows: List<LoginFlow>? = null, var flows: List<InteractiveAuthenticationFlow>? = null,


/** /**
* The list of stages the client has completed successfully. * The list of stages the client has completed successfully.

View File

@ -58,12 +58,12 @@ internal class DefaultDeleteDeviceTask(private val cryptoApi: CryptoApi,
} }


// check if the server response can be casted // check if the server response can be casted
if (registrationFlowResponse?.loginFlows?.isNotEmpty() == true) { if (registrationFlowResponse?.flows?.isNotEmpty() == true) {
val stages = ArrayList<String>() val stages = ArrayList<String>()


// Get all stages // Get all stages
registrationFlowResponse.loginFlows?.forEach { registrationFlowResponse.flows?.forEach {
stages.addAll(it.stages) stages.addAll(it.stages ?: emptyList())
} }


Timber.v("## deleteDevice() : supported stages $stages") Timber.v("## deleteDevice() : supported stages $stages")