Browse Source

Add OCNotificationsAction

Marino Faggiana 8 years ago
parent
commit
9865ca45cc

+ 14 - 3
Libraries external/OCCommunicationLib/OCCommunicationLib/OCCommunication.m

@@ -1339,13 +1339,24 @@
                     notification.link = [data valueForKey:@"link"];
                     notification.link = [data valueForKey:@"link"];
                     notification.icon = [data valueForKey:@"icon"];
                     notification.icon = [data valueForKey:@"icon"];
                     
                     
-                    NSArray *actions = [[NSArray alloc] initWithObjects: [data valueForKey:@"actions"], nil ];
+                    /* ACTION */
                     
                     
-                    for (NSDictionary *action in actions) {
+                    NSMutableArray *actionsArr = [NSMutableArray new];
+                    NSDictionary *actionsDic = [data valueForKey:@"actions"];
+                    
+                    for (NSDictionary *actionDic in actionsDic) {
+                        
+                        OCNotificationsAction *notificationAction = [OCNotificationsAction new];
                         
                         
+                        notificationAction.label = [actionDic valueForKey:@"label"];
+                        notificationAction.link = [actionDic valueForKey:@"link"];
+                        notificationAction.primary = [[actionDic valueForKey:@"primary"] boolValue];
+                        notificationAction.type = [actionDic valueForKey:@"type"];
+
+                        [actionsArr addObject:notificationAction];
                     }
                     }
                     
                     
-                    
+                    notification.actions = [[NSArray alloc] initWithArray:actionsArr];
                     [listOfNotifications addObject:notification];
                     [listOfNotifications addObject:notification];
                 }
                 }
                 
                 

+ 1 - 1
Libraries external/OCCommunicationLib/OCCommunicationLib/OCNotificationsAction.h

@@ -12,7 +12,7 @@
 
 
 @property (nonatomic, strong) NSString *label;
 @property (nonatomic, strong) NSString *label;
 @property (nonatomic, strong) NSString *link;
 @property (nonatomic, strong) NSString *link;
-@property (nonatomic, strong) NSString *type;
 @property BOOL primary;
 @property BOOL primary;
+@property (nonatomic, strong) NSString *type;
 
 
 @end
 @end