Skip to content

Commit 6388014

Browse files
committed
parse action icons from the notification payload
1 parent c98b1f8 commit 6388014

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

iOS_SDK/OneSignalSDK/Source/OSNotification.m

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,20 @@ - (void)parseActionButtons:(NSArray<NSDictionary*>*)buttons {
169169
continue;
170170
}
171171

172-
[buttonArray addObject: @{
173-
@"text" : button[@"n"],
174-
@"id" : (button[@"i"] ?: button[@"n"])
175-
}];
172+
NSMutableDictionary *actionDict = [NSMutableDictionary new];
173+
actionDict[@"text"] = button[@"n"];
174+
actionDict[@"id"] = button[@"i"] ?: button[@"n"];
175+
176+
// Parse Action Icon into system or template icon
177+
if (button[@"icon_type"] && button[@"path"]) {
178+
if ([button[@"icon_type"] isEqualToString:@"system"]) {
179+
actionDict[@"systemIcon"] = button[@"path"];
180+
} else if ([button[@"icon_type"] isEqualToString:@"custom"]) {
181+
actionDict[@"templateIcon"] = button[@"path"];
182+
}
183+
}
184+
185+
[buttonArray addObject: actionDict];
176186
}
177187

178188
_actionButtons = buttonArray;

0 commit comments

Comments
 (0)