Skip to content

Instantly share code, notes, and snippets.

@adevone
Last active December 4, 2020 17:16
Show Gist options
  • Save adevone/5dee7128b2a809e6109a9a0ea3d6795e to your computer and use it in GitHub Desktop.
Save adevone/5dee7128b2a809e6109a9a0ea3d6795e to your computer and use it in GitHub Desktop.
interface LoginByPhoneView {
var viewState: LoginByPhoneState
}
enum class LoginByPhoneState {
Request,
Confirm
}
class LoginByPhonePresenter : SummerViewModel<LoginByPhoneView>() {
override val viewProxy = object : LoginByPhoneView {
override var viewState by state({ it::viewState }, initial = LoginByPhoneState.Request)
}
fun onRequestCodeClick() {
launch {
val code = requestCodeRepository.execute()
viewProxy.viewState = LoginByPhoneState.Confirm
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment