use of com.xinshang.audient.model.entities.Feedback in project Audient by komamj.
the class FeedbackPresenter method sendFeedback.
@Override
public void sendFeedback(String title, String content) {
if (isInValid(title, content)) {
return;
}
if (mView.isActive()) {
mView.setLoadingIndicator(true);
}
Feedback feedback = new Feedback();
feedback.title = title;
feedback.content = content;
Disposable disposable = mRepository.sendFeedback(feedback).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribeWith(new DisposableSubscriber<ApiResponse>() {
@Override
public void onNext(ApiResponse apiResponse) {
if (apiResponse.resultCode == 0) {
mView.showSuccessfulMessage();
} else {
mView.showFailedMessage();
}
}
@Override
public void onError(Throwable t) {
LogUtils.e(TAG, "sendFeedback error : " + t.getMessage());
if (mView.isActive()) {
mView.setLoadingIndicator(false);
}
}
@Override
public void onComplete() {
if (mView.isActive()) {
mView.setLoadingIndicator(false);
}
}
});
mDisposables.add(disposable);
}
Aggregations