Skip to content

Commit

Permalink
fix: inbox message id and action payload
Browse files Browse the repository at this point in the history
MV-522
  • Loading branch information
biancalui-emarsys committed Jul 13, 2023
1 parent 3dbbea9 commit 543b404
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ios/RNEmarsysInboxWrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ - (NSMutableDictionary *)convertMessageToMap:(EMSMessage *)message {

NSMutableDictionary<NSString *, NSObject *> *map = [[NSMutableDictionary alloc] init];

[map setObject: message.id forKey: @"id"];
[map setObject: message.id forKey: @"messageId"];
[map setObject: message.campaignId forKey: @"campaignId"];
[map setObject: message.collapseId ?: @"" forKey: @"collapseId"];
Expand Down Expand Up @@ -109,12 +110,12 @@ - (NSMutableDictionary *)convertActionToMap:(id<EMSActionModelProtocol>)action {

if ([action isKindOfClass:[EMSAppEventActionModel class]]) {
[map setObject: ((EMSAppEventActionModel *)action).name forKey: @"name"];
[map setObject: ((EMSAppEventActionModel *)action).payload forKey: @"payload"];
[map setObject: (((EMSAppEventActionModel *)action).payload ?: [NSDictionary dictionary]) forKey: @"payload"];
} else if ([action isKindOfClass:[EMSOpenExternalUrlActionModel class]]) {
[map setObject: ((EMSOpenExternalUrlActionModel *)action).url.absoluteString forKey: @"url"];
} else if ([action isKindOfClass:[EMSCustomEventActionModel class]]) {
[map setObject: ((EMSCustomEventActionModel *)action).name forKey: @"name"];
[map setObject: ((EMSCustomEventActionModel *)action).payload forKey: @"payload"];
[map setObject: (((EMSCustomEventActionModel *)action).payload ?: [NSDictionary dictionary]) forKey: @"payload"];
} else if ([action isKindOfClass:[EMSDismissActionModel class]]) {
// no additional fields
}
Expand Down

0 comments on commit 543b404

Please sign in to comment.