Better to call setAppLayoutOnboardingShown when we are sure the Activity has been run.

This commit is contained in:
Benoit Marty 2022-09-06 15:15:59 +02:00
parent b3eac52e3f
commit 16fad63e49
2 changed files with 10 additions and 1 deletions

View File

@ -123,7 +123,6 @@ class HomeActivityViewModel @AssistedInject constructor(
if (state.authenticationDescription == null && vectorFeatures.isNewAppLayoutEnabled()) {
releaseNotesPreferencesStore.appLayoutOnboardingShown.onEach { isAppLayoutOnboardingShown ->
if (!isAppLayoutOnboardingShown) {
releaseNotesPreferencesStore.setAppLayoutOnboardingShown(true)
_viewEvents.post(HomeActivityViewEvents.ShowReleaseNotes)
}
}.launchIn(viewModelScope)

View File

@ -16,17 +16,20 @@
package im.vector.app.features.home.room.list.home.release
import androidx.lifecycle.lifecycleScope
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.core.extensions.addFragment
import im.vector.app.core.platform.ScreenOrientationLocker
import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.databinding.ActivitySimpleBinding
import kotlinx.coroutines.launch
import javax.inject.Inject
@AndroidEntryPoint
class ReleaseNotesActivity : VectorBaseActivity<ActivitySimpleBinding>() {
@Inject lateinit var orientationLocker: ScreenOrientationLocker
@Inject lateinit var releaseNotesPreferencesStore: ReleaseNotesPreferencesStore
override fun getBinding() = ActivitySimpleBinding.inflate(layoutInflater)
@ -38,4 +41,11 @@ class ReleaseNotesActivity : VectorBaseActivity<ActivitySimpleBinding>() {
addFragment(views.simpleFragmentContainer, ReleaseNotesFragment::class.java)
}
}
override fun onResume() {
super.onResume()
lifecycleScope.launch {
releaseNotesPreferencesStore.setAppLayoutOnboardingShown(true)
}
}
}