in app/src/main/java/org/apache/fineract/ui/online/login/LoginPresenter.java [63:115]
public void login(String username, String password) {
checkViewAttached();
getMvpView().showProgressDialog();
compositeDisposable.add(dataManagerAuth.login(username, password)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribeWith(new DisposableObserver<Authentication>() {
@Override
public void onNext(Authentication user) {
getMvpView().hideProgressDialog();
getMvpView().showUserLoginSuccessfully(user);
}
@Override
public void onError(Throwable throwable) {
getMvpView().hideProgressDialog();
if (throwable instanceof NoConnectivityException) {
getMvpView().showNoInternetConnection();
} else {
MifosError mifosError = new MifosError();
Converter<ResponseBody, MifosError> errorConverter =
retrofit.responseBodyConverter(MifosError.class,
new Annotation[0]);
if (throwable instanceof HttpException) {
HttpException httpException = (HttpException) throwable;
Response response = httpException.response();
if (response.errorBody() != null) {
try {
mifosError = errorConverter.convert(response.errorBody());
} catch (IOException e) {
Log.d(LOG_TAG, e.getLocalizedMessage());
}
}
if (mifosError.getMessage() == null) {
getMvpView().showError(
context.getString(R.string.wrong_username_or_password));
} else {
getMvpView().showError(mifosError.getMessage());
}
}
}
}
@Override
public void onComplete() {
}
})
);
}