Skip to content

Commit

Permalink
Merge pull request #34 from CleverTap/develop
Browse files Browse the repository at this point in the history
SDK-1609/Release v2.3.0
  • Loading branch information
william-ct authored Mar 16, 2023
2 parents 0ac2057 + 7e1f24c commit 70d8188
Show file tree
Hide file tree
Showing 105 changed files with 759 additions and 1,258 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Change Log
==========

Version 2.3.0 *(16 March, 2023)*
-------------------------------------------
- Updated to [CleverTap Android SDK v4.6.7](https://github.com/CleverTap/clevertap-android-sdk/releases/tag/corev4.6.7_ptv1.0.5.1)
- Updated to [CleverTap iOS SDK v4.1.6](https://github.com/CleverTap/clevertap-ios-sdk/releases/tag/4.1.6)
- Support for Exoplayer v2.17.1 - Only for Android.
- Adds new callback `CleverTapInboxItemClicked` to receive inbox item click.
- Adds a public method `deleteInboxMessagesForIds()` for deleting multiple App Inbox messages by passing a collection of messageIDs. Please note that this is only for iOS, and NO-OP for Android as of now.

Version 2.2.0 *(14 FEB, 2022)*
-------------------------------------------
- Add public APIs for Increment/Decrement ops and InApp Controls
Expand Down
Binary file modified CleverTapUnityPlugin.unitypackage
Binary file not shown.
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Copyright (c) 2014-2016 CleverTap
Copyright (c) 2014-2023 CleverTap
All rights reserved.

* Use of source code or binaries contained within CleverTap's Android SDK is permitted only to enable use of the CleverTap platform by customers of CleverTap.
* Use of source code or binaries contained within CleverTap's Unity SDK is permitted only to enable use of the CleverTap platform by customers of CleverTap.
* Modification of source code and inclusion in mobile apps is explicitly allowed provided that all other conditions are met.
* Neither the name of CleverTap nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
* Redistribution of source code or binaries is disallowed except with specific prior written permission. Any such redistribution must retain the above copyright notice, this list of conditions and the following disclaimer.
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
103 changes: 98 additions & 5 deletions Plugin/CleverTapUnity/CleverTapUnity-Scripts/CleverTapBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace CleverTap {
public class CleverTapBinding : MonoBehaviour {

public const string Version = "2.2.0";
public const string Version = "2.3.0";

#if UNITY_IOS
void Start() {
Expand Down Expand Up @@ -57,6 +57,30 @@ void Start() {
[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void CleverTap_profileRemoveMultiValueForKey(string key, string val);

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void CleverTap_profileIncrementDoubleValueForKey(string key, double val);

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void CleverTap_profileIncrementIntValueForKey(string key, int val);

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void CleverTap_profileDecrementDoubleValueForKey(string key, double val);

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void CleverTap_profileDecrementIntValueForKey(string key, int val);

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void CleverTap_suspendInAppNotifications();

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void CleverTap_discardInAppNotifications();

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void CleverTap_resumeInAppNotifications();

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern string CleverTap_getCleverTapID();

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void CleverTap_recordScreenView(string screenName);

Expand Down Expand Up @@ -150,6 +174,9 @@ void Start() {
[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void CleverTap_deleteInboxMessageForID(string messageId);

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void CleverTap_deleteInboxMessagesForIDs(string[] messageIds,int arrLength);

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void CleverTap_markReadInboxMessageForID(string messageId);

Expand Down Expand Up @@ -261,6 +288,39 @@ public static void ProfileRemoveMultiValueForKey(string key, string val) {
CleverTap_profileRemoveMultiValueForKey(key, val);
}

public static void ProfileIncrementValueForKey(string key, double val) {
CleverTap_profileIncrementDoubleValueForKey(key, val);
}

public static void ProfileIncrementValueForKey(string key, int val) {
CleverTap_profileIncrementIntValueForKey(key, val);
}

public static void ProfileDecrementValueForKey(string key, double val) {
CleverTap_profileDecrementDoubleValueForKey(key, val);
}

public static void ProfileDecrementValueForKey(string key, int val) {
CleverTap_profileDecrementIntValueForKey(key, val);
}

public static void SuspendInAppNotifications() {
CleverTap_suspendInAppNotifications();
}

public static void DiscardInAppNotifications() {
CleverTap_discardInAppNotifications();
}

public static void ResumeInAppNotifications() {
CleverTap_resumeInAppNotifications();
}

public static string GetCleverTapID() {
string ret = CleverTap_getCleverTapID();
return ret;
}

public static void RecordScreenView(string screenName) {
CleverTap_recordScreenView(screenName);
}
Expand Down Expand Up @@ -441,6 +501,11 @@ public static void DeleteInboxMessageForID(string messageId) {
CleverTap_deleteInboxMessageForID(messageId);
}

public static void DeleteInboxMessagesForIDs(string[] messageIds) {
int arrLength = messageIds.Length;
CleverTap_deleteInboxMessagesForIDs(messageIds, arrLength);
}

public static void MarkReadInboxMessageForID(string messageId) {
CleverTap_markReadInboxMessageForID(messageId);
}
Expand Down Expand Up @@ -538,6 +603,7 @@ public static bool GetFeatureFlag(string key, bool defaultValue) {
return CleverTap_getFeatureFlag(key, defaultValue);
}


#elif UNITY_ANDROID
private static AndroidJavaObject unityActivity;
private static AndroidJavaObject clevertap;
Expand All @@ -547,7 +613,7 @@ void Start() {
Debug.Log("Start: CleverTap binding for Android.");
}

#region Properties
#region Properties
public static AndroidJavaObject unityCurrentActivity {
get {
if (unityActivity == null) {
Expand Down Expand Up @@ -577,7 +643,7 @@ public static AndroidJavaObject CleverTap {
return clevertap;
}
}
#endregion
#endregion

public static void SetDebugLevel(int level) {
CleverTapAPI.CallStatic("setDebugLevel", level);
Expand Down Expand Up @@ -791,7 +857,6 @@ public static void ProfileAddMultiValueForKey(string key, string val) {
public static void ProfileRemoveMultiValueForKey(string key, string val) {
CleverTap.Call("profileRemoveMultiValueForKey", key, val);
}

public static void RecordScreenView(string screenName) {
CleverTap.Call("recordScreenView", screenName);
}
Expand Down Expand Up @@ -892,6 +957,10 @@ public static int GetInboxMessageCount(){
return CleverTap.Call<int>("getInboxMessageCount");
}

public static void DeleteInboxMessagesForIDs(string[] messageIds) {
// no-op for Android
}

public static int GetInboxMessageUnreadCount(){
return CleverTap.Call<int>("getInboxMessageUnreadCount");
}
Expand Down Expand Up @@ -942,6 +1011,30 @@ public static void ProfileAddMultiValueForKey(string key, string val) {
public static void ProfileRemoveMultiValueForKey(string key, string val) {
}

public static void ProfileIncrementValueForKey(string key, double val) {
}

public static void ProfileIncrementValueForKey(string key, int val) {
}

public static void ProfileDecrementValueForKey(string key, double val) {
}

public static void ProfileDecrementValueForKey(string key, int val) {
}

public static void SuspendInAppNotifications() {
}

public static void DiscardInAppNotifications() {
}

public static void ResumeInAppNotifications() {
}

public static string GetCleverTapID() {
}

public static void RecordScreenView(string screenName) {
}

Expand Down Expand Up @@ -1060,4 +1153,4 @@ public static int GetInboxMessageUnreadCount(){
}
#endif
}
}
}
33 changes: 32 additions & 1 deletion Plugin/CleverTapUnity/CleverTapUnity-Scripts/CleverTapUnity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,40 @@ void Awake(){
CleverTapBinding.SetDebugLevel(CLEVERTAP_DEBUG_LEVEL);
CleverTapBinding.Initialize(CLEVERTAP_ACCOUNT_ID, CLEVERTAP_ACCOUNT_TOKEN, CLEVERTAP_ACCOUNT_REGION);
//==========[Testing Newly added Clevertap APIs]============================================
// CleverTapBinding.GetCleverTapId();
CleverTapBinding.GetCleverTapId();
// CleverTapBinding.ProfileIncrementValueForKey("add_int",2);
// CleverTapBinding.ProfileIncrementValueForKey("add_double",3.5);
// CleverTapBinding.ProfileDecrementValueForKey("minus_int",2);
// CleverTapBinding.ProfileDecrementValueForKey("minus_double",3.5);
// CleverTapBinding.SuspendInAppNotifications();
// CleverTapBinding.DiscardInAppNotifications();
// CleverTapBinding.ResumeInAppNotifications();

// record special Charged event
// Dictionary<string, object> chargeDetails = new Dictionary<string, object>();
// chargeDetails.Add("Amount", 500);
// chargeDetails.Add("Currency", "USD");
// chargeDetails.Add("Payment Mode", "Credit card");
//
// Dictionary<string, object> item = new Dictionary<string, object>();
// item.Add("price", 50);
// item.Add("Product category", "books");
// item.Add("Quantity", 1);
//
// Dictionary<string, object> item2 = new Dictionary<string, object>();
// item2.Add("price", 100);
// item2.Add("Product category", "plants");
// item2.Add("Quantity", 10);
//
// List<Dictionary<string, object>> items = new List<Dictionary<string, object>>();
// items.Add(item);
// items.Add(item2);
//
// CleverTapBinding.RecordChargedEventWithDetailsAndItems(chargeDetails, items);

// CleverTapBinding.RecordEvent("testEventPushAmp");

// Push Templates APIs usages
// CleverTapBinding.RecordEvent("Send Basic Push");

// CleverTapBinding.RecordEvent("Send Carousel Push");
Expand Down Expand Up @@ -170,6 +196,11 @@ void CleverTapInboxMessagesDidUpdateCallback(){
void CleverTapInboxCustomExtrasButtonSelect(string message) {
Debug.Log("unity received inbox message button with custom extras select: " + (!String.IsNullOrEmpty(message) ? message : "NULL"));
}
// returns on the click of app inbox message with a map of custom Key-Value pairs
void CleverTapInboxItemClicked(string message)
{
Debug.Log("unity received inbox message selected callback: " + (!String.IsNullOrEmpty(message) ? message : "NULL"));
}

// returns native display units data
void CleverTapNativeDisplayUnitsUpdated(string message) {
Expand Down
47 changes: 43 additions & 4 deletions Plugin/CleverTapUnity/iOS/CleverTapBinding.m
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ void CleverTap_profilePush(const char* properties) {
return clevertap_cStringCopy([ret UTF8String]);
}

char* CleverTap_getCleverTapID() {
return CleverTap_profileGetCleverTapID();
}

char* CleverTap_profileGetCleverTapAttributionIdentifier() {
NSString *ret = [[CleverTapUnityManager sharedInstance] profileGetCleverTapAttributionIdentifier];

Expand Down Expand Up @@ -269,6 +273,22 @@ void CleverTap_profileRemoveMultiValueForKey(const char* key, const char* value)
[[CleverTapUnityManager sharedInstance] profileRemoveMultiValue:clevertap_stringToNSString(value) forKey:clevertap_stringToNSString(key)];
}

void CleverTap_profileIncrementDoubleValueForKey(const char* key, const double value) {
[[CleverTapUnityManager sharedInstance] profileIncrementValueBy:[NSNumber numberWithDouble: value] forKey:clevertap_stringToNSString(key)];
}

void CleverTap_profileIncrementIntValueForKey(const char* key, const int value) {
[[CleverTapUnityManager sharedInstance] profileIncrementValueBy:[NSNumber numberWithInt: value] forKey:clevertap_stringToNSString(key)];
}

void CleverTap_profileDecrementDoubleValueForKey(const char* key, const double value) {
[[CleverTapUnityManager sharedInstance] profileDecrementValueBy:[NSNumber numberWithDouble: value] forKey:clevertap_stringToNSString(key)];
}

void CleverTap_profileDecrementIntValueForKey(const char* key, const int value) {
[[CleverTapUnityManager sharedInstance] profileDecrementValueBy:[NSNumber numberWithInt: value] forKey:clevertap_stringToNSString(key)];
}


#pragma mark - User Action Events

Expand Down Expand Up @@ -426,6 +446,10 @@ void CleverTap_deleteInboxMessageForID(const char* messageId) {
[[CleverTapUnityManager sharedInstance] deleteInboxMessageForID:clevertap_stringToNSString(messageId)];
}

void CleverTap_deleteInboxMessagesForIDs(const char* messageIds[], int size) {
[[CleverTapUnityManager sharedInstance] deleteInboxMessagesForIDs:clevertap_NSArrayFromArray(messageIds, size)];
}

void CleverTap_markReadInboxMessageForID(const char* messageId) {
[[CleverTapUnityManager sharedInstance] markReadInboxMessageForID:clevertap_stringToNSString(messageId)];
}
Expand All @@ -442,7 +466,7 @@ void CleverTap_recordInboxNotificationClickedEventForID(const char* messageId) {
#pragma mark - Native Display

char* CleverTap_getAllDisplayUnits() {

id ret = [[CleverTapUnityManager sharedInstance] getAllDisplayUnits];
NSString *jsonString = clevertap_toJsonString(ret);
if (jsonString == nil) {
Expand Down Expand Up @@ -504,9 +528,9 @@ void CleverTap_setProductConfigDefaultsFromPlistFileName(const char* fileName) {
id ret = [[CleverTapUnityManager sharedInstance] getProductConfigValueFor:clevertap_stringToNSString(key)];
NSString *jsonString = clevertap_toJsonString(ret);
if (jsonString == nil) {
return NULL;
}
return clevertap_cStringCopy([jsonString UTF8String]);
return NULL;
}
return clevertap_cStringCopy([jsonString UTF8String]);
}

double CleverTap_getProductConfigLastFetchTimeStamp() {
Expand All @@ -523,3 +547,18 @@ void CleverTap_resetProductConfig() {
BOOL CleverTap_getFeatureFlag(const char* key, const BOOL defaultValue) {
return [[CleverTapUnityManager sharedInstance] get:clevertap_stringToNSString(key) withDefaultValue:defaultValue];
}


#pragma mark - In App Controls

void CleverTap_suspendInAppNotifications() {
[[CleverTapUnityManager sharedInstance] suspendInAppNotifications];
}

void CleverTap_discardInAppNotifications() {
[[CleverTapUnityManager sharedInstance] discardInAppNotifications];
}

void CleverTap_resumeInAppNotifications() {
[[CleverTapUnityManager sharedInstance] resumeInAppNotifications];
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Plugin/CleverTapUnity/iOS/CleverTapSDK.framework/CleverTapSDK
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,15 @@ typedef void (^CleverTapInboxUpdatedBlock)(void);

- (void)deleteInboxMessageForID:(NSString * _Nonnull)messageId;

/*!
@method
@abstract
This method deletes `CleverTapInboxMessage` objects for the given `Message Id` as a collection.
*/

- (void)deleteInboxMessagesForIDs:(NSArray<NSString *> *_Nonnull)messageIds;

/*!
@method
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#import <Foundation/Foundation.h>
#import "CleverTap.h"

@class CleverTap;

@protocol CleverTapDomainDelegate <NSObject>
@optional
/*!
@method
@abstract
When conformed to `CleverTapDomainDelegate`, domain available callback will be received if domain available
@param domain the domain to be used by SC SDK
*/
- (void)onSCDomainAvailable:(NSString* _Nonnull)domain;

/*!
@method
@abstract
When conformed to `CleverTapDomainDelegate`, domain unavailable callback will be received if domain not available
*/
- (void)onSCDomainUnavailable;
@end

@interface CleverTap (SCDomain)
@end
Loading

0 comments on commit 70d8188

Please sign in to comment.