Last active
February 12, 2019 17:24
-
-
Save gilgoldzweig/a4961d19ed6ef052db1caa35b593c80f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
open class ExamplePresenter : ExampleContract.Presenter { | |
var view: ExampleContract.View? = null | |
override fun attach(view: ExampleContract.View) { | |
this.view = view | |
} | |
override fun fetchProfileName() { | |
val name: String | |
try { | |
name = fetchProfileNameFromRepository() | |
} catch (io: IOException) { | |
view?.onProfileNameRequestFailed(io) | |
return | |
} | |
view?.onProfileNameReceived(name) | |
} | |
open fun fetchProfileNameFromRepository(): String { | |
//Long operation that calls the repository and return the name or throws an exception | |
} | |
override fun detach() { | |
view = null | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment