From f54c7ed5d3d914425e5ba25e1de42c12a66e1b52 Mon Sep 17 00:00:00 2001 From: Nightonke Date: Fri, 17 Mar 2017 13:54:59 +0800 Subject: [PATCH] 1. Fixed issue #12. --- VHGithubNotifier/Info.plist | 4 ++-- .../VHGithubNotifierManager+UserNotification.m | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/VHGithubNotifier/Info.plist b/VHGithubNotifier/Info.plist index c587e7b..98daacf 100644 --- a/VHGithubNotifier/Info.plist +++ b/VHGithubNotifier/Info.plist @@ -19,9 +19,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0.2 + 1.0.2.1 CFBundleVersion - 1020 + 1021 LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) LSUIElement diff --git a/VHGithubNotifier/Model/Manager/VHGithubNotifierManager+UserNotification.m b/VHGithubNotifier/Model/Manager/VHGithubNotifierManager+UserNotification.m index b800916..f0721ff 100644 --- a/VHGithubNotifier/Model/Manager/VHGithubNotifierManager+UserNotification.m +++ b/VHGithubNotifier/Model/Manager/VHGithubNotifierManager+UserNotification.m @@ -35,10 +35,20 @@ - (void)addNotifications:(NSArray *)notifications userNotification.title = notification.repository.fullName; userNotification.subtitle = notification.title; userNotification.informativeText = [notification toNowTimeString]; - userNotification.userInfo = @{@"type":@(VHGithubUserNotificationTypeNotification), - @"url":notification.htmlUrl, - @"notificationId":@(notification.notificationId), - @"latestUpdateTime":notification.updateDate}; + NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithCapacity:4]; + [userInfo setObject:@(VHGithubUserNotificationTypeNotification) forKey:@"type"]; + if (notification.htmlUrl) + { + [userInfo setObject:notification.htmlUrl forKey:@"url"]; + } + if (notification.notificationId) + { + [userInfo setObject:@(notification.notificationId) forKey:@"notificationId"]; + } + if (notification.updateDate) + { + [userInfo setObject:notification.updateDate forKey:@"latestUpdateTime"]; + } userNotification.hasActionButton = NO; userNotification.feature.bannerImage = [VHUtils imageFromNotificationType:notification.type]; [[self userNotifications] push:userNotification];