Skip to content

Commit f825ddb

Browse files
committed
add collapseId to OSNotification
1 parent 56a4d5f commit f825ddb

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

iOS_SDK/OneSignalSDK/Source/OSNotification.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ - (void)parseCommonOneSignalFields:(NSDictionary*)payload {
130130
_templateId = payload[@"ti"];
131131
_templateName = payload[@"tn"];
132132
_badgeIncrement = [payload[@"badge_inc"] integerValue];
133+
_collapseId = payload[@"collapse_id"];
133134
}
134135

135136
- (void)parseApnsFields {
@@ -216,7 +217,7 @@ - (void)parseOtherApnsFields {
216217
}
217218

218219
- (NSString *)description {
219-
return [NSString stringWithFormat: @"notificationId=%@ templateId=%@ templateName=%@ contentAvailable=%@ mutableContent=%@ category=%@ relevanceScore=%@ interruptionLevel=%@ rawPayload=%@", _notificationId, _templateId, _templateName, _contentAvailable ? @"YES" : @"NO", _mutableContent ? @"YES" : @"NO", _category, _relevanceScore, _interruptionLevel, _rawPayload];
220+
return [NSString stringWithFormat: @"notificationId=%@ templateId=%@ templateName=%@ contentAvailable=%@ mutableContent=%@ category=%@ relevanceScore=%@ interruptionLevel=%@ collapseId=%@ rawPayload=%@", _notificationId, _templateId, _templateName, _contentAvailable ? @"YES" : @"NO", _mutableContent ? @"YES" : @"NO", _category, _relevanceScore, _interruptionLevel, _collapseId, _rawPayload];
220221
}
221222

222223
- (NSDictionary *)jsonRepresentation {
@@ -281,6 +282,9 @@ - (NSDictionary *)jsonRepresentation {
281282

282283
if (self.interruptionLevel)
283284
[obj setObject:self.interruptionLevel forKeyedSubscript: @"interruptionLevel"];
285+
286+
if (self.collapseId)
287+
[obj setObject:self.collapseId forKeyedSubscript: @"collapseId"];
284288

285289
return obj;
286290
}

iOS_SDK/OneSignalSDK/Source/OneSignal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ typedef NS_ENUM(NSUInteger, OSNotificationActionType) {
136136
/* iOS 15+ : Interruption Level */
137137
@property(readonly)NSString *interruptionLevel;
138138

139+
@property(readonly, nullable)NSString *collapseId;
140+
139141
/* Parses an APNS push payload into a OSNotification object.
140142
Useful to call from your NotificationServiceExtension when the
141143
didReceiveNotificationRequest:withContentHandler: method fires. */

0 commit comments

Comments
 (0)