Skip to content

Instantly share code, notes, and snippets.

@monday8am
Created April 1, 2018 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save monday8am/98aaf7290f2af3c0b1dc410d6257bb80 to your computer and use it in GitHub Desktop.
Save monday8am/98aaf7290f2af3c0b1dc410d6257bb80 to your computer and use it in GitHub Desktop.
Delivery state described in Kotlin
sealed class DeliveryState: StateType {
object NotStarted: DeliveryState()
data class SettingUp (val appId: AppId,
val serviceId: ServiceId,
val description: ServiceDescription? = null): DeliveryState()
data class Going (val progress: DeliveryProgress): DeliveryState()
data class IsIdle (val reason: Idle): DeliveryState()
data class Failed (val error: Throwable): DeliveryState()
data class Finished (val status: ServiceStatus): DeliveryState()
sealed class Idle {
object WaitingForConnection: Idle()
object WaitingForServerResponse : Idle()
object WaitingForNetworkConnection: Idle()
data class WaitingForReconnect constructor (val deviceId: DeviceId) : Idle()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment