Skip to content

Commit c34e0af

Browse files
committed
Mark as read based on URL too
This is mostly because NSUserNotificationCenter doesn't let you store any non-plist types in a userInfo dictionary.
1 parent 0c30761 commit c34e0af

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

OctoKit/OCTClient.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,13 @@ extern NSString * const OCTClientErrorHTTPStatusCodeKey;
254254
// `authenticated`, the signal will error immediately.
255255
- (RACSignal *)fetchNotificationsNotMatchingEtag:(NSString *)etag includeReadNotifications:(BOOL)includeRead updatedSince:(NSDate *)since;
256256

257-
// Mark the notification has having been read.
257+
// Mark a notification thread as having been read.
258258
//
259-
// notification - The notification to mark as read. Cannot be nil.
259+
// threadURL - The API URL of the thread to mark as read. Cannot be nil.
260260
//
261261
// Returns a signal which will send completed on success. If the client is not
262262
// `authenticated`, the signal will error immediately.
263-
- (RACSignal *)markNotificationAsRead:(OCTNotification *)notification;
263+
- (RACSignal *)markNotificationThreadAsReadAtURL:(NSURL *)threadURL;
264264

265265
// Mutes all further notifications from a thread.
266266
//

OctoKit/OCTClient.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -531,17 +531,17 @@ - (RACSignal *)fetchNotificationsNotMatchingEtag:(NSString *)etag includeReadNot
531531
return [self enqueueRequest:request resultClass:OCTNotification.class];
532532
}
533533

534-
- (RACSignal *)markNotificationAsRead:(OCTNotification *)notification {
535-
return [self patchNotification:notification withReadStatus:YES];
534+
- (RACSignal *)markNotificationThreadAsReadAtURL:(NSURL *)threadURL {
535+
return [self patchThreadURL:threadURL withReadStatus:YES];
536536
}
537537

538-
- (RACSignal *)patchNotification:(OCTNotification *)notification withReadStatus:(BOOL)read {
539-
NSParameterAssert(notification != nil);
538+
- (RACSignal *)patchThreadURL:(NSURL *)threadURL withReadStatus:(BOOL)read {
539+
NSParameterAssert(threadURL != nil);
540540

541541
if (!self.authenticated) return [RACSignal error:self.class.authenticationRequiredError];
542542

543543
NSMutableURLRequest *request = [self requestWithMethod:@"PATCH" path:@"" parameters:@{ @"read": @(read) }];
544-
request.URL = notification.threadURL;
544+
request.URL = threadURL;
545545
return [[self enqueueRequest:request resultClass:nil] ignoreElements];
546546
}
547547

0 commit comments

Comments
 (0)