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

webgl support #79

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
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
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 3.2.0 *(12 July, 2024)*
-------------------------------------------
- Added native support for WebGL, Mac and Windows platform

Version 3.1.0 *(24 April, 2024)*
-------------------------------------------
- Updated to [CleverTap Android SDK v6.2.1](https://github.com/CleverTap/clevertap-android-sdk/releases/tag/corev6.2.1)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@ android {
}
}

repositories {
mavenCentral()
}

dependencies {
compileOnly fileTree('libs')

implementation 'com.clevertap.android:clevertap-android-sdk:6.2.1'
implementation 'com.google.firebase:firebase-messaging:23.0.6'
implementation 'androidx.core:core:1.9.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ public class CleverTapUnityPlugin implements SyncListener, InAppNotificationList
private static final String CLEVERTAP_VARIABLE_VALUE_CHANGED = "CleverTapVariableValueChanged";

private static final String CLEVERTAP_VARIABLES_FETCHED = "CleverTapVariablesFetched";
private static final String CLEVERTAP_INAPPS_FETCHED = "CleverTapInAppsFetched";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix formatting

private static final String CLEVERTAP_INAPPS_FETCHED = "CleverTapInAppsFetched";

private static CleverTapUnityPlugin instance = null;

Expand Down Expand Up @@ -300,6 +300,8 @@ public static void deleteNotificationChannelGroup(Context context, String groupI
public void setPushToken(String token, String region, String type) {
if (PushConstants.PushType.valueOf(type.toLowerCase()).equals(PushConstants.PushType.FCM)) {
clevertap.pushFcmRegistrationId(token, true);
} else if (PushConstants.PushType.valueOf(type.toLowerCase()).equals(PushConstants.PushType.XPS)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe Xiaomi Push is already deprecated

clevertap.pushXiaomiRegistrationId(token, region,true);
} else if (PushConstants.PushType.valueOf(type.toLowerCase()).equals(PushConstants.PushType.BPS)) {
clevertap.pushBaiduRegistrationId(token, true);
} else if (PushConstants.PushType.valueOf(type.toLowerCase()).equals(PushConstants.PushType.HPS)) {
Expand Down Expand Up @@ -755,11 +757,11 @@ public void onValueChanged(Var variable) {

public String getVariableValue(String variableName) {
Object value = clevertap.getVariableValue(variableName);
if (value == null) {
return null;
}
return (value instanceof Map) ? new JSONObject((Map<?, ?>) value).toString() : value.toString();
if (value == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix formatting

return null;
}
return (value instanceof Map) ? new JSONObject((Map<?, ?>) value).toString() : value.toString();
}

public void syncVariables() {
Expand All @@ -782,10 +784,10 @@ public void onVariablesFetched(boolean isSuccess) {
}
});
}
// InApps
public void fetchInApps(final int callbackId) {
clevertap.fetchInApps(new FetchInAppsCallback() {
// InApps
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix formatting

public void fetchInApps(final int callbackId) {
clevertap.fetchInApps(new FetchInAppsCallback() {
@Override
public void onInAppsFetched(boolean isSuccess) {
JSONObject json = new JSONObject();
Expand All @@ -799,16 +801,16 @@ public void onInAppsFetched(boolean isSuccess) {
messageUnity(CLEVERTAP_GAME_OBJECT_NAME, CLEVERTAP_INAPPS_FETCHED, json.toString());
}
});
}
}

/**
* Deletes all images and gifs which are preloaded for inapps in cs mode
*
* @param expiredOnly to clear only assets which will not be needed further for inapps
*/
public void clearInAppResources(boolean expiredOnly) {
clevertap.clearInAppResources(expiredOnly);
}
clevertap.clearInAppResources(expiredOnly);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix formatting

}

//Native Display Units
public String getAllDisplayUnits() {
Expand Down
2 changes: 1 addition & 1 deletion CleverTap/Plugins/iOS/CleverTapUnityManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,4 @@
- (void)fetchInApps:(int)callbackId;
- (void)clearInAppResources:(BOOL)expiredOnly;

@end
@end
7 changes: 3 additions & 4 deletions CleverTap/Plugins/iOS/CleverTapUnityManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,12 @@ - (void)recordEvent:(NSString *)event {
}

- (void)recordEvent:(NSString *)event withProps:(NSDictionary *)properties {
NSDictionary *attributes = cleverTap_convertDateValues(properties);
NSDictionary *attributes = cleverTap_convertDateValues(properties);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix formatting

[clevertap recordEvent:event withProps:attributes];
}

- (void)recordChargedEventWithDetails:(NSDictionary *)chargeDetails andItems:(NSArray *)items {
NSDictionary *details = cleverTap_convertDateValues(chargeDetails);
NSDictionary *details = cleverTap_convertDateValues(chargeDetails);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix formatting

[clevertap recordChargedEventWithDetails:details andItems:items];
}

Expand Down Expand Up @@ -895,8 +895,7 @@ - (void)syncVariables
[clevertap syncVariables];
}

- (void)syncVariables:(BOOL)isProduction
{
- (void)syncVariables:(BOOL)isProduction {
[clevertap syncVariables:isProduction];
}

Expand Down
2 changes: 1 addition & 1 deletion CleverTap/Runtime/Android.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Android/AndroidCallbackHandler.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Android/AndroidPlatformBinding.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Android/AndroidPlatformInApps.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Android/AndroidPlatformVariable.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Android/AndroidVar.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Android/CleverTapAndroidJNI.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/CleverTap.asmdef.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/CleverTap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -450,4 +450,4 @@ public static class CleverTap {

#endregion
}
}
}
2 changes: 1 addition & 1 deletion CleverTap/Runtime/CleverTap.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Common.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Common/BindingFactory.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Common/CleverTapCallbackHandler.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Common/CleverTapPlatformBindings.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Common/CleverTapPlatformInApps.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Common/CleverTapPlatformVariable.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Common/Delegates.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Common/InAppsFactory.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions CleverTap/Runtime/Common/MonoHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using UnityEngine;
using System;
using System.Threading;
using System.Threading.Tasks;

public class MonoHelper : MonoBehaviour
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add namespace CleverTapSDK.Common

{
private static MonoHelper _instance;
public static MonoHelper Instance
{
get
{
if (_instance == null)
{
var obj = new GameObject("MonoHelper");
_instance = obj.AddComponent<MonoHelper>();
DontDestroyOnLoad(obj);
}
return _instance;
}
}

private SynchronizationContext _context;

private void Awake()
{
_instance = this;
_context = SynchronizationContext.Current;
}

public Task RunOnMainThread(Action action)
{
var tcs = new TaskCompletionSource<bool>();
_context.Post(_ => {
action();
tcs.SetResult(true);
}, null);
return tcs.Task;
}

public Task<T> RunOnMainThread<T>(Func<T> function)
{
var tcs = new TaskCompletionSource<T>();
_context.Post(_ => {
var result = function();
tcs.SetResult(result);
}, null);
return tcs.Task;
}
}
11 changes: 11 additions & 0 deletions CleverTap/Runtime/Common/MonoHelper.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Common/Var.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using CleverTapSDK.Constants;
using CleverTapSDK.Constants;
using CleverTapSDK.Utilities;

namespace CleverTapSDK.Common {
Expand Down
2 changes: 1 addition & 1 deletion CleverTap/Runtime/Common/Var.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Common/VariableFactory.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Constants.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Constants/CleverTapVariableKind.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Constants/CleverTapVersion.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Deprecated.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Deprecated/CleverTapBinding.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CleverTap/Runtime/Deprecated/CleverTapUnity.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading