Skip to content

Instantly share code, notes, and snippets.

@vicky7230
Created August 13, 2018 07:53
Show Gist options
  • Save vicky7230/9709e17565a7291a6fdd528f1c135582 to your computer and use it in GitHub Desktop.
Save vicky7230/9709e17565a7291a6fdd528f1c135582 to your computer and use it in GitHub Desktop.
commonApiService.sendOtp(phone)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(login -> {
if (!isViewAttached()) {
return;
}
getMvpView().hideLoading();
if (login != null && login.getSuccess() != null) {
if (login.getSuccess()) {
getMvpView().showMessage(login.getMessage());
getMvpView().launchVerifyOtpActivityWithPhone();
} else {
getMvpView().showError(login.getMessage());
}
}
}, throwable -> {
if (!isViewAttached()) {
return;
}
getMvpView().hideLoading();
Timber.e(throwable);
getMvpView().showError(throwable.getMessage());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment