renaming comparator to give more context to its usage

This commit is contained in:
Adam Brown 2022-05-16 17:17:15 +01:00
parent 6c3150edb7
commit 51ffe26a91
3 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -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)

View File

@ -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(),