mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-17 12:30:07 +03:00
updating the identity with the use case selection as part of the onboarding flow
This commit is contained in:
parent
515c8ce7c2
commit
6c1cbccff3
2 changed files with 21 additions and 1 deletions
|
@ -16,6 +16,8 @@
|
|||
|
||||
package im.vector.app.features.onboarding
|
||||
|
||||
import im.vector.app.features.analytics.plan.Identity
|
||||
|
||||
enum class FtueUseCase(val persistableValue: String) {
|
||||
FRIENDS_FAMILY("friends_family"),
|
||||
TEAMS("teams"),
|
||||
|
@ -26,3 +28,12 @@ enum class FtueUseCase(val persistableValue: String) {
|
|||
fun from(persistedValue: String) = values().first { it.persistableValue == persistedValue }
|
||||
}
|
||||
}
|
||||
|
||||
fun FtueUseCase.toTrackingValue(): Identity.FtueUseCaseSelection {
|
||||
return when (this) {
|
||||
FtueUseCase.FRIENDS_FAMILY -> Identity.FtueUseCaseSelection.PersonalMessaging
|
||||
FtueUseCase.TEAMS -> Identity.FtueUseCaseSelection.WorkMessaging
|
||||
FtueUseCase.COMMUNITIES -> Identity.FtueUseCaseSelection.CommunityMessaging
|
||||
FtueUseCase.SKIP -> Identity.FtueUseCaseSelection.Skip
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@ import im.vector.app.core.platform.VectorViewModel
|
|||
import im.vector.app.core.resources.StringProvider
|
||||
import im.vector.app.core.utils.ensureTrailingSlash
|
||||
import im.vector.app.features.VectorFeatures
|
||||
import im.vector.app.features.analytics.VectorAnalytics
|
||||
import im.vector.app.features.analytics.plan.Identity
|
||||
import im.vector.app.features.login.HomeServerConnectionConfigFactory
|
||||
import im.vector.app.features.login.LoginConfig
|
||||
import im.vector.app.features.login.LoginMode
|
||||
|
@ -75,7 +77,8 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
private val stringProvider: StringProvider,
|
||||
private val homeServerHistoryService: HomeServerHistoryService,
|
||||
private val vectorFeatures: VectorFeatures,
|
||||
private val onboardingStore: OnboardingStore
|
||||
private val onboardingStore: OnboardingStore,
|
||||
private val vectorAnalytics: VectorAnalytics
|
||||
) : VectorViewModel<OnboardingViewState, OnboardingAction, OnboardingViewEvents>(initialState) {
|
||||
|
||||
@AssistedFactory
|
||||
|
@ -463,6 +466,9 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
private fun handleUpdateUseCase(action: OnboardingAction.UpdateUseCase) {
|
||||
viewModelScope.launch {
|
||||
onboardingStore.setUseCase(action.useCase)
|
||||
vectorAnalytics.updateUserProperties(
|
||||
Identity(ftueUseCaseSelection = action.useCase.toTrackingValue())
|
||||
)
|
||||
}
|
||||
_viewEvents.post(OnboardingViewEvents.OpenServerSelection)
|
||||
}
|
||||
|
@ -470,6 +476,9 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
private fun resetUseCase() {
|
||||
viewModelScope.launch {
|
||||
onboardingStore.resetUseCase()
|
||||
vectorAnalytics.updateUserProperties(
|
||||
Identity(ftueUseCaseSelection = null)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue