Skip to content
Browse files

Add bindings to Notification

  • Loading branch information...
1 parent 4bd4bf8 commit 187802406aa0a665d57365bde8494e0b6494f0e5 @henrikhodne henrikhodne committed Nov 30, 2012
Showing with 10 additions and 14 deletions.
  1. +10 −14 src/Notification.m
View
24 src/Notification.m
@@ -8,6 +8,7 @@
#import "Notification.h"
+#import <ReactiveCocoa/ReactiveCocoa.h>
#import "TravisEvent.h"
@interface Notification ()
@@ -40,30 +41,25 @@ - (id)initWithEventData:(TravisEvent *)eventData {
_eventData = eventData;
- return self;
-}
-
-- (NSNumber *)uniqueID {
- return [[self eventData] buildID];
-}
+ [self setupBindings];
-- (NSString *)title {
- return [[self eventData] name];
+ return self;
}
-- (NSString *)subtitle {
- return [NSString stringWithFormat:@"Build #%@", [[self eventData] buildNumber]];
+- (void)setupBindings {
+ RAC(self.uniqueID) = RACAbleWithStart(self.eventData.buildID);
+ RAC(self.title) = RACAbleWithStart(self.eventData.name);
+ RAC(self.subtitle) = [RACAbleWithStart(self.eventData.buildNumber) map:^(NSNumber *buildNumber) {
+ return [NSString stringWithFormat:@"Build #%@", buildNumber];
+ }];
+ RAC(self.URL) = RACAbleWithStart(self.eventData.url);
}
- (NSString *)informativeText {
NSAssert(NO, @"Method informativeText not implemented on %@", self);
return nil;
}
-- (NSString *)URL {
- return [[self eventData] url];
-}
-
@end
@implementation BuildStartedNotification

0 comments on commit 1878024

Please sign in to comment.
Something went wrong with that request. Please try again.