use of com.apollographql.apollo.sample.RepoCommentAddedSubscription in project apollo-android by apollographql.
the class GitHuntEntryDetailActivity method subscribeRepoCommentAdded.
private void subscribeRepoCommentAdded() {
ApolloSubscriptionCall<RepoCommentAddedSubscription.Data> subscriptionCall = application.apolloClient().subscribe(new RepoCommentAddedSubscription(repoFullName));
disposables.add(Rx2Apollo.from(subscriptionCall).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribeWith(new DisposableSubscriber<Response<RepoCommentAddedSubscription.Data>>() {
@Override
public void onNext(Response<RepoCommentAddedSubscription.Data> response) {
commentsListViewAdapter.addItem(response.data().commentAdded().content());
}
@Override
public void onError(Throwable e) {
Log.e(TAG, e.getMessage(), e);
}
@Override
public void onComplete() {
Log.d(TAG, "Subscription exhausted");
}
}));
}
Aggregations