Search in sources :

Example 1 with ToggleDislikeMutation

use of com.example.aleksejkocergin.myapplication.ToggleDislikeMutation in project RandomWebm by alkocher.

the class ToggleVotesUtil method toggleDislike.

public void toggleDislike(String webmId, boolean hasLike, boolean hasDislike) {
    ApolloMutationCall<ToggleDislikeMutation.Data> dislikeMutationCall = WebmApolloClient.getWebmApolloClient().mutate(new ToggleDislikeMutation(webmId, hasLike, hasDislike));
    mDisposable.add(Rx2Apollo.from(dislikeMutationCall).observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io()).subscribeWith(new DisposableObserver<Response<ToggleDislikeMutation.Data>>() {

        @Override
        public void onNext(Response<ToggleDislikeMutation.Data> dataResponse) {
        }

        @Override
        public void onError(Throwable e) {
            webmData.showErrorSnackbar();
        }

        @Override
        public void onComplete() {
            webmData.showSuccessSnackbar();
        }
    }));
}
Also used : Response(com.apollographql.apollo.api.Response) DisposableObserver(io.reactivex.observers.DisposableObserver) WebmData(com.example.aleksejkocergin.randomwebm.interfaces.WebmData) ToggleDislikeMutation(com.example.aleksejkocergin.myapplication.ToggleDislikeMutation)

Aggregations

Response (com.apollographql.apollo.api.Response)1 ToggleDislikeMutation (com.example.aleksejkocergin.myapplication.ToggleDislikeMutation)1 WebmData (com.example.aleksejkocergin.randomwebm.interfaces.WebmData)1 DisposableObserver (io.reactivex.observers.DisposableObserver)1