mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-17 02:15:17 +08:00
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.SignMode
|
||||
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.flow.firstOrNull
|
||||
import kotlinx.coroutines.launch
|
||||
@ -301,7 +301,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
||||
|
||||
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) {
|
||||
reAuthHelper.data = action.password
|
||||
|
@ -18,7 +18,7 @@ package im.vector.app.features.onboarding.ftueauth
|
||||
|
||||
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 {
|
||||
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.junit.Test
|
||||
|
||||
class FtueMissingRegistrationStagesComparatorTest {
|
||||
class MatrixOrgMissingRegistrationStagesComparatorTest {
|
||||
|
||||
@Test
|
||||
fun `when ordering stages, then prioritizes email`() {
|
||||
@ -38,7 +38,7 @@ class FtueMissingRegistrationStagesComparatorTest {
|
||||
aTermsStage()
|
||||
)
|
||||
|
||||
val result = input.sortedWith(FtueMissingRegistrationStagesComparator())
|
||||
val result = input.sortedWith(MatrixOrgMissingRegistrationStagesComparator())
|
||||
|
||||
result shouldBeEqualTo listOf(
|
||||
anEmailStage(),
|
Loading…
Reference in New Issue
Block a user