use of com.meisolsson.githubsdk.model.request.activity.SubscriptionRequest in project gh4a by slapperwan.
the class NotificationListFragment method unsubscribe.
@Override
public void unsubscribe(NotificationHolder notificationHolder) {
NotificationThread notification = notificationHolder.notification;
NotificationService service = ServiceFactory.get(NotificationService.class, false);
SubscriptionRequest request = SubscriptionRequest.builder().subscribed(false).build();
service.setNotificationThreadSubscription(notification.id(), request).map(ApiHelpers::throwOnFailure).compose(RxUtils::doInBackground).subscribe(result -> handleMarkAsRead(null, notification));
}
use of com.meisolsson.githubsdk.model.request.activity.SubscriptionRequest in project gh4a by slapperwan.
the class RepositoryActivity method toggleWatchingState.
private void toggleWatchingState() {
WatchingService service = ServiceFactory.get(WatchingService.class, false);
final Single<?> responseSingle;
if (mIsWatching) {
responseSingle = service.deleteRepositorySubscription(mRepoOwner, mRepoName).map(ApiHelpers::throwOnFailure);
} else {
SubscriptionRequest request = SubscriptionRequest.builder().subscribed(true).build();
responseSingle = service.setRepositorySubscription(mRepoOwner, mRepoName, request).map(ApiHelpers::throwOnFailure);
}
responseSingle.compose(RxUtils::doInBackground).subscribe(result -> {
if (mIsWatching != null) {
mIsWatching = !mIsWatching;
}
supportInvalidateOptionsMenu();
}, error -> {
handleActionFailure("Updating repo watching state failed", error);
supportInvalidateOptionsMenu();
});
}
Aggregations