diff options
author | Mikkel Krautz <mikkel@krautz.dk> | 2013-06-02 22:09:23 +0400 |
---|---|---|
committer | Mikkel Krautz <mikkel@krautz.dk> | 2013-06-02 22:09:23 +0400 |
commit | eee9855d917662298bb9260ad638ae6570d576a0 (patch) | |
tree | 9782815a9f23df8615217ad54845abcf96fb2fd8 | |
parent | 6071e185bd927dae8b07431b57025004ad927757 (diff) |
MUMessagesViewController: ensure notifications from the server look correct; don't leak notification object.
-rw-r--r-- | Source/Classes/MUMessagesViewController.m | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/Classes/MUMessagesViewController.m b/Source/Classes/MUMessagesViewController.m index c0a74c0..da69623 100644 --- a/Source/Classes/MUMessagesViewController.m +++ b/Source/Classes/MUMessagesViewController.m @@ -535,7 +535,7 @@ UIApplication *app = [UIApplication sharedApplication]; if ([app applicationState] == UIApplicationStateBackground) { - UILocalNotification *notification = [[UILocalNotification alloc] init]; + UILocalNotification *notification = [[[UILocalNotification alloc] init] autorelease]; NSMutableCharacterSet *trimSet = [[NSMutableCharacterSet alloc] init]; [trimSet formUnionWithCharacterSet:[NSCharacterSet whitespaceCharacterSet]]; @@ -556,7 +556,12 @@ msgText = [msg plainTextString]; } - notification.alertBody = [NSString stringWithFormat:@"%@ - %@", [user userName], msgText]; + if (user == nil) { + notification.alertBody = msgText; + } else { + notification.alertBody = [NSString stringWithFormat:@"%@ - %@", [user userName], msgText]; + } + [notification.userInfo setValue:indexPath forKey:@"indexPath"]; [app presentLocalNotificationNow:notification]; [app setApplicationIconBadgeNumber:[app applicationIconBadgeNumber]+1]; |