Skip to content

Commit

Permalink
Merge pull request #4 from CleverTap/1.2.5
Browse files Browse the repository at this point in the history
1.2.5
  • Loading branch information
Kumar Atul authored Jan 15, 2020
2 parents 40d8002 + bd60452 commit db6427c
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 20 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Change Log
==========

Version 1.2.5 *(15 Jan 2020)*
-------------------------------------------
* Bug fixes and performance improvement

Version 1.2.4 *(31 Oct 2019)*
-------------------------------------------
* Exposed method to pass custom install referrer parameters in Android
Expand Down
Binary file modified CleverTapUnityPlugin.unitypackage
Binary file not shown.
Binary file modified Plugin/CleverTapUnity/Android/clevertapsdk-unity.aar
Binary file not shown.
10 changes: 5 additions & 5 deletions Plugin/CleverTapUnity/CleverTapUnity-Scripts/CleverTapBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace CleverTap {
public class CleverTapBinding : MonoBehaviour {
public const string Version = "1.1.2";
public const string Version = "1.2.5";

#if UNITY_IOS
void Start() {
Expand Down Expand Up @@ -600,7 +600,7 @@ public static JSONArray GetListOfIntegerVariable(string name, List<int> defaultV
#elif UNITY_ANDROID
private static AndroidJavaObject unityActivity;
private static AndroidJavaObject clevertap;
private static AndroidJavaObject CleverTapClass;
private static AndroidJavaObject CleverTapClass;

void Start() {
Debug.Log("Start: CleverTap binding for Android.");
Expand All @@ -618,14 +618,14 @@ public static AndroidJavaObject unityCurrentActivity {
}
}

public static AndroidJavaObject CleverTapAPI {
public static AndroidJavaObject CleverTapAPI {
get {
if (CleverTapClass == null) {
CleverTapClass = new AndroidJavaClass("com.clevertap.unity.CleverTapUnityPlugin");
}
return CleverTapClass;
}
}
}

public static AndroidJavaObject CleverTap {
get {
Expand Down Expand Up @@ -1218,4 +1218,4 @@ public static Dictionary<string, string> GetMapOfStringVariable(string name, Dic
}
#endif
}
}
}
11 changes: 5 additions & 6 deletions Plugin/Plugins/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
android:required="false" />

<application
android:banner="@drawable/app_banner"
android:debuggable="true"
android:icon="@drawable/app_icon"
android:isGame="true"
Expand Down Expand Up @@ -82,14 +81,14 @@
<receiver
android:name="com.clevertap.android.sdk.CTPushNotificationReceiver"
android:enabled="true"
android:exported="false"/>
android:exported="false" />

<service android:name="com.clevertap.android.sdk.FcmTokenListenerService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>

<service android:name="com.clevertap.android.sdk.FcmMessageListenerService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
Expand All @@ -102,11 +101,11 @@

<meta-data
android:name="CLEVERTAP_ACCOUNT_ID"
android:value="Your CleverTap Account ID"/>
android:value="Your CleverTap Account ID" />

<meta-data
android:name="CLEVERTAP_TOKEN"
android:value="Your CleverTap Account Token"/>
android:value="Your CleverTap Account Token" />

</application>

Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Install

1. Import the CleverTapUnityPlugin.unitypackage into your Unity Project (`Assets` > `Import Package` > `Custom Package`) or manually Copy `Plugin/CleverTapUnity`, `Plugin/PlayServicesResolver` and `Plugin/Plugins/Android` (or copy the files in `Plugin/Plugins/Android` to your existing `Assets/Plugins/Android` directory) into the Assets directory of your Unity Project.
1. Import the CleverTapUnityPlugin.unitypackage into your Unity Project (`Assets` > `Import Package` > `Custom Package`) or manually Copy `Plugin/CleverTapUnity`, `Plugin/PlayServicesResolver` and `Plugin/Plugins/Android` (or copy the files in `Plugin/Plugins/Android` to your existing `Assets/Plugins/Android` directory) into the Assets directory of your Unity Project.

2. Create an empty game object (GameObject -> Create Empty) and rename it `CleverTapUnity`. Add `Assets/CleverTapUnity/CleverTapUnity-Scripts/CleverTapUnity.cs` as a component of the `CleverTapUnity GameObject`.

Expand All @@ -28,6 +28,11 @@
- Build and run your iOS project.

### Android Specific:
- If you want to enable Push Notifications, be sure to add the Firebase Unity SDK to your app as described in the [Firebase Unity Setup Docs](https://firebase.google.com/docs/unity/setup)

Note:
On adding the Firebase Unity SDK it might cause your AndroidManifest.xml to be overriden. If that occurs, make sure to revert it your original manifest file.

- Run `Assets` > `Play Services Resolver` > `Android Resolver` > `Resolve Client Jars` from the Unity menu bar to install the required google play services and android support library dependencies.

- Edit the `AndroidManifest.xml` file in `Assets/Plugins/Android` to add your Bundle Identifier, FCM Sender ID, CleverTap Account Id, CleverTap Token and Deep Link url scheme (if applicable):
Expand Down
20 changes: 17 additions & 3 deletions example/CleverTapUnity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
using CleverTap;
using CleverTap.Utilities;

public class CleverTapUnity : MonoBehaviour{
public class CleverTapUnity : MonoBehaviour
{

public String CLEVERTAP_ACCOUNT_ID = "YOUR_CLEVERTAP_ACCOUNT_ID";
public String CLEVERTAP_ACCOUNT_TOKEN = "YOUR_CLEVERTAP_ACCOUNT_TOKEN";
public int CLEVERTAP_DEBUG_LEVEL = 0;
public bool CLEVERTAP_ENABLE_PERSONALIZATION = true;

void Awake(){
void Awake()
{
#if (UNITY_IPHONE && !UNITY_EDITOR)
DontDestroyOnLoad(gameObject);
CleverTapBinding.SetDebugLevel(CLEVERTAP_DEBUG_LEVEL);
Expand Down Expand Up @@ -47,11 +49,18 @@ void Awake(){
//CleverTapBinding.DeleteNotificationChannel("YourChannelId");
//CleverTapBinding.DeleteNotificationChannelGroup("YourGroupId");


//app inbox
CleverTapBinding.InitializeInbox();
Debug.Log("InboxInit started");
//registering Dynamic Variables
CleverTapBinding.RegisterBooleanVariable("booleanVar");
CleverTapBinding.RegisterDoubleVariable("doubleVar");
CleverTapBinding.RegisterListOfDoubleVariable("listdouble");
CleverTapBinding.RegisterMapOfDoubleVariable("mapDouble");
CleverTapBinding.RecordEvent("Test Unity Event");
//Invoke("LaunchInbox",30.0f);

#endif
}

Expand All @@ -60,7 +69,7 @@ void Awake(){
void Start()
{
#if (UNITY_IPHONE && !UNITY_EDITOR)
// register for push notifications
// register for push notificationssetUIEditorConnectionEnabled
CleverTap.CleverTapBinding.RegisterPush();
CleverTap.CleverTapBinding.RecordScreenView("TestScreen");
// set to 0 to remove icon badge
Expand Down Expand Up @@ -303,6 +312,10 @@ void CleverTapPushOpenedCallback(string message)
}
}

void LaunchInbox()
{
CleverTapBinding.ShowAppInbox("");
}
// returns the custom data associated with an in-app notification click
void CleverTapInAppNotificationDismissedCallback(string message)
{
Expand All @@ -312,6 +325,7 @@ void CleverTapInAppNotificationDismissedCallback(string message)
//returns callback for InitializeInbox
void CleverTapInboxDidInitializeCallback()
{
CleverTapBinding.ShowAppInbox("");
Debug.Log("unity received inbox initialized");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.clevertap.unity"
android:versionCode="111"
android:versionName="1.1.1" >
android:versionCode="125"
android:versionName="1.2.5" >
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.Log;

import com.clevertap.android.sdk.ActivityLifecycleCallback;
Expand Down Expand Up @@ -132,6 +133,7 @@ private CleverTapUnityPlugin(final Context context) {
try {
clevertap = CleverTapAPI.getDefaultInstance(context);
if (clevertap != null) {
Log.d(LOG_TAG, "getDefaultInstance-" + clevertap);
clevertap.setInAppNotificationListener(this);
clevertap.setSyncListener(this);
clevertap.setCTNotificationInboxListener(this);
Expand Down Expand Up @@ -446,8 +448,12 @@ public int getInboxMessageUnreadCount() {

public void showAppInbox(final String jsonString) {
try {
CTInboxStyleConfig styleConfig = toStyleConfig(new JSONObject(jsonString));
clevertap.showAppInbox(styleConfig);
if (!TextUtils.isEmpty(jsonString)) {
CTInboxStyleConfig styleConfig = toStyleConfig(new JSONObject(jsonString));
clevertap.showAppInbox(styleConfig);
} else {
clevertap.showAppInbox();
}
} catch (JSONException e) {
Log.e(LOG_TAG, "JSON Exception in converting style config", e);
}
Expand All @@ -465,7 +471,7 @@ public void onDismissed(Map<String, Object> var1, @Nullable Map<String, Object>

JSONObject extras = var1 != null ? new JSONObject(var1) : new JSONObject();
String _json = "{extras:" + extras.toString() + ",";

` `
JSONObject actionExtras = var2 != null ? new JSONObject(var2) : new JSONObject();
_json += "actionExtras:" + actionExtras.toString() + "}";

Expand Down Expand Up @@ -629,6 +635,7 @@ private static CTInboxStyleConfig toStyleConfig(JSONObject object) throws JSONEx
}

public static void setUIEditorConnectionEnabled(boolean enabled) {
Log.d(LOG_TAG, "setUIEditorConnectionEnabled-" + enabled);
CleverTapAPI.setUIEditorConnectionEnabled(enabled);
}

Expand Down

0 comments on commit db6427c

Please sign in to comment.