Skip to content

Instantly share code, notes, and snippets.

@esilverberg
Created November 24, 2020 15:19
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 esilverberg/a84eb6d11f520a76c74786beeb7b6d6c to your computer and use it in GitHub Desktop.
Save esilverberg/a84eb6d11f520a76c74786beeb7b6d6c to your computer and use it in GitHub Desktop.
// 🍎
enum MatchState {
case initial
case error(error: MatchError)
case loading
case started(stack: MatchStack)
case finished(moreStacksAvailable: Bool, canLoadMoreStacks: Bool, newStackAt: Date)
}
enum Event {
case mutualMatch(with: PSSUser)
case premiumRequired
case exitMatch
case visitLocationDiagnostics
case visitMutualMatches
}
// 🤖
sealed class MatchState {
object Initialized : MatchState()
class Error(val error: MatchError) : MatchState()
object Loading : MatchState()
class Started(val stack: MatchStack) : MatchState()
class Finished(val moreStacksAvailable: Boolean, val canLoadMoreStacks: Boolean, val newStackAt: Date) : MatchState()
}
sealed class Event {
class MutualMatch(val withProfile: Profile) : Event()
object PremiumRequired : Event()
object ExitMatch : Event()
object VisitLocationDiagnostics : Event()
object VisitMutualMatches : Event()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment