Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: inbox message id and action payload #94

Merged
merged 2 commits into from
Jul 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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