From 154f05e23f5de17c3500da25a57278b5cd1fd349 Mon Sep 17 00:00:00 2001 From: Alex Vanyo Date: Thu, 15 Dec 2022 13:36:22 -0800 Subject: [PATCH] Remove tab state from InterestsViewModel Change-Id: I5c15015f27fa0aa7709d0c3959d761355c8d9722 --- .../feature/interests/InterestsScreen.kt | 2 -- .../feature/interests/InterestsViewModel.kt | 15 --------------- feature/interests/src/main/res/values/strings.xml | 2 -- 3 files changed, 19 deletions(-) diff --git a/feature/interests/src/main/java/com/google/samples/apps/nowinandroid/feature/interests/InterestsScreen.kt b/feature/interests/src/main/java/com/google/samples/apps/nowinandroid/feature/interests/InterestsScreen.kt index 198cab4a8..d062b5fe9 100644 --- a/feature/interests/src/main/java/com/google/samples/apps/nowinandroid/feature/interests/InterestsScreen.kt +++ b/feature/interests/src/main/java/com/google/samples/apps/nowinandroid/feature/interests/InterestsScreen.kt @@ -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, diff --git a/feature/interests/src/main/java/com/google/samples/apps/nowinandroid/feature/interests/InterestsViewModel.kt b/feature/interests/src/main/java/com/google/samples/apps/nowinandroid/feature/interests/InterestsViewModel.kt index 02d0c7bab..8466a33f0 100644 --- a/feature/interests/src/main/java/com/google/samples/apps/nowinandroid/feature/interests/InterestsViewModel.kt +++ b/feature/interests/src/main/java/com/google/samples/apps/nowinandroid/feature/interests/InterestsViewModel.kt @@ -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 = _tabState.asStateFlow() - val uiState: StateFlow = getFollowableTopics(sortBy = TopicSortField.NAME).map( InterestsUiState::Interests @@ -62,11 +52,6 @@ class InterestsViewModel @Inject constructor( } } -data class InterestsTabState( - val titles: List, - val currentIndex: Int -) - sealed interface InterestsUiState { object Loading : InterestsUiState diff --git a/feature/interests/src/main/res/values/strings.xml b/feature/interests/src/main/res/values/strings.xml index d1c46a28d..f4496265d 100644 --- a/feature/interests/src/main/res/values/strings.xml +++ b/feature/interests/src/main/res/values/strings.xml @@ -17,8 +17,6 @@ Interests - Topics - People Loading data "No available data" Follow interest button