Remove tab state from InterestsViewModel

Change-Id: I5c15015f27fa0aa7709d0c3959d761355c8d9722
pull/489/head
Alex Vanyo 2 years ago
parent 7903f87dcc
commit 154f05e23f

@ -17,7 +17,6 @@
package com.google.samples.apps.nowinandroid.feature.interests
import androidx.compose.foundation.layout.Column
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
@ -51,7 +50,6 @@ internal fun InterestsRoute(
)
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
internal fun InterestsScreen(
uiState: InterestsUiState,

@ -24,10 +24,8 @@ import com.google.samples.apps.nowinandroid.core.domain.TopicSortField
import com.google.samples.apps.nowinandroid.core.domain.model.FollowableTopic
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch
@ -38,14 +36,6 @@ class InterestsViewModel @Inject constructor(
getFollowableTopics: GetFollowableTopicsUseCase,
) : ViewModel() {
private val _tabState = MutableStateFlow(
InterestsTabState(
titles = listOf(R.string.interests_topics, R.string.interests_people),
currentIndex = 0
)
)
val tabState: StateFlow<InterestsTabState> = _tabState.asStateFlow()
val uiState: StateFlow<InterestsUiState> =
getFollowableTopics(sortBy = TopicSortField.NAME).map(
InterestsUiState::Interests
@ -62,11 +52,6 @@ class InterestsViewModel @Inject constructor(
}
}
data class InterestsTabState(
val titles: List<Int>,
val currentIndex: Int
)
sealed interface InterestsUiState {
object Loading : InterestsUiState

@ -17,8 +17,6 @@
<resources>
<!-- TODO: Remove the redundant "interests" prefix -->
<string name="interests">Interests</string>
<string name="interests_topics">Topics</string>
<string name="interests_people">People</string>
<string name="interests_loading">Loading data</string>
<string name="interests_empty_header">"No available data"</string>
<string name="interests_card_follow_button_content_desc">Follow interest button</string>

Loading…
Cancel
Save