diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModel.kt index b50d61aa70ae..cac0f5ff301f 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/discover/ReaderDiscoverViewModel.kt @@ -154,11 +154,13 @@ class ReaderDiscoverViewModel @Inject constructor( // since new users have the dailyprompt tag followed by default, we need to ignore them when // checking if the user has any tags followed, so we show the onboarding state (ShowNoFollowedTags) if (userTags.filterNot { it.tagSlug == BLOGGING_PROMPT_TAG }.isEmpty()) { + parentViewModel.onFeedEmptyStateLoaded() _uiState.value = DiscoverUiState.EmptyUiState.ShowNoFollowedTagsUiState { parentViewModel.onShowReaderInterests() } } else { if (posts != null && posts.cards.isNotEmpty()) { + parentViewModel.onFeedContentLoaded() _uiState.value = DiscoverUiState.ContentUiState( convertCardsToUiStates(posts), reloadProgressVisibility = false, @@ -169,6 +171,7 @@ class ReaderDiscoverViewModel @Inject constructor( swipeToRefreshTriggered = false } } else { + parentViewModel.onFeedEmptyStateLoaded() _uiState.value = DiscoverUiState.EmptyUiState.ShowNoPostsUiState { _navigationEvents.value = Event(ShowReaderSubs) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/viewmodels/ReaderViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/viewmodels/ReaderViewModel.kt index 14ba95f13dbc..4bf77d16e5c3 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/viewmodels/ReaderViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/viewmodels/ReaderViewModel.kt @@ -142,6 +142,20 @@ class ReaderViewModel @Inject constructor( } } + fun onFeedEmptyStateLoaded() { + hideAnnouncementCard() + } + + fun onFeedContentLoaded() { + updateAnnouncementCard() + } + + private fun hideAnnouncementCard() { + _announcementCardState.value = _announcementCardState.value?.copy( + shouldShow = false, + ) + } + private fun showJetpackPoweredBottomSheet() { // _showJetpackPoweredBottomSheet.value = Event(true) }