Convert 'sealed' sub-object to 'data object'

pull/872/head
Simon Marquis 1 year ago
parent a3ee09ec3e
commit b7799f0475

@ -43,6 +43,6 @@ class MainActivityViewModel @Inject constructor(
} }
sealed interface MainActivityUiState { sealed interface MainActivityUiState {
object Loading : MainActivityUiState data object Loading : MainActivityUiState
data class Success(val userData: UserData) : MainActivityUiState data class Success(val userData: UserData) : MainActivityUiState
} }

@ -24,7 +24,7 @@ import kotlinx.coroutines.flow.onStart
sealed interface Result<out T> { sealed interface Result<out T> {
data class Success<T>(val data: T) : Result<T> data class Success<T>(val data: T) : Result<T>
data class Error(val exception: Throwable? = null) : Result<Nothing> data class Error(val exception: Throwable? = null) : Result<Nothing>
object Loading : Result<Nothing> data object Loading : Result<Nothing>
} }
fun <T> Flow<T>.asResult(): Flow<Result<T>> { fun <T> Flow<T>.asResult(): Flow<Result<T>> {

@ -112,7 +112,7 @@ sealed interface NewsFeedUiState {
/** /**
* The feed is still loading. * The feed is still loading.
*/ */
object Loading : NewsFeedUiState data object Loading : NewsFeedUiState
/** /**
* The feed is loaded with the given list of news resources. * The feed is loaded with the given list of news resources.

@ -25,17 +25,17 @@ sealed interface OnboardingUiState {
/** /**
* The onboarding state is loading. * The onboarding state is loading.
*/ */
object Loading : OnboardingUiState data object Loading : OnboardingUiState
/** /**
* The onboarding state was unable to load. * The onboarding state was unable to load.
*/ */
object LoadFailed : OnboardingUiState data object LoadFailed : OnboardingUiState
/** /**
* There is no onboarding state. * There is no onboarding state.
*/ */
object NotShown : OnboardingUiState data object NotShown : OnboardingUiState
/** /**
* There is a onboarding state, with the given lists of topics. * There is a onboarding state, with the given lists of topics.

@ -53,11 +53,11 @@ class InterestsViewModel @Inject constructor(
} }
sealed interface InterestsUiState { sealed interface InterestsUiState {
object Loading : InterestsUiState data object Loading : InterestsUiState
data class Interests( data class Interests(
val topics: List<FollowableTopic>, val topics: List<FollowableTopic>,
) : InterestsUiState ) : InterestsUiState
object Empty : InterestsUiState data object Empty : InterestsUiState
} }

Loading…
Cancel
Save