public void destroyDirectMessage(final long id) { dataManager .destroyDirectMessage(id) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe( new Completable.CompletableSubscriber() { @Override public void onCompleted() { getMvpView().messageDestroyed(id); } @Override public void onError(Throwable e) { Timber.e(e, ""); } @Override public void onSubscribe(Subscription d) {} }); }
public void sendDirectMessage(long userID, String message) { dataManager .sendDirectMessage(userID, message) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe( new Subscriber<DirectMessage>() { @Override public void onCompleted() {} @Override public void onError(Throwable e) { Timber.e(e, ""); getMvpView().errorSending(); } @Override public void onNext(DirectMessage directMessage) { getMvpView().messageSent(directMessage); } }); }