From f818a7658fbb8b815342cec4a5ef10e0d0a8bffc Mon Sep 17 00:00:00 2001 From: kushagraa14 Date: Mon, 15 May 2023 15:35:35 +0530 Subject: [PATCH] Added `markReadInboxMessages` api to mark multiple inbox messages as read --- .../CleverTapUnity-Scripts/CleverTapBinding.cs | 8 ++++++++ Plugin/CleverTapUnity/iOS/CleverTapBinding.m | 4 ++++ Plugin/CleverTapUnity/iOS/CleverTapUnityManager.h | 1 + Plugin/CleverTapUnity/iOS/CleverTapUnityManager.mm | 4 ++++ 4 files changed, 17 insertions(+) diff --git a/Plugin/CleverTapUnity/CleverTapUnity-Scripts/CleverTapBinding.cs b/Plugin/CleverTapUnity/CleverTapUnity-Scripts/CleverTapBinding.cs index fe860191..d940984a 100644 --- a/Plugin/CleverTapUnity/CleverTapUnity-Scripts/CleverTapBinding.cs +++ b/Plugin/CleverTapUnity/CleverTapUnity-Scripts/CleverTapBinding.cs @@ -183,6 +183,9 @@ void Start() { [System.Runtime.InteropServices.DllImport("__Internal")] private static extern void CleverTap_markReadInboxMessageForID(string messageId); + [System.Runtime.InteropServices.DllImport("__Internal")] + private static extern void CleverTap_markReadInboxMessagesForIDs(string[] messageIds,int arrLength); + [System.Runtime.InteropServices.DllImport("__Internal")] private static extern void CleverTap_recordInboxNotificationViewedEventForID(string messageId); @@ -526,6 +529,11 @@ public static void MarkReadInboxMessageForID(string messageId) { CleverTap_markReadInboxMessageForID(messageId); } + public static void MarkReadInboxMessagesForIDs(string[] messageIds) { + int arrLength = messageIds.Length; + CleverTap_MarkReadInboxMessagesForIDs(messageIds, arrLength); + } + public static void RecordInboxNotificationViewedEventForID(string messageId) { CleverTap_recordInboxNotificationViewedEventForID(messageId); } diff --git a/Plugin/CleverTapUnity/iOS/CleverTapBinding.m b/Plugin/CleverTapUnity/iOS/CleverTapBinding.m index 97b41cc5..99d73e3e 100644 --- a/Plugin/CleverTapUnity/iOS/CleverTapBinding.m +++ b/Plugin/CleverTapUnity/iOS/CleverTapBinding.m @@ -458,6 +458,10 @@ void CleverTap_markReadInboxMessageForID(const char* messageId) { [[CleverTapUnityManager sharedInstance] markReadInboxMessageForID:clevertap_stringToNSString(messageId)]; } +void CleverTap_markReadInboxMessagesForIDs(const char* messageIds[], int size) { + [[CleverTapUnityManager sharedInstance] markReadInboxMessagesForIDs:clevertap_NSArrayFromArray(messageIds, size)]; +} + void CleverTap_recordInboxNotificationViewedEventForID(const char* messageId) { [[CleverTapUnityManager sharedInstance] recordInboxNotificationViewedEventForID:clevertap_stringToNSString(messageId)]; } diff --git a/Plugin/CleverTapUnity/iOS/CleverTapUnityManager.h b/Plugin/CleverTapUnity/iOS/CleverTapUnityManager.h index 3f26b2ba..f38ec8ee 100644 --- a/Plugin/CleverTapUnity/iOS/CleverTapUnityManager.h +++ b/Plugin/CleverTapUnity/iOS/CleverTapUnityManager.h @@ -96,6 +96,7 @@ - (void)deleteInboxMessageForID:(NSString *)messageId; - (void)deleteInboxMessagesForIDs:(NSArray *)messageIds; - (void)markReadInboxMessageForID:(NSString *)messageId; +- (void)markReadInboxMessagesForIDs:(NSArray *)messageIds; - (void)recordInboxNotificationViewedEventForID:(NSString *)messageId; - (void)recordInboxNotificationClickedEventForID:(NSString *)messageId; diff --git a/Plugin/CleverTapUnity/iOS/CleverTapUnityManager.mm b/Plugin/CleverTapUnity/iOS/CleverTapUnityManager.mm index a39fa4a8..729a8223 100644 --- a/Plugin/CleverTapUnity/iOS/CleverTapUnityManager.mm +++ b/Plugin/CleverTapUnity/iOS/CleverTapUnityManager.mm @@ -543,6 +543,10 @@ - (void)markReadInboxMessageForID:(NSString *)messageId { [clevertap markReadInboxMessageForID:messageId]; } +- (void)markReadInboxMessagesForIDs:(NSArray *)messageIds { + [clevertap markReadInboxMessagesForIDs:messageIds]; +} + - (void)recordInboxNotificationViewedEventForID:(NSString *)messageId { [clevertap recordInboxNotificationViewedEventForID:messageId];