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

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

Loading…
Cancel
Save