mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-24 11:45:28 +00:00
Hide empty text until after we've tried to load stories.
This commit is contained in:
@@ -77,7 +77,7 @@ class StoriesLandingFragment :
|
||||
|
||||
viewModel.state.observe(viewLifecycleOwner) {
|
||||
adapter.submitList(getConfiguration(it).toMappingModelList())
|
||||
emptyNotice.visible = it.storiesLandingItems.isEmpty()
|
||||
emptyNotice.visible = it.hasNoStories
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,5 +3,13 @@ package org.thoughtcrime.securesms.stories.landing
|
||||
data class StoriesLandingState(
|
||||
val storiesLandingItems: List<StoriesLandingItemData> = emptyList(),
|
||||
val displayMyStoryItem: Boolean = false,
|
||||
val isHiddenContentVisible: Boolean = false
|
||||
)
|
||||
val isHiddenContentVisible: Boolean = false,
|
||||
val loadingState: LoadingState = LoadingState.INIT
|
||||
) {
|
||||
enum class LoadingState {
|
||||
INIT,
|
||||
LOADED
|
||||
}
|
||||
|
||||
val hasNoStories: Boolean = loadingState == LoadingState.LOADED && storiesLandingItems.isEmpty()
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ class StoriesLandingViewModel(private val storiesLandingRepository: StoriesLandi
|
||||
disposables += storiesLandingRepository.getStories().subscribe { stories ->
|
||||
store.update { state ->
|
||||
state.copy(
|
||||
loadingState = StoriesLandingState.LoadingState.LOADED,
|
||||
storiesLandingItems = stories.sorted(),
|
||||
displayMyStoryItem = stories.isEmpty() || stories.none { it.storyRecipient.isMyStory }
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user