Created
April 1, 2018 12:31
-
-
Save monday8am/98aaf7290f2af3c0b1dc410d6257bb80 to your computer and use it in GitHub Desktop.
Delivery state described in Kotlin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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