From c29dc8975693cdd342f924f441510f1f15de1b90 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Mon, 10 Jan 2022 13:07:46 +0000 Subject: [PATCH] typing the use case selections and binding the label and usecase type at the same time for visibility --- .../features/onboarding/OnboardingAction.kt | 10 +++++++- .../onboarding/OnboardingViewModel.kt | 2 +- .../ftueauth/FtueAuthUseCaseFragment.kt | 25 +++++++++++-------- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/onboarding/OnboardingAction.kt b/vector/src/main/java/im/vector/app/features/onboarding/OnboardingAction.kt index ea549b214a..9ce84211f1 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/OnboardingAction.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/OnboardingAction.kt @@ -31,7 +31,15 @@ sealed class OnboardingAction : VectorViewModelAction { data class UpdateServerType(val serverType: ServerType) : OnboardingAction() data class UpdateHomeServer(val homeServerUrl: String) : OnboardingAction() - data class UpdateUseCase(val todo: String) : OnboardingAction() + data class UpdateUseCase(val useCase: UseCase) : OnboardingAction() { + enum class UseCase { + FRIENDS_FAMILY, + TEAMS, + COMMUNITIES, + SKIP + } + } + data class UpdateSignMode(val signMode: SignMode) : OnboardingAction() data class LoginWithToken(val loginToken: String) : OnboardingAction() data class WebLoginSuccess(val credentials: Credentials) : OnboardingAction() 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 a61db35832..0fa0a34dc6 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 @@ -459,7 +459,7 @@ class OnboardingViewModel @AssistedInject constructor( private fun handleUpdateUseCase(action: OnboardingAction.UpdateUseCase) { // TODO act on the use case selection - action.todo + action.useCase _viewEvents.post(OnboardingViewEvents.OpenServerSelection) } diff --git a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthUseCaseFragment.kt b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthUseCaseFragment.kt index 67476077bd..39e8c3d8e0 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthUseCaseFragment.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthUseCaseFragment.kt @@ -20,12 +20,14 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.TextView +import androidx.annotation.StringRes import im.vector.app.R import im.vector.app.core.extensions.setTextWithColoredPart import im.vector.app.databinding.FragmentFtueAuthUseCaseBinding import im.vector.app.features.login.ServerType import im.vector.app.features.onboarding.OnboardingAction -import me.saket.bettermovementmethod.BetterLinkMovementMethod +import im.vector.app.features.onboarding.OnboardingAction.UpdateUseCase.UseCase import javax.inject.Inject class FtueAuthUseCaseFragment @Inject constructor() : AbstractFtueAuthFragment() { @@ -40,15 +42,9 @@ class FtueAuthUseCaseFragment @Inject constructor() : AbstractFtueAuthFragment