-
Notifications
You must be signed in to change notification settings - Fork 4
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
base: develop
Are you sure you want to change the base?
webgl support #79
Changes from all commits
5c93e2d
38aa01b
05c899a
3d4c35d
66d8a7c
7159b43
7b76954
e73a364
d2058cc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
---|---|---|
|
@@ -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"; | ||
private static final String CLEVERTAP_INAPPS_FETCHED = "CleverTapInAppsFetched"; | ||
|
||
private static CleverTapUnityPlugin instance = null; | ||
|
||
|
@@ -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)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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)) { | ||
|
@@ -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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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() { | ||
|
@@ -782,10 +784,10 @@ public void onVariablesFetched(boolean isSuccess) { | |
} | ||
}); | ||
} | ||
// InApps | ||
public void fetchInApps(final int callbackId) { | ||
clevertap.fetchInApps(new FetchInAppsCallback() { | ||
// InApps | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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(); | ||
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix formatting |
||
} | ||
|
||
//Native Display Units | ||
public String getAllDisplayUnits() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,4 +151,4 @@ | |
- (void)fetchInApps:(int)callbackId; | ||
- (void)clearInAppResources:(BOOL)expiredOnly; | ||
|
||
@end | ||
@end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix formatting |
||
[clevertap recordChargedEventWithDetails:details andItems:items]; | ||
} | ||
|
||
|
@@ -895,8 +895,7 @@ - (void)syncVariables | |
[clevertap syncVariables]; | ||
} | ||
|
||
- (void)syncVariables:(BOOL)isProduction | ||
{ | ||
- (void)syncVariables:(BOOL)isProduction { | ||
[clevertap syncVariables:isProduction]; | ||
} | ||
|
||
|
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.
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.
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.
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.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -450,4 +450,4 @@ public static class CleverTap { | |
|
||
#endregion | ||
} | ||
} | ||
} |
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.
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.
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.
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.
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using UnityEngine; | ||
using System; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
public class MonoHelper : MonoBehaviour | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
} | ||
} |
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.
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.
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.
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix formatting