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 PostViewEvent(val viewEvent: OnboardingViewEvents) : OnboardingAction()
|
||||||
|
|
||||||
data class UserAcceptCertificate(val fingerprint: Fingerprint) : 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)
|
is OnboardingAction.UserAcceptCertificate -> handleUserAcceptCertificate(action)
|
||||||
OnboardingAction.ClearHomeServerHistory -> handleClearHomeServerHistory()
|
OnboardingAction.ClearHomeServerHistory -> handleClearHomeServerHistory()
|
||||||
is OnboardingAction.PostViewEvent -> _viewEvents.post(action.viewEvent)
|
is OnboardingAction.PostViewEvent -> _viewEvents.post(action.viewEvent)
|
||||||
OnboardingAction.PersonalizeProfile -> _viewEvents.post(OnboardingViewEvents.OnPersonalizeProfile)
|
|
||||||
OnboardingAction.TakeMeHome -> _viewEvents.post(OnboardingViewEvents.OnTakeMeHome)
|
|
||||||
}.exhaustive
|
}.exhaustive
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import im.vector.app.R
|
||||||
import im.vector.app.core.di.ActiveSessionHolder
|
import im.vector.app.core.di.ActiveSessionHolder
|
||||||
import im.vector.app.databinding.FragmentFtueAccountCreatedBinding
|
import im.vector.app.databinding.FragmentFtueAccountCreatedBinding
|
||||||
import im.vector.app.features.onboarding.OnboardingAction
|
import im.vector.app.features.onboarding.OnboardingAction
|
||||||
|
import im.vector.app.features.onboarding.OnboardingViewEvents
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class FtueAuthAccountCreatedFragment @Inject constructor(
|
class FtueAuthAccountCreatedFragment @Inject constructor(
|
||||||
|
@ -41,8 +42,8 @@ class FtueAuthAccountCreatedFragment @Inject constructor(
|
||||||
|
|
||||||
private fun setupViews() {
|
private fun setupViews() {
|
||||||
views.accountCreatedSubtitle.text = getString(R.string.ftue_account_created_subtitle, activeSessionHolder.getActiveSession().myUserId)
|
views.accountCreatedSubtitle.text = getString(R.string.ftue_account_created_subtitle, activeSessionHolder.getActiveSession().myUserId)
|
||||||
views.accountCreatedPersonalize.setOnClickListener { viewModel.handle(OnboardingAction.PersonalizeProfile) }
|
views.accountCreatedPersonalize.setOnClickListener { viewModel.handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnPersonalizeProfile)) }
|
||||||
views.accountCreatedTakeMeHome.setOnClickListener { viewModel.handle(OnboardingAction.TakeMeHome) }
|
views.accountCreatedTakeMeHome.setOnClickListener { viewModel.handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnTakeMeHome)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun resetViewModel() {
|
override fun resetViewModel() {
|
||||||
|
@ -50,7 +51,7 @@ class FtueAuthAccountCreatedFragment @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed(toolbarButton: Boolean): Boolean {
|
override fun onBackPressed(toolbarButton: Boolean): Boolean {
|
||||||
viewModel.handle(OnboardingAction.TakeMeHome)
|
viewModel.handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnTakeMeHome))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue