renaming comparator to give more context to its usage
This commit is contained in:
parent
6c3150edb7
commit
51ffe26a91
|
@ -42,7 +42,7 @@ import im.vector.app.features.login.ReAuthHelper
|
||||||
import im.vector.app.features.login.ServerType
|
import im.vector.app.features.login.ServerType
|
||||||
import im.vector.app.features.login.SignMode
|
import im.vector.app.features.login.SignMode
|
||||||
import im.vector.app.features.onboarding.StartAuthenticationFlowUseCase.StartAuthenticationResult
|
import im.vector.app.features.onboarding.StartAuthenticationFlowUseCase.StartAuthenticationResult
|
||||||
import im.vector.app.features.onboarding.ftueauth.FtueMissingRegistrationStagesComparator
|
import im.vector.app.features.onboarding.ftueauth.MatrixOrgMissingRegistrationStagesComparator
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.flow.firstOrNull
|
import kotlinx.coroutines.flow.firstOrNull
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
@ -301,7 +301,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
||||||
|
|
||||||
private fun OnboardingViewState.hasSelectedMatrixOrg() = selectedHomeserver.userFacingUrl == matrixOrgUrl
|
private fun OnboardingViewState.hasSelectedMatrixOrg() = selectedHomeserver.userFacingUrl == matrixOrgUrl
|
||||||
|
|
||||||
private fun FlowResult.overrideOrder() = copy(missingStages = missingStages.sortedWith(FtueMissingRegistrationStagesComparator()))
|
private fun FlowResult.overrideOrder() = copy(missingStages = missingStages.sortedWith(MatrixOrgMissingRegistrationStagesComparator()))
|
||||||
|
|
||||||
private fun handleRegisterWith(action: OnboardingAction.Register) {
|
private fun handleRegisterWith(action: OnboardingAction.Register) {
|
||||||
reAuthHelper.data = action.password
|
reAuthHelper.data = action.password
|
||||||
|
|
|
@ -18,7 +18,7 @@ package im.vector.app.features.onboarding.ftueauth
|
||||||
|
|
||||||
import org.matrix.android.sdk.api.auth.registration.Stage
|
import org.matrix.android.sdk.api.auth.registration.Stage
|
||||||
|
|
||||||
class FtueMissingRegistrationStagesComparator : Comparator<Stage> {
|
class MatrixOrgMissingRegistrationStagesComparator : Comparator<Stage> {
|
||||||
|
|
||||||
override fun compare(a: Stage?, b: Stage?): Int {
|
override fun compare(a: Stage?, b: Stage?): Int {
|
||||||
return (a?.toPriority() ?: 0).compareTo(b?.toPriority() ?: 0)
|
return (a?.toPriority() ?: 0).compareTo(b?.toPriority() ?: 0)
|
|
@ -25,7 +25,7 @@ import im.vector.app.test.fixtures.anOtherStage
|
||||||
import org.amshove.kluent.shouldBeEqualTo
|
import org.amshove.kluent.shouldBeEqualTo
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class FtueMissingRegistrationStagesComparatorTest {
|
class MatrixOrgMissingRegistrationStagesComparatorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `when ordering stages, then prioritizes email`() {
|
fun `when ordering stages, then prioritizes email`() {
|
||||||
|
@ -38,7 +38,7 @@ class FtueMissingRegistrationStagesComparatorTest {
|
||||||
aTermsStage()
|
aTermsStage()
|
||||||
)
|
)
|
||||||
|
|
||||||
val result = input.sortedWith(FtueMissingRegistrationStagesComparator())
|
val result = input.sortedWith(MatrixOrgMissingRegistrationStagesComparator())
|
||||||
|
|
||||||
result shouldBeEqualTo listOf(
|
result shouldBeEqualTo listOf(
|
||||||
anEmailStage(),
|
anEmailStage(),
|
Loading…
Reference in New Issue