Skip to content

Instantly share code, notes, and snippets.

NotificationDataModel *model = [jsonDictionary isc_objectFromJSONWithClass:[NotificationDataModel class]];
[self updateNotificationCount:model.toast.notificationNumber];
@interface NotificationDataModel
@property (nonatomic, strong) NotificationToastModel *toast;
@property (nonatomic) BOOL updateBadge;
@property (nonatomic, strong) NSString *updateBadge;
@property (nonatomic) NSInteger connectionDistance;
@end
@interface NotificationToastModel
{
"toast": {
notificationNumber: 3,
notificationText: "John Appleseed invited you to connect"
},
"updateBadge": true,
"memberId": "134241252",
"connectionDistance": 3
}
- (NSInteger)badgeNumberForNotificationsJson:(NotificationsDataModel *)model {
return model.toast.notificationNumber;
}
- (NSNumber *)badgeNumberForNotificationsJson:(NSDictionary *)json {
return ([[json dictionaryForKey:kToast] numberForKey:kNotificationNumber]);
}
- (NSNumber *)badgeNumberForNotificationsJson:(NSDictionary *)json {
return ([[json objectForKey:kToast] objectForKey:kNotificationNumber]);
}