mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-27 20:09:27 +03:00
persisting the use case at the point of session creation
- this ensures we have a unique session or account id to store the selection against in case we support multi account in the future
This commit is contained in:
parent
0a7c421faa
commit
c4ac03949c
2 changed files with 9 additions and 12 deletions
|
@ -464,22 +464,14 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
}
|
||||
|
||||
private fun handleUpdateUseCase(action: OnboardingAction.UpdateUseCase) {
|
||||
viewModelScope.launch {
|
||||
onboardingStore.setUseCase(action.useCase)
|
||||
analyticsTracker.updateUserProperties(
|
||||
Identity(ftueUseCaseSelection = action.useCase.toTrackingValue())
|
||||
)
|
||||
}
|
||||
setState { copy(useCase = action.useCase) }
|
||||
analyticsTracker.updateUserProperties(Identity(ftueUseCaseSelection = action.useCase.toTrackingValue()))
|
||||
_viewEvents.post(OnboardingViewEvents.OpenServerSelection)
|
||||
}
|
||||
|
||||
private fun resetUseCase() {
|
||||
viewModelScope.launch {
|
||||
onboardingStore.resetUseCase()
|
||||
analyticsTracker.updateUserProperties(
|
||||
Identity(ftueUseCaseSelection = null)
|
||||
)
|
||||
}
|
||||
setState { copy(useCase = null) }
|
||||
analyticsTracker.updateUserProperties(Identity(ftueUseCaseSelection = null))
|
||||
}
|
||||
|
||||
private fun handleUpdateServerType(action: OnboardingAction.UpdateServerType) {
|
||||
|
@ -760,6 +752,9 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
}
|
||||
|
||||
private suspend fun onSessionCreated(session: Session) {
|
||||
awaitState().useCase?.let { useCase ->
|
||||
onboardingStore.setUseCase(useCase)
|
||||
}
|
||||
activeSessionHolder.setActiveSession(session)
|
||||
|
||||
authenticationService.reset()
|
||||
|
|
|
@ -40,6 +40,8 @@ data class OnboardingViewState(
|
|||
@PersistState
|
||||
val serverType: ServerType = ServerType.Unknown,
|
||||
@PersistState
|
||||
val useCase: FtueUseCase? = null,
|
||||
@PersistState
|
||||
val signMode: SignMode = SignMode.Unknown,
|
||||
@PersistState
|
||||
val resetPasswordEmail: String? = null,
|
||||
|
|
Loading…
Reference in a new issue