Skip to content

Instantly share code, notes, and snippets.

@ch8n
Created February 1, 2022 18:32
Show Gist options
  • Save ch8n/27de736a560741d996b7e08259573ccf to your computer and use it in GitHub Desktop.
Save ch8n/27de736a560741d996b7e08259573ccf to your computer and use it in GitHub Desktop.
Sealed class for Download Manager Status
sealed class DownloadManagerStatus {
sealed class DownloadStatus : DownloadManagerStatus() {
sealed class StatusPaused : DownloadStatus() {
object QueuedForWifi : StatusPaused()
object WaitingForNetwork : StatusPaused()
object WaitingToRetry : StatusPaused()
object Unknown : StatusPaused()
}
sealed class StatusFailed : DownloadStatus() {
object CannotResume : StatusFailed()
object DeviceNotFound : StatusFailed()
object FileAlreadyExists : StatusFailed()
object FileError : StatusFailed()
object HttpDataError : StatusFailed()
object InsufficientSpace : StatusFailed()
object TooManyRedirects : StatusFailed()
object UnhandledHttpCode : StatusFailed()
object Unknown : StatusFailed()
}
object StatusSuccessful : DownloadStatus()
object StatusRunning : DownloadStatus()
object StatusPending : DownloadStatus()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment