use of com.meisolsson.githubsdk.model.request.NotificationReadRequest in project gh4a by slapperwan.
the class NotificationHandlingService method markNotificationAsRead.
private void markNotificationAsRead(String repoOwner, String repoName, long timestamp) {
NotificationService service = ServiceFactory.get(NotificationService.class, false);
NotificationReadRequest request = NotificationReadRequest.builder().lastReadAt(new Date(timestamp)).build();
try {
service.markAllRepositoryNotificationsRead(repoOwner, repoName, request).blockingGet();
} catch (Exception e) {
Log.w(Gh4Application.LOG_TAG, "Could not mark repo \"" + repoOwner + "/" + repoName + "\" as read", e);
}
}
use of com.meisolsson.githubsdk.model.request.NotificationReadRequest in project gh4a by slapperwan.
the class NotificationListFragment method markAsRead.
private void markAsRead(Repository repository, NotificationThread notification) {
NotificationService service = ServiceFactory.get(NotificationService.class, false);
final Single<Response<Void>> responseSingle;
if (notification != null) {
responseSingle = service.markNotificationRead(notification.id());
} else {
NotificationReadRequest request = NotificationReadRequest.builder().lastReadAt(mNotificationsLoadTime).build();
if (repository != null) {
responseSingle = service.markAllRepositoryNotificationsRead(repository.owner().login(), repository.name(), request);
} else {
responseSingle = service.markAllNotificationsRead(request);
}
}
responseSingle.map(ApiHelpers::mapToBooleanOrThrowOnFailure).compose(RxUtils::doInBackground).subscribe(result -> handleMarkAsRead(repository, notification), error -> handleActionFailure("Mark notifications as read failed", error));
}
Aggregations