From 51ffe26a919a8b0e999496d7eb5cb16f8095d413 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Mon, 16 May 2022 17:17:15 +0100 Subject: [PATCH] renaming comparator to give more context to its usage --- .../im/vector/app/features/onboarding/OnboardingViewModel.kt | 4 ++-- ...tor.kt => MatrixOrgMissingRegistrationStagesComparator.kt} | 2 +- ...kt => MatrixOrgMissingRegistrationStagesComparatorTest.kt} | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) rename vector/src/main/java/im/vector/app/features/onboarding/ftueauth/{FtueMissingRegistrationStagesComparator.kt => MatrixOrgMissingRegistrationStagesComparator.kt} (93%) rename vector/src/test/java/im/vector/app/features/onboarding/ftueauth/{FtueMissingRegistrationStagesComparatorTest.kt => MatrixOrgMissingRegistrationStagesComparatorTest.kt} (91%) diff --git a/vector/src/main/java/im/vector/app/features/onboarding/OnboardingViewModel.kt b/vector/src/main/java/im/vector/app/features/onboarding/OnboardingViewModel.kt index a7468cf95b..94bb36dbbc 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/OnboardingViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/OnboardingViewModel.kt @@ -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 diff --git a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueMissingRegistrationStagesComparator.kt b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/MatrixOrgMissingRegistrationStagesComparator.kt similarity index 93% rename from vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueMissingRegistrationStagesComparator.kt rename to vector/src/main/java/im/vector/app/features/onboarding/ftueauth/MatrixOrgMissingRegistrationStagesComparator.kt index 4d9fe10852..894a474a9e 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueMissingRegistrationStagesComparator.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/MatrixOrgMissingRegistrationStagesComparator.kt @@ -18,7 +18,7 @@ package im.vector.app.features.onboarding.ftueauth import org.matrix.android.sdk.api.auth.registration.Stage -class FtueMissingRegistrationStagesComparator : Comparator { +class MatrixOrgMissingRegistrationStagesComparator : Comparator { override fun compare(a: Stage?, b: Stage?): Int { return (a?.toPriority() ?: 0).compareTo(b?.toPriority() ?: 0) diff --git a/vector/src/test/java/im/vector/app/features/onboarding/ftueauth/FtueMissingRegistrationStagesComparatorTest.kt b/vector/src/test/java/im/vector/app/features/onboarding/ftueauth/MatrixOrgMissingRegistrationStagesComparatorTest.kt similarity index 91% rename from vector/src/test/java/im/vector/app/features/onboarding/ftueauth/FtueMissingRegistrationStagesComparatorTest.kt rename to vector/src/test/java/im/vector/app/features/onboarding/ftueauth/MatrixOrgMissingRegistrationStagesComparatorTest.kt index 010cf5de60..1fe8ad6000 100644 --- a/vector/src/test/java/im/vector/app/features/onboarding/ftueauth/FtueMissingRegistrationStagesComparatorTest.kt +++ b/vector/src/test/java/im/vector/app/features/onboarding/ftueauth/MatrixOrgMissingRegistrationStagesComparatorTest.kt @@ -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(),