Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[JetNews] Simplify flow control for HomeScreenErrorAndContent
  • Loading branch information
objcode committed Oct 13, 2020
commit 162dc96a3fd402b20afbeac71b9b1b6feca4cf85
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,14 @@ private fun HomeScreenErrorAndContent(
) {
if (posts.data != null) {
PostList(posts.data, navigateTo, favorites, onToggleFavorite, modifier)
} else {
Box(Modifier.fillMaxSize()) {
if (!posts.hasError) {
// if there are no posts, and no error, let the user refresh manually
TextButton(onClick = onRefresh, modifier.fillMaxSize()) {
Text("Tap to load content", textAlign = TextAlign.Center)
}
}
} else if (!posts.hasError) {
// if there are no posts, and no error, let the user refresh manually
TextButton(onClick = onRefresh, Modifier.fillMaxSize()) {
Text("Tap to load content", textAlign = TextAlign.Center)
}
} else {
// there's currently an error showing, don't show any content
Box(modifier.fillMaxSize()) { /* empty screen */ }
}
}

Expand Down