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()) {
handleIntent(intent)
}
homeActivityViewModel.handle(HomeActivityViewActions.ViewStarted(args?.authenticationDescription))
homeActivityViewModel.handle(HomeActivityViewActions.ViewStarted)
}
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
sealed interface HomeActivityViewActions : VectorViewModelAction {
data class ViewStarted(val recentAuthentication: AuthenticationDescription?) : HomeActivityViewActions
object ViewStarted : HomeActivityViewActions
object PushPromptHasBeenReviewed : HomeActivityViewActions
}

View File

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