Rename topicState -> topicUiState

pull/301/head
Caren Chang 2 years ago
parent ccf60dca6c
commit e0e664846d

@ -57,7 +57,7 @@ class TopicScreenTest {
fun niaLoadingWheel_whenScreenIsLoading_showLoading() { fun niaLoadingWheel_whenScreenIsLoading_showLoading() {
composeTestRule.setContent { composeTestRule.setContent {
TopicScreen( TopicScreen(
topicState = TopicUiState.Loading, topicUiState = TopicUiState.Loading,
newsUiState = NewsUiState.Loading, newsUiState = NewsUiState.Loading,
onBackClick = { }, onBackClick = { },
onFollowClick = { }, onFollowClick = { },
@ -75,7 +75,7 @@ class TopicScreenTest {
val testTopic = testTopics.first() val testTopic = testTopics.first()
composeTestRule.setContent { composeTestRule.setContent {
TopicScreen( TopicScreen(
topicState = TopicUiState.Success(testTopic), topicUiState = TopicUiState.Success(testTopic),
newsUiState = NewsUiState.Loading, newsUiState = NewsUiState.Loading,
onBackClick = { }, onBackClick = { },
onFollowClick = { }, onFollowClick = { },
@ -98,7 +98,7 @@ class TopicScreenTest {
fun news_whenTopicIsLoading_isNotShown() { fun news_whenTopicIsLoading_isNotShown() {
composeTestRule.setContent { composeTestRule.setContent {
TopicScreen( TopicScreen(
topicState = TopicUiState.Loading, topicUiState = TopicUiState.Loading,
newsUiState = NewsUiState.Success( newsUiState = NewsUiState.Success(
sampleNewsResources.mapIndexed { index, newsResource -> sampleNewsResources.mapIndexed { index, newsResource ->
SaveableNewsResource( SaveableNewsResource(
@ -123,7 +123,7 @@ class TopicScreenTest {
val testTopic = testTopics.first() val testTopic = testTopics.first()
composeTestRule.setContent { composeTestRule.setContent {
TopicScreen( TopicScreen(
topicState = TopicUiState.Success(testTopic), topicUiState = TopicUiState.Success(testTopic),
newsUiState = NewsUiState.Success( newsUiState = NewsUiState.Success(
sampleNewsResources.mapIndexed { index, newsResource -> sampleNewsResources.mapIndexed { index, newsResource ->
SaveableNewsResource( SaveableNewsResource(

@ -70,7 +70,7 @@ fun TopicRoute(
val newsUiState: NewsUiState by viewModel.newUiState.collectAsStateWithLifecycle() val newsUiState: NewsUiState by viewModel.newUiState.collectAsStateWithLifecycle()
TopicScreen( TopicScreen(
topicState = topicUiState, topicUiState = topicUiState,
newsUiState = newsUiState, newsUiState = newsUiState,
modifier = modifier, modifier = modifier,
onBackClick = onBackClick, onBackClick = onBackClick,
@ -82,7 +82,7 @@ fun TopicRoute(
@VisibleForTesting @VisibleForTesting
@Composable @Composable
internal fun TopicScreen( internal fun TopicScreen(
topicState: TopicUiState, topicUiState: TopicUiState,
newsUiState: NewsUiState, newsUiState: NewsUiState,
onBackClick: () -> Unit, onBackClick: () -> Unit,
onFollowClick: (Boolean) -> Unit, onFollowClick: (Boolean) -> Unit,
@ -96,7 +96,7 @@ internal fun TopicScreen(
item { item {
Spacer(Modifier.windowInsetsTopHeight(WindowInsets.safeDrawing)) Spacer(Modifier.windowInsetsTopHeight(WindowInsets.safeDrawing))
} }
when (topicState) { when (topicUiState) {
Loading -> item { Loading -> item {
NiaLoadingWheel( NiaLoadingWheel(
modifier = modifier, modifier = modifier,
@ -109,14 +109,14 @@ internal fun TopicScreen(
TopicToolbar( TopicToolbar(
onBackClick = onBackClick, onBackClick = onBackClick,
onFollowClick = onFollowClick, onFollowClick = onFollowClick,
uiState = topicState.followableTopic, uiState = topicUiState.followableTopic,
) )
} }
TopicBody( TopicBody(
name = topicState.followableTopic.topic.name, name = topicUiState.followableTopic.topic.name,
description = topicState.followableTopic.topic.longDescription, description = topicUiState.followableTopic.topic.longDescription,
news = newsUiState, news = newsUiState,
imageUrl = topicState.followableTopic.topic.imageUrl, imageUrl = topicUiState.followableTopic.topic.imageUrl,
onBookmarkChanged = onBookmarkChanged onBookmarkChanged = onBookmarkChanged
) )
} }
@ -246,7 +246,7 @@ fun TopicScreenPopulated() {
NiaTheme { NiaTheme {
NiaBackground { NiaBackground {
TopicScreen( TopicScreen(
topicState = TopicUiState.Success(FollowableTopic(previewTopics[0], false)), topicUiState = TopicUiState.Success(FollowableTopic(previewTopics[0], false)),
newsUiState = NewsUiState.Success( newsUiState = NewsUiState.Success(
previewNewsResources.mapIndexed { index, newsResource -> previewNewsResources.mapIndexed { index, newsResource ->
SaveableNewsResource( SaveableNewsResource(
@ -271,7 +271,7 @@ fun TopicScreenLoading() {
NiaTheme { NiaTheme {
NiaBackground { NiaBackground {
TopicScreen( TopicScreen(
topicState = TopicUiState.Loading, topicUiState = TopicUiState.Loading,
newsUiState = NewsUiState.Loading, newsUiState = NewsUiState.Loading,
onBackClick = {}, onBackClick = {},
onFollowClick = {}, onFollowClick = {},

Loading…
Cancel
Save