Skip to content

Commit

Permalink
renaming sdk model to matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
ouchadam committed May 5, 2022
1 parent b2e3dd1 commit d037dde
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import org.matrix.android.sdk.api.auth.registration.RegistrationWizard
import org.matrix.android.sdk.api.failure.is401
import org.matrix.android.sdk.api.session.Session
import javax.inject.Inject
import org.matrix.android.sdk.api.auth.registration.RegistrationResult as SdkRegistrationResult
import org.matrix.android.sdk.api.auth.registration.RegistrationResult as MatrixRegistrationResult

class RegistrationActionHandler @Inject constructor() {

Expand Down Expand Up @@ -73,14 +73,14 @@ class RegistrationActionHandler @Inject constructor() {
}
}

private inline fun resultOf(block: () -> SdkRegistrationResult): RegistrationResult {
private inline fun resultOf(block: () -> MatrixRegistrationResult): RegistrationResult {
return runCatching { block() }.fold(
onSuccess = { it.toRegistrationResult() },
onFailure = { RegistrationResult.Error(it) }
)
}

private fun SdkRegistrationResult.toRegistrationResult() = when (this) {
private fun MatrixRegistrationResult.toRegistrationResult() = when (this) {
is FlowResponse -> RegistrationResult.NextStep(flowResult)
is Success -> RegistrationResult.Complete(session)
}
Expand Down

0 comments on commit d037dde

Please sign in to comment.