Skip to content

Commit

Permalink
Use blocks to define the onSaveSuperHero function so that later on da…
Browse files Browse the repository at this point in the history
…ta binding we don't have to change the function that much
  • Loading branch information
Serchinastico committed Jan 30, 2019
1 parent df7b20c commit 90e51ee
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,21 @@ class EditSuperHeroPresenter(
name: String,
description: String,
isAvenger: Boolean
) = launch {
view?.showLoading()
val superHero = this@EditSuperHeroPresenter.superHero ?: return@launch
async {
saveSuperHero(
superHero.copy(
name = name,
description = description,
isAvenger = isAvenger
) {
launch {
view?.showLoading()
val superHero = this@EditSuperHeroPresenter.superHero ?: return@launch
async {
saveSuperHero(
superHero.copy(
name = name,
description = description,
isAvenger = isAvenger
)
)
)
}
view?.close()
}
view?.close()
}

private fun refreshSuperHero() = launch {
Expand Down

0 comments on commit 90e51ee

Please sign in to comment.