aligning the with develop to use the initial state for reading the activity arguments

This commit is contained in:
Adam Brown 2022-05-31 11:06:31 +01:00
parent 15765166fb
commit 70c35304ce
3 changed files with 7 additions and 7 deletions

View File

@ -249,7 +249,7 @@ class HomeActivity :
if (isFirstCreation()) { if (isFirstCreation()) {
handleIntent(intent) handleIntent(intent)
} }
homeActivityViewModel.handle(HomeActivityViewActions.ViewStarted(args?.authenticationDescription)) homeActivityViewModel.handle(HomeActivityViewActions.ViewStarted)
} }
private fun openGroup(shouldClearFragment: Boolean) { private fun openGroup(shouldClearFragment: Boolean) {

View File

@ -20,6 +20,6 @@ import im.vector.app.core.platform.VectorViewModelAction
import im.vector.app.features.onboarding.AuthenticationDescription import im.vector.app.features.onboarding.AuthenticationDescription
sealed interface HomeActivityViewActions : VectorViewModelAction { sealed interface HomeActivityViewActions : VectorViewModelAction {
data class ViewStarted(val recentAuthentication: AuthenticationDescription?) : HomeActivityViewActions object ViewStarted : HomeActivityViewActions
object PushPromptHasBeenReviewed : HomeActivityViewActions object PushPromptHasBeenReviewed : HomeActivityViewActions
} }

View File

@ -101,18 +101,18 @@ class HomeActivityViewModel @AssistedInject constructor(
private var hasCheckedBootstrap = false private var hasCheckedBootstrap = false
private var onceTrusted = false private var onceTrusted = false
private fun initialize(recentAuthentication: AuthenticationDescription?) { private fun initialize() {
if (isInitialized) return if (isInitialized) return
isInitialized = true isInitialized = true
cleanupFiles() cleanupFiles()
observeInitialSync() observeInitialSync()
checkSessionPushIsOn() checkSessionPushIsOn()
observeCrossSigningReset() observeCrossSigningReset()
observeAnalytics(recentAuthentication) observeAnalytics()
initThreadsMigration() initThreadsMigration()
} }
private fun observeAnalytics(recentAuthentication: AuthenticationDescription?) { private fun observeAnalytics() {
if (analyticsConfig.isEnabled) { if (analyticsConfig.isEnabled) {
analyticsStore.didAskUserConsentFlow analyticsStore.didAskUserConsentFlow
.onEach { didAskUser -> .onEach { didAskUser ->
@ -122,7 +122,7 @@ class HomeActivityViewModel @AssistedInject constructor(
} }
.launchIn(viewModelScope) .launchIn(viewModelScope)
recentAuthentication?.let { initialState.authenticationDescription?.let { recentAuthentication ->
when (recentAuthentication) { when (recentAuthentication) {
is AuthenticationDescription.Register -> { is AuthenticationDescription.Register -> {
viewModelScope.launch { viewModelScope.launch {
@ -426,7 +426,7 @@ class HomeActivityViewModel @AssistedInject constructor(
vectorPreferences.setDidAskUserToEnableSessionPush() vectorPreferences.setDidAskUserToEnableSessionPush()
} }
is HomeActivityViewActions.ViewStarted -> { is HomeActivityViewActions.ViewStarted -> {
initialize(action.recentAuthentication) initialize()
} }
} }
} }