reusing the PostViewEvent action as a way to avoid redundant duplicated actions/events
This commit is contained in:
parent
e0f99e3b17
commit
3f9e7a74d6
|
@ -79,7 +79,4 @@ sealed class OnboardingAction : VectorViewModelAction {
|
|||
data class PostViewEvent(val viewEvent: OnboardingViewEvents) : OnboardingAction()
|
||||
|
||||
data class UserAcceptCertificate(val fingerprint: Fingerprint) : OnboardingAction()
|
||||
|
||||
object TakeMeHome : OnboardingAction()
|
||||
object PersonalizeProfile : OnboardingAction()
|
||||
}
|
||||
|
|
|
@ -147,8 +147,6 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
is OnboardingAction.UserAcceptCertificate -> handleUserAcceptCertificate(action)
|
||||
OnboardingAction.ClearHomeServerHistory -> handleClearHomeServerHistory()
|
||||
is OnboardingAction.PostViewEvent -> _viewEvents.post(action.viewEvent)
|
||||
OnboardingAction.PersonalizeProfile -> _viewEvents.post(OnboardingViewEvents.OnPersonalizeProfile)
|
||||
OnboardingAction.TakeMeHome -> _viewEvents.post(OnboardingViewEvents.OnTakeMeHome)
|
||||
}.exhaustive
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import im.vector.app.R
|
|||
import im.vector.app.core.di.ActiveSessionHolder
|
||||
import im.vector.app.databinding.FragmentFtueAccountCreatedBinding
|
||||
import im.vector.app.features.onboarding.OnboardingAction
|
||||
import im.vector.app.features.onboarding.OnboardingViewEvents
|
||||
import javax.inject.Inject
|
||||
|
||||
class FtueAuthAccountCreatedFragment @Inject constructor(
|
||||
|
@ -41,8 +42,8 @@ class FtueAuthAccountCreatedFragment @Inject constructor(
|
|||
|
||||
private fun setupViews() {
|
||||
views.accountCreatedSubtitle.text = getString(R.string.ftue_account_created_subtitle, activeSessionHolder.getActiveSession().myUserId)
|
||||
views.accountCreatedPersonalize.setOnClickListener { viewModel.handle(OnboardingAction.PersonalizeProfile) }
|
||||
views.accountCreatedTakeMeHome.setOnClickListener { viewModel.handle(OnboardingAction.TakeMeHome) }
|
||||
views.accountCreatedPersonalize.setOnClickListener { viewModel.handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnPersonalizeProfile)) }
|
||||
views.accountCreatedTakeMeHome.setOnClickListener { viewModel.handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnTakeMeHome)) }
|
||||
}
|
||||
|
||||
override fun resetViewModel() {
|
||||
|
@ -50,7 +51,7 @@ class FtueAuthAccountCreatedFragment @Inject constructor(
|
|||
}
|
||||
|
||||
override fun onBackPressed(toolbarButton: Boolean): Boolean {
|
||||
viewModel.handle(OnboardingAction.TakeMeHome)
|
||||
viewModel.handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnTakeMeHome))
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue