@@ -3150,13 +3150,78 @@ - (void)testParseNotificationTemplateActionIconJson {
31503150 @" i" : @" id1" ,
31513151 @" n" : @" text1" ,
31523152 @" path" : @" myImage/thumbsup" ,
3153- @" icon_type" : @" template "
3153+ @" icon_type" : @" custom "
31543154 }]
31553155 }};
31563156 OSNotification *notification = [OSNotification parseWithApns: aps];
31573157 XCTAssertEqualObjects (notification.actionButtons [0 ][@" templateIcon" ], @" myImage/thumbsup" );
31583158}
31593159
3160+ - (void )testCreateActionForButtonsWithIcon {
3161+ if (@available (iOS 15.0 , *)) {
3162+ NSDictionary *aps = @{
3163+ @" aps" : @{
3164+ @" content-available" : @1 ,
3165+ @" mutable-content" : @1 ,
3166+ @" alert" : @" Message Body" ,
3167+ },
3168+ @" os_data" : @{
3169+ @" i" : @" notif id" ,
3170+ @" ti" : @" templateId123" ,
3171+ @" tn" : @" Template name" ,
3172+ @" buttons" : @[@{
3173+ @" i" : @" id1" ,
3174+ @" n" : @" text1" ,
3175+ @" path" : @" myImage/thumbsup" ,
3176+ @" icon_type" : @" custom"
3177+ }]
3178+ }};
3179+ OSNotification *notification = [OSNotification parseWithApns: aps];
3180+ UNNotificationAction *action = [OneSignalHelper createActionForButton: notification.actionButtons[0 ]];
3181+ XCTAssertNotNil (action.icon );
3182+
3183+ aps = @{
3184+ @" aps" : @{
3185+ @" content-available" : @1 ,
3186+ @" mutable-content" : @1 ,
3187+ @" alert" : @" Message Body" ,
3188+ },
3189+ @" os_data" : @{
3190+ @" i" : @" notif id" ,
3191+ @" ti" : @" templateId123" ,
3192+ @" tn" : @" Template name" ,
3193+ @" buttons" : @[@{
3194+ @" i" : @" id1" ,
3195+ @" n" : @" text1" ,
3196+ @" path" : @" hand.thumbsup" ,
3197+ @" icon_type" : @" system"
3198+ }]
3199+ }};
3200+ notification = [OSNotification parseWithApns: aps];
3201+ action = [OneSignalHelper createActionForButton: notification.actionButtons[0 ]];
3202+ XCTAssertNotNil (action.icon );
3203+
3204+ aps = @{
3205+ @" aps" : @{
3206+ @" content-available" : @1 ,
3207+ @" mutable-content" : @1 ,
3208+ @" alert" : @" Message Body" ,
3209+ },
3210+ @" os_data" : @{
3211+ @" i" : @" notif id" ,
3212+ @" ti" : @" templateId123" ,
3213+ @" tn" : @" Template name" ,
3214+ @" buttons" : @[@{
3215+ @" i" : @" id1" ,
3216+ @" n" : @" text1"
3217+ }]
3218+ }};
3219+ notification = [OSNotification parseWithApns: aps];
3220+ action = [OneSignalHelper createActionForButton: notification.actionButtons[0 ]];
3221+ XCTAssertNil (action.icon );
3222+ }
3223+ }
3224+
31603225- (void )testNotificationJson {
31613226 NSDictionary *aps = @{
31623227 @" aps" : @{
0 commit comments