diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/registration/RegistrationWizard.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/registration/RegistrationWizard.kt index 30ef23fa0e851de82de5014f77cc0988e7f40ac5..a8111915aec3be82cd1778f2fd1ad0f63f10273f 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/registration/RegistrationWizard.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/registration/RegistrationWizard.kt @@ -128,4 +128,10 @@ interface RegistrationWizard { //Added to support few registration flows suspend fun getAllRegistrationFlows(): List<List<Stage>> + + //Added to support custom Swiclops registration + suspend fun registrationSwiclops( + authParams: JsonDict, + userName: String?, + initialDeviceDisplayName: String?): RegistrationResult } \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/registration/DefaultRegistrationWizard.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/registration/DefaultRegistrationWizard.kt index 3077f8953c8241e5b0c399a4331a348e94939984..63bf1b0a260819c0767ade9f5fb908e79ee5b841 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/registration/DefaultRegistrationWizard.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/registration/DefaultRegistrationWizard.kt @@ -304,4 +304,22 @@ internal class DefaultRegistrationWizard( LoginFlowTypes.MSISDN -> firstOrNull { it is Stage.Msisdn } else -> firstOrNull { (it as? Stage.Other)?.type == type } } + + override suspend fun registrationSwiclops( + authParams: JsonDict, + userName: String?, + initialDeviceDisplayName: String?): RegistrationResult { + val safeSession = pendingSessionData.currentSession + ?: throw IllegalStateException("developer error, call createAccount() method first") + + val mutableParams = authParams.toMutableMap() + mutableParams["session"] = safeSession + + val params = RegistrationCustomParams( + auth = mutableParams, + username = userName, + initialDeviceDisplayName = initialDeviceDisplayName + ) + return performRegistrationOtherRequest(LoginType.CUSTOM, params) + } } \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/registration/RegistrationCustomParams.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/registration/RegistrationCustomParams.kt index 45adac6c2691bd9d8c2f47abe681f6e315dc392c..21aea43e9591f79196969a02bb223585a0a736c6 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/registration/RegistrationCustomParams.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/registration/RegistrationCustomParams.kt @@ -28,4 +28,12 @@ internal data class RegistrationCustomParams( // authentication parameters @Json(name = "auth") val auth: JsonDict? = null, + + // the account username + @Json(name = "username") + val username: String? = null, + + // device name + @Json(name = "initial_device_display_name") + val initialDeviceDisplayName: String? = null, )