Skip to content

Commit

Permalink
Data object
Browse files Browse the repository at this point in the history
  • Loading branch information
Syer10 committed Dec 2, 2023
1 parent 996dca6 commit b931d0f
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class UpdateChecker
val release: GithubRelease,
) : Update()

object NoUpdatesFound : Update()
data object NoUpdatesFound : Update()
}

// Thanks to Tachiyomi for inspiration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import org.lighthousegames.logging.logging
@Stable
sealed class LibraryState {
@Stable
object Loading : LibraryState()
data object Loading : LibraryState()

@Stable
data class Failed(
Expand All @@ -70,7 +70,7 @@ sealed class LibraryState {
@Stable
sealed class CategoryState {
@Stable
object Loading : CategoryState()
data object Loading : CategoryState()

@Stable
data class Failed(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ abstract class PageLoader {
}

sealed class PagesState {
object Loading : PagesState()
data object Loading : PagesState()

data class Success(
val pages: List<ReaderPage>,
) : PagesState()

object Empty : PagesState()
data object Empty : PagesState()
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ package ca.gosyer.jui.ui.reader.model
sealed class Navigation(
val name: String,
) {
object MENU : Navigation("Menu")
data object MENU : Navigation("Menu")

object PREV : Navigation("Prev")
data object PREV : Navigation("Prev")

object NEXT : Navigation("Next")
data object NEXT : Navigation("Next")

object LEFT : Navigation("Left")
data object LEFT : Navigation("Left")

object RIGHT : Navigation("Right")
data object RIGHT : Navigation("Right")

object UP : Navigation("Up")
data object UP : Navigation("Up")

object DOWN : Navigation("Down")
data object DOWN : Navigation("Down")
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ data class ReaderChapter(
}

sealed class State {
object Wait : State()
data object Wait : State()

object Loading : State()
data object Loading : State()

class Error(
val error: Throwable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ data class ReaderPage(
) : ImageDecodeState()

@Immutable
object UnknownDecoder : ImageDecodeState()
data object UnknownDecoder : ImageDecodeState()

@Immutable
object FailedToGetSnapShot : ImageDecodeState()
data object FailedToGetSnapShot : ImageDecodeState()

@Immutable
data class FailedToDecode(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,15 @@ class SettingsBackupViewModel
}

sealed class Status {
object Nothing : Status()
data object Nothing : Status()

data class InProgress(
val progress: Float?,
) : Status()

object Success : Status()
data object Success : Status()

object Error : Status()
data object Error : Status()
}

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ sealed class SourceFiltersView<T, R : Any?> {
}
}

@Suppress("FunctionName")
fun SourceFiltersView(
index: Int,
sourceFilter: SourceFilter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ private fun SourceNavigatorDisposableEffect(navigator: SourcesNavigator) {
}

sealed class SourceNavigatorScreen {
object HomeScreen : SourceNavigatorScreen()
data object HomeScreen : SourceNavigatorScreen()

object SearchScreen : SourceNavigatorScreen()
data object SearchScreen : SourceNavigatorScreen()

data class SourceScreen(
val source: Source,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class GlobalSearchViewModel
)

sealed class Search {
object Searching : Search()
data object Searching : Search()

data class Success(
val mangaList: ImmutableList<Manga>,
Expand Down

0 comments on commit b931d0f

Please sign in to comment.