Created
August 21, 2017 17:25
-
-
Save joecks/3a6ad5d3544d2af1c8a31692dcc7727d to your computer and use it in GitHub Desktop.
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
class MainViewModel : BaseReactViewModel<Data>(), TasksActions, AddEditActions { | |
override val initialViewData = TasksData | |
override fun onSaveTask() { | |
updateViewData(TasksData) | |
} | |
override fun onTaskDetails(taskId: String) { | |
updateViewData(EditTaskData(taskId)) | |
} | |
override fun onNewTask() { | |
updateViewData(NewTaskData) | |
} | |
fun onBackPress(): Boolean { | |
return when (viewData.value) { | |
NewTaskData, is EditTaskData -> { | |
updateViewData(TasksData) | |
true | |
} | |
else -> false | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment