Skip to content

Instantly share code, notes, and snippets.

@jcaiqueoliveira
Created January 16, 2017 15:58
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 jcaiqueoliveira/801b4e2112658eb450c3c744400bf51c to your computer and use it in GitHub Desktop.
Save jcaiqueoliveira/801b4e2112658eb450c3c744400bf51c to your computer and use it in GitHub Desktop.
class HistoryPresenter @Inject constructor(var paymentManager: PaymentRepository) : HistoryContract.Presenter {
lateinit var context: Context
lateinit var view: HistoryContract.View
override fun bindView(context: Context, view: HistoryContract.View) {
this.context = context
this.view = view
}
override fun loadHistory() {
view.showWaitingDialog()
paymentManager.getHistory(HistoryRequest())
.subscribe({ response ->
if (response.code() == 200) {
view.showHistoryPayment(response.body())
} else {
view.showMessageError(context.getString(R.string.error_msg_generic))
}
}, Throwable::printStackTrace)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment