Skip to content

Commit

Permalink
Merge pull request #94 from emartech/MV-522-inbox-id
Browse files Browse the repository at this point in the history
fix: inbox message id and action payload
  • Loading branch information
eduzatoni authored Jul 13, 2023
2 parents 3dbbea9 + 922b831 commit e8caeaf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ios/RNEmarsysInboxWrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ - (NSMutableDictionary *)convertMessageToMap:(EMSMessage *)message {

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

[map setObject: message.id forKey: @"messageId"];
[map setObject: message.id forKey: @"id"];
[map setObject: message.id forKey: @"messageId"]; // deprecated. to be removed
[map setObject: message.campaignId forKey: @"campaignId"];
[map setObject: message.collapseId ?: @"" forKey: @"collapseId"];
[map setObject: message.title forKey: @"title"];
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 e8caeaf

Please sign in to comment.