From 543b404a7f6b76306a6f593737a9d5708054cd3f Mon Sep 17 00:00:00 2001 From: biancalui Date: Thu, 13 Jul 2023 15:30:18 +0800 Subject: [PATCH 1/2] fix: inbox message id and action payload MV-522 --- ios/RNEmarsysInboxWrapper.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ios/RNEmarsysInboxWrapper.m b/ios/RNEmarsysInboxWrapper.m index 2511f97..4ed4e55 100644 --- a/ios/RNEmarsysInboxWrapper.m +++ b/ios/RNEmarsysInboxWrapper.m @@ -78,6 +78,7 @@ - (NSMutableDictionary *)convertMessageToMap:(EMSMessage *)message { NSMutableDictionary *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"]; @@ -109,12 +110,12 @@ - (NSMutableDictionary *)convertActionToMap:(id)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 } From 922b83100124dd87d5759432177024294546d1ca Mon Sep 17 00:00:00 2001 From: biancalui Date: Thu, 13 Jul 2023 16:01:57 +0800 Subject: [PATCH 2/2] chore: add comment --- ios/RNEmarsysInboxWrapper.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/RNEmarsysInboxWrapper.m b/ios/RNEmarsysInboxWrapper.m index 4ed4e55..04400ad 100644 --- a/ios/RNEmarsysInboxWrapper.m +++ b/ios/RNEmarsysInboxWrapper.m @@ -79,7 +79,7 @@ - (NSMutableDictionary *)convertMessageToMap:(EMSMessage *)message { NSMutableDictionary *map = [[NSMutableDictionary alloc] init]; [map setObject: message.id forKey: @"id"]; - [map setObject: message.id forKey: @"messageId"]; + [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"];