aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel Handford2016-05-16 15:16:21 -0700
committerGabriel Handford2016-05-16 15:16:21 -0700
commit3ce551119129eb33d57ef8c612d1f4df93b0fa26 (patch)
tree78c6ea1c3183994e4dda59d3bc8e22c925a283c6
parentabdbf886c96d0390fd582fd7a4e9e2924c9ed740 (diff)
downloadgo-notifier-3ce551119129eb33d57ef8c612d1f4df93b0fa26.tar.bz2
Write to stdout instead of using NSLog
-rw-r--r--notifier_darwin.m8
1 files changed, 3 insertions, 5 deletions
diff --git a/notifier_darwin.m b/notifier_darwin.m
index 1baf885..0933042 100644
--- a/notifier_darwin.m
+++ b/notifier_darwin.m
@@ -100,10 +100,8 @@ CFStringRef deliverNotification(CFStringRef titleRef, CFStringRef subtitleRef, C
});
}
-- (NSString *)JSON:(NSDictionary *)dict {
- NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict options:0 error:nil];
- if (!jsonData) return @"";
- return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
+- (NSData *)JSONData:(NSDictionary *)dict {
+ return [NSJSONSerialization dataWithJSONObject:dict options:0 error:nil];
}
- (void)userNotificationCenter:(NSUserNotificationCenter *)center didDeliverNotification:(NSUserNotification *)userNotification {
@@ -136,7 +134,7 @@ CFStringRef deliverNotification(CFStringRef titleRef, CFStringRef subtitleRef, C
} else {
action = userNotification.actionButtonTitle;
}
- NSLog(@"%@", [self JSON:@{@"action": action}]);
+ [[NSFileHandle fileHandleWithStandardOutput] writeData:[self JSONData:@{@"action": action}]];
break;
}
case NSUserNotificationActivationTypeContentsClicked: