From b4f730205757c6011c1f892df4921839ef5d799c Mon Sep 17 00:00:00 2001 From: Nikita Fedrunov <66663241+fedrunov@users.noreply.github.com> Date: Mon, 19 Sep 2022 22:35:15 +0200 Subject: [PATCH] release notes screen now properly shown on update to a version with app layout labs flag enabled by default (#7175) --- .../features/home/HomeActivityViewModel.kt | 22 ++++++++++--------- .../release/ReleaseNotesPreferencesStore.kt | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt index cbe531ea71..a08298e402 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt @@ -119,17 +119,19 @@ class HomeActivityViewModel @AssistedInject constructor( } private fun observeReleaseNotes() = withState { state -> - // we don't want to show release notes for new users or after relogin - if (state.authenticationDescription == null && vectorPreferences.isNewAppLayoutEnabled()) { - releaseNotesPreferencesStore.appLayoutOnboardingShown.onEach { isAppLayoutOnboardingShown -> - if (!isAppLayoutOnboardingShown) { - _viewEvents.post(HomeActivityViewEvents.ShowReleaseNotes) + if (vectorPreferences.isNewAppLayoutEnabled()) { + // we don't want to show release notes for new users or after relogin + if (state.authenticationDescription == null) { + releaseNotesPreferencesStore.appLayoutOnboardingShown.onEach { isAppLayoutOnboardingShown -> + if (!isAppLayoutOnboardingShown) { + _viewEvents.post(HomeActivityViewEvents.ShowReleaseNotes) + } + }.launchIn(viewModelScope) + } else { + // we assume that users which came from auth flow either have seen updates already (relogin) or don't need them (new user) + viewModelScope.launch { + releaseNotesPreferencesStore.setAppLayoutOnboardingShown(true) } - }.launchIn(viewModelScope) - } else { - // we assume that users which came from auth flow either have seen updates already (relogin) or don't need them (new user) - viewModelScope.launch { - releaseNotesPreferencesStore.setAppLayoutOnboardingShown(true) } } } diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/home/release/ReleaseNotesPreferencesStore.kt b/vector/src/main/java/im/vector/app/features/home/room/list/home/release/ReleaseNotesPreferencesStore.kt index cefe107905..3320bdf314 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/home/release/ReleaseNotesPreferencesStore.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/home/release/ReleaseNotesPreferencesStore.kt @@ -34,7 +34,7 @@ class ReleaseNotesPreferencesStore @Inject constructor( private val context: Context ) { - private val isAppLayoutOnboardingShown = booleanPreferencesKey("SETTINGS_APP_LAYOUT_ONBOARDING_SHOWN") + private val isAppLayoutOnboardingShown = booleanPreferencesKey("SETTINGS_APP_LAYOUT_ONBOARDING_DISPLAYED") val appLayoutOnboardingShown: Flow = context.dataStore.data .map { preferences -> preferences[isAppLayoutOnboardingShown].orFalse() }