Merge pull request #872 from SimonMarquis/data-objects

Convert 'sealed' sub-object to 'data object'
pull/889/head
Don Turner 1 year ago committed by GitHub
commit 8901e5932a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

@ -24,7 +24,7 @@ import kotlinx.coroutines.flow.onStart
sealed interface Result<out T> {
data class Success<T>(val data: T) : Result<T>
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>> {

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

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

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

Loading…
Cancel
Save