app center;增加發送ping的秒

This commit is contained in:
Caiyanpeng committed 2021-11-12 16:21:13 +08:00
1 parent 1bd1ffdb5a
commit d754ff3b15
719 files changed
+34172 -2875

No files matched your search

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3834fae7b40ff624cbea26abb8c648d4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3081e1f5b9e3f4598ba1d4ec33c30d17
folderAsset: yes
timeCreated: 1498059874
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,96 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_ANDROID && !UNITY_EDITOR
using System;
using System.Collections.Generic;
using Microsoft.AppCenter.Unity.Internal.Utility;
using UnityEngine;
namespace Microsoft.AppCenter.Unity.Analytics.Internal
{
class AnalyticsInternal
{
private static AndroidJavaClass _analytics = new AndroidJavaClass("com.microsoft.appcenter.analytics.Analytics");
public static void PrepareEventHandlers()
{
AppCenterBehavior.InitializedAppCenterAndServices += PostInitialize;
}
private static void PostInitialize()
{
var instance = _analytics.CallStatic<AndroidJavaObject>("getInstance");
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
instance.Call("onActivityResumed", activity);
}
public static void AddNativeType(List<IntPtr> nativeTypes)
{
nativeTypes.Add(AndroidJNI.FindClass("com/microsoft/appcenter/analytics/Analytics"));
}
public static void TrackEvent(string eventName)
{
_analytics.CallStatic("trackEvent", eventName);
}
public static void TrackEvent(string eventName, int flags)
{
_analytics.CallStatic("trackEvent", eventName, null, flags);
}
public static void TrackEventWithProperties(string eventName, IDictionary<string, string> properties)
{
var androidProperties = JavaStringMapHelper.ConvertToJava(properties);
_analytics.CallStatic("trackEvent", eventName, androidProperties);
}
public static void TrackEventWithProperties(string eventName, EventProperties properties)
{
_analytics.CallStatic("trackEvent", eventName, properties.GetRawObject());
}
public static void TrackEventWithProperties(string eventName, IDictionary<string, string> properties, int flags)
{
var androidProperties = JavaStringMapHelper.ConvertToJava(properties);
_analytics.CallStatic("trackEvent", eventName, androidProperties, flags);
}
public static void TrackEventWithProperties(string eventName, EventProperties properties, int flags)
{
_analytics.CallStatic("trackEvent", eventName, properties.GetRawObject(), flags);
}
public static AppCenterTask SetEnabledAsync(bool isEnabled)
{
var future = _analytics.CallStatic<AndroidJavaObject>("setEnabled", isEnabled);
return new AppCenterTask(future);
}
public static AppCenterTask<bool> IsEnabledAsync()
{
var future = _analytics.CallStatic<AndroidJavaObject>("isEnabled");
return new AppCenterTask<bool>(future);
}
public static AndroidJavaObject GetTransmissionTarget(string transmissionTargetToken, out bool success)
{
var target = _analytics.CallStatic<AndroidJavaObject>("getTransmissionTarget", transmissionTargetToken);
success = target != null;
return target;
}
public static void Pause()
{
_analytics.CallStatic("pause");
}
public static void Resume()
{
_analytics.CallStatic("resume");
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: a713100f59727486c9ad45c500332234
timeCreated: 1497467718
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,44 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using UnityEngine;
#if UNITY_ANDROID && !UNITY_EDITOR
using Microsoft.AppCenter.Unity.Internal.Utility;
namespace Microsoft.AppCenter.Unity.Analytics.Internal
{
class EventPropertiesInternal
{
public static AndroidJavaObject Create()
{
return new AndroidJavaObject("com.microsoft.appcenter.analytics.EventProperties");
}
public static void SetString(AndroidJavaObject properties, string key, string val)
{
properties.Call<AndroidJavaObject>("set", key, val);
}
public static void SetNumber(AndroidJavaObject properties, string key, long val)
{
properties.Call<AndroidJavaObject>("set", key, val);
}
public static void SetNumber(AndroidJavaObject properties, string key, double val)
{
properties.Call<AndroidJavaObject>("set", key, val);
}
public static void SetBool(AndroidJavaObject properties, string key, bool val)
{
properties.Call<AndroidJavaObject>("set", key, val);
}
public static void SetDate(AndroidJavaObject properties, string key, DateTime val)
{
properties.Call<AndroidJavaObject>("set", key, JavaDateHelper.DateTimeConvert(val));
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 514cee750a1f56f4bab5c663b3a4f557
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,70 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_ANDROID && !UNITY_EDITOR
using UnityEngine;
using Microsoft.AppCenter.Unity.Internal.Utility;
using System;
namespace Microsoft.AppCenter.Unity.Analytics
{
public class PropertyConfiguratorInternal
{
public static void SetAppName(AndroidJavaObject propertyConfigurator, string appName)
{
propertyConfigurator.Call("setAppName", appName);
}
public static void SetUserId(AndroidJavaObject propertyConfigurator, string userId)
{
propertyConfigurator.Call("setUserId", userId);
}
public static void SetAppVersion(AndroidJavaObject propertyConfigurator, string appVersion)
{
propertyConfigurator.Call("setAppVersion", appVersion);
}
public static void SetAppLocale(AndroidJavaObject propertyConfigurator, string appLocale)
{
propertyConfigurator.Call("setAppLocale", appLocale);
}
public static void CollectDeviceId(AndroidJavaObject propertyConfigurator)
{
propertyConfigurator.Call("collectDeviceId");
}
public static void SetEventProperty(AndroidJavaObject propertyConfigurator, string key, string value)
{
propertyConfigurator.Call("setEventProperty", key, value);
}
public static void SetEventProperty(AndroidJavaObject propertyConfigurator, string key, DateTime value)
{
var javaDate = JavaDateHelper.DateTimeConvert(value);
propertyConfigurator.Call("setEventProperty", key, javaDate);
}
public static void SetEventProperty(AndroidJavaObject propertyConfigurator, string key, long value)
{
propertyConfigurator.Call("setEventProperty", key, value);
}
public static void SetEventProperty(AndroidJavaObject propertyConfigurator, string key, double value)
{
propertyConfigurator.Call("setEventProperty", key, value);
}
public static void SetEventProperty(AndroidJavaObject propertyConfigurator, string key, bool value)
{
propertyConfigurator.Call("setEventProperty", key, value);
}
public static void RemoveEventProperty(AndroidJavaObject propertyConfigurator, string key)
{
propertyConfigurator.Call("removeEventProperty", key);
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e670e8c4e24f54cb3b15b96cba63313b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,82 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_ANDROID && !UNITY_EDITOR
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Microsoft.AppCenter.Unity.Analytics.Internal;
using Microsoft.AppCenter.Unity.Internal.Utility;
namespace Microsoft.AppCenter.Unity.Analytics
{
public class TransmissionTargetInternal
{
public static void TrackEvent(AndroidJavaObject transmissionTarget, string eventName)
{
transmissionTarget.Call("trackEvent", eventName);
}
public static void TrackEvent(AndroidJavaObject transmissionTarget, string eventName, int flags)
{
transmissionTarget.Call("trackEvent", eventName, null, flags);
}
public static void TrackEventWithProperties(AndroidJavaObject transmissionTarget, string eventName, IDictionary<string, string> properties)
{
var androidProperties = JavaStringMapHelper.ConvertToJava(properties);
transmissionTarget.Call("trackEvent", eventName, androidProperties);
}
public static void TrackEventWithProperties(AndroidJavaObject transmissionTarget, string eventName, EventProperties properties)
{
transmissionTarget.Call("trackEvent", eventName, properties.GetRawObject());
}
public static void TrackEventWithProperties(AndroidJavaObject transmissionTarget, string eventName, IDictionary<string, string> properties, int flags)
{
var androidProperties = JavaStringMapHelper.ConvertToJava(properties);
transmissionTarget.Call("trackEvent", eventName, androidProperties, flags);
}
public static void TrackEventWithProperties(AndroidJavaObject transmissionTarget, string eventName, EventProperties properties, int flags)
{
transmissionTarget.Call("trackEvent", eventName, properties.GetRawObject(), flags);
}
public static AppCenterTask SetEnabledAsync(AndroidJavaObject transmissionTarget, bool enabled)
{
var future = transmissionTarget.Call<AndroidJavaObject>("setEnabledAsync", enabled);
return new AppCenterTask(future);
}
public static AppCenterTask<bool> IsEnabledAsync(AndroidJavaObject transmissionTarget)
{
var future = transmissionTarget.Call<AndroidJavaObject>("isEnabledAsync");
return new AppCenterTask<bool>(future);
}
public static AndroidJavaObject GetTransmissionTarget(AndroidJavaObject transmissionTargetParent, string transmissionTargetToken, out bool success)
{
var target = transmissionTargetParent.Call<AndroidJavaObject>("getTransmissionTarget", transmissionTargetToken);
success = target != null;
return target;
}
public static AndroidJavaObject GetPropertyConfigurator(AndroidJavaObject transmissionTarget)
{
return transmissionTarget.Call<AndroidJavaObject>("getPropertyConfigurator");
}
public static void Pause(AndroidJavaObject transmissionTarget)
{
transmissionTarget.Call("pause");
}
public static void Resume(AndroidJavaObject transmissionTarget)
{
transmissionTarget.Call("resume");
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9b4de3e63b6764e059567a9e87feda60
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 05baa696b2306473096af3c82bf25429
folderAsset: yes
timeCreated: 1498059884
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,83 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if (!UNITY_IOS && !UNITY_ANDROID && !UNITY_WSA_10_0) || UNITY_EDITOR
using System;
using System.Collections.Generic;
namespace Microsoft.AppCenter.Unity.Analytics.Internal
{
#if UNITY_IOS || UNITY_ANDROID
using RawType = System.IntPtr;
#else
using RawType = System.Type;
#endif
#if UNITY_IOS
using TransmissionTargetType = System.IntPtr;
#elif UNITY_ANDROID
using TransmissionTargetType = UnityEngine.AndroidJavaObject;
#else
using TransmissionTargetType = System.Object;
#endif
class AnalyticsInternal
{
public static void PrepareEventHandlers()
{
}
public static void AddNativeType(List<RawType> nativeTypes)
{
}
public static void TrackEvent(string eventName)
{
}
public static void TrackEvent(string eventName, int flags)
{
}
public static void TrackEventWithProperties(string eventName, IDictionary<string, string> properties)
{
}
public static void TrackEventWithProperties(string eventName, EventProperties properties)
{
}
public static void TrackEventWithProperties(string eventName, IDictionary<string, string> properties, int flags)
{
}
public static void TrackEventWithProperties(string eventName, EventProperties properties, int flags)
{
}
public static AppCenterTask SetEnabledAsync(bool enabled)
{
return AppCenterTask.FromCompleted();
}
public static AppCenterTask<bool> IsEnabledAsync()
{
return AppCenterTask<bool>.FromCompleted(false);
}
public static TransmissionTargetType GetTransmissionTarget(string transmissionTargetToken, out bool success)
{
success = false;
return default(TransmissionTargetType);
}
public static void Pause()
{
}
public static void Resume()
{
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 632c05efd92fe4ec9b424381b5392d76
timeCreated: 1497465139
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,41 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if (!UNITY_IOS && !UNITY_ANDROID && !UNITY_WSA_10_0) || UNITY_EDITOR
using System;
namespace Microsoft.AppCenter.Unity.Analytics.Internal
{
#if UNITY_IOS
using RawType = System.IntPtr;
#elif UNITY_ANDROID
using RawType = UnityEngine.AndroidJavaObject;
#else
using RawType = System.Object;
#endif
class EventPropertiesInternal
{
public static RawType Create()
{
return default(RawType);
}
public static void SetString(RawType properties, string key, string val)
{
}
public static void SetNumber(RawType properties, string key, object val)
{
}
public static void SetBool(RawType properties, string key, bool val)
{
}
public static void SetDate(RawType properties, string key, DateTime val)
{
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 61494a0be6a398041ad0f0aa1de5408e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,66 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if (!UNITY_IOS && !UNITY_ANDROID && !UNITY_WSA_10_0) || UNITY_EDITOR
using System;
using System.Collections.Generic;
using Microsoft.AppCenter.Unity.Analytics.Internal;
namespace Microsoft.AppCenter.Unity.Analytics
{
#if UNITY_IOS
using RawType = System.IntPtr;
#elif UNITY_ANDROID
using RawType = UnityEngine.AndroidJavaObject;
#else
using RawType = System.Object;
#endif
public class PropertyConfiguratorInternal
{
public static void SetAppName(RawType propertyConfigurator, string appName)
{
}
public static void SetUserId(RawType propertyConfigurator, string userId)
{
}
public static void SetAppVersion(RawType propertyConfigurator, string appVersion)
{
}
public static void SetAppLocale(RawType propertyConfigurator, string appLocale)
{
}
public static void CollectDeviceId(RawType propertyConfigurator)
{
}
public static void SetEventProperty(RawType propertyConfigurator, string key, string value)
{
}
public static void SetEventProperty(RawType propertyConfigurator, string key, DateTime value)
{
}
public static void SetEventProperty(RawType propertyConfigurator, string key, long value)
{
}
public static void SetEventProperty(RawType propertyConfigurator, string key, double value)
{
}
public static void SetEventProperty(RawType propertyConfigurator, string key, bool value)
{
}
public static void RemoveEventProperty(RawType propertyConfigurator, string key)
{
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 09033f50c9aa64a7bae8097136a84d14
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,75 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if (!UNITY_IOS && !UNITY_ANDROID && !UNITY_WSA_10_0) || UNITY_EDITOR
using Microsoft.AppCenter.Unity.Analytics.Internal;
using System;
using System.Collections.Generic;
namespace Microsoft.AppCenter.Unity.Analytics
{
#if UNITY_IOS
using RawType = System.IntPtr;
#elif UNITY_ANDROID
using RawType = UnityEngine.AndroidJavaObject;
#else
using RawType = System.Object;
#endif
public class TransmissionTargetInternal
{
public static void TrackEvent(RawType transmissionTarget, string eventName)
{
}
public static void TrackEvent(RawType transmissionTarget, string eventName, int flags)
{
}
public static void TrackEventWithProperties(RawType transmissionTarget, string eventName, IDictionary<string, string> properties)
{
}
public static void TrackEventWithProperties(RawType transmissionTarget, string eventName, EventProperties properties)
{
}
public static void TrackEventWithProperties(RawType transmissionTarget, string eventName, IDictionary<string, string> properties, int flags)
{
}
public static void TrackEventWithProperties(RawType transmissionTarget, string eventName, EventProperties properties, int flags)
{
}
public static AppCenterTask SetEnabledAsync(RawType transmissionTarget, bool enabled)
{
return AppCenterTask.FromCompleted();
}
public static AppCenterTask<bool> IsEnabledAsync(RawType transmissionTarget)
{
return AppCenterTask<bool>.FromCompleted(false);
}
public static RawType GetTransmissionTarget(RawType transmissionTargetParent, string transmissionTargetToken, out bool success)
{
success = false;
return default(RawType);
}
public static RawType GetPropertyConfigurator(RawType transmissionTargetParent)
{
return default(RawType);
}
public static void Pause(RawType transmissionTargetParent)
{
}
public static void Resume(RawType transmissionTargetParent)
{
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 619352a0db14645c2a7441de0d98e790
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 7c61caec9e69a40ae90907778a8ccc69
folderAsset: yes
timeCreated: 1503941147
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,120 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using System.Collections.Generic;
using Microsoft.AppCenter.Unity.Analytics.Internal;
namespace Microsoft.AppCenter.Unity.Analytics
{
#if UNITY_IOS || UNITY_ANDROID
using RawType = System.IntPtr;
#else
using RawType = System.Type;
#endif
public class Analytics
{
// Used by App Center Unity Editor Extensions: https://github.com/Microsoft/AppCenter-SDK-Unity-Extension
public const string AnalyticsSDKVersion = "4.3.0";
public static void PrepareEventHandlers()
{
AnalyticsInternal.PrepareEventHandlers();
}
public static void AddNativeType(List<RawType> nativeTypes)
{
AnalyticsInternal.AddNativeType(nativeTypes);
}
public static void TrackEvent(string eventName)
{
AnalyticsInternal.TrackEvent(eventName);
}
public static void TrackEvent(string eventName, Flags flags)
{
AnalyticsInternal.TrackEvent(eventName, (int)flags);
}
public static void TrackEvent(string eventName, IDictionary<string, string> properties)
{
if (properties == null)
{
TrackEvent(eventName);
}
else
{
AnalyticsInternal.TrackEventWithProperties(eventName, properties);
}
}
public static void TrackEvent(string eventName, IDictionary<string, string> properties, Flags flags)
{
if (properties == null)
{
TrackEvent(eventName, flags);
}
else
{
AnalyticsInternal.TrackEventWithProperties(eventName, properties, (int)flags);
}
}
public static void TrackEvent(string eventName, EventProperties properties)
{
if (properties == null)
{
TrackEvent(eventName);
}
else
{
AnalyticsInternal.TrackEventWithProperties(eventName, properties);
}
}
public static void TrackEvent(string eventName, EventProperties properties, Flags flags)
{
if (properties == null)
{
TrackEvent(eventName, flags);
}
else
{
AnalyticsInternal.TrackEventWithProperties(eventName, properties, (int)flags);
}
}
public static AppCenterTask<bool> IsEnabledAsync()
{
return AnalyticsInternal.IsEnabledAsync();
}
public static AppCenterTask SetEnabledAsync(bool enabled)
{
return AnalyticsInternal.SetEnabledAsync(enabled);
}
public static TransmissionTarget GetTransmissionTarget(string transmissionTargetToken)
{
if (string.IsNullOrEmpty(transmissionTargetToken))
{
return null;
}
bool success;
var internalObject = AnalyticsInternal.GetTransmissionTarget(transmissionTargetToken, out success);
return success ? new TransmissionTarget(internalObject) : null;
}
public static void Pause()
{
AnalyticsInternal.Pause();
}
public static void Resume()
{
AnalyticsInternal.Resume();
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: fd0e9bac2bb4245b3b6cd71e07030c30
timeCreated: 1497463739
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,64 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using System.Collections.Generic;
using Microsoft.AppCenter.Unity.Analytics.Internal;
namespace Microsoft.AppCenter.Unity.Analytics
{
#if UNITY_IOS
using RawType = System.IntPtr;
#elif UNITY_ANDROID
using RawType = UnityEngine.AndroidJavaObject;
#elif UNITY_WSA_10_0 && !UNITY_EDITOR
using RawType = Dictionary<string, string>;
#else
using RawType = System.Object;
#endif
public class EventProperties
{
private readonly RawType _rawObject;
internal RawType GetRawObject()
{
return _rawObject;
}
public EventProperties()
{
_rawObject = EventPropertiesInternal.Create();
}
public EventProperties Set(string key, string val)
{
EventPropertiesInternal.SetString(_rawObject, key, val);
return this;
}
public EventProperties Set(string key, DateTime val)
{
EventPropertiesInternal.SetDate(_rawObject, key, val);
return this;
}
public EventProperties Set(string key, long val)
{
EventPropertiesInternal.SetNumber(_rawObject, key, val);
return this;
}
public EventProperties Set(string key, double val)
{
EventPropertiesInternal.SetNumber(_rawObject, key, val);
return this;
}
public EventProperties Set(string key, bool val)
{
EventPropertiesInternal.SetBool(_rawObject, key, val);
return this;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 004bef03efe4b5e498ec3de493d64e96
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,24 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
namespace Microsoft.AppCenter.Unity.Analytics
{
/// <summary>
/// Persistence and latency flags for telemetry.
/// </summary>
[Flags]
public enum Flags
{
/// <summary>
/// An event can be lost due to low bandwidth or disk space constraints.
/// </summary>
PersistenceNormal = 0x01,
/// <summary>
/// Used for events that should be prioritized over non-critical events.
/// </summary>
PersistenceCritical = 0x02
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2beeb33194756f94ea1a4d58e51de1b9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,87 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using Microsoft.AppCenter.Unity.Analytics.Internal;
using System;
using System.Collections.Generic;
namespace Microsoft.AppCenter.Unity.Analytics
{
#if UNITY_IOS
using RawType = System.IntPtr;
#elif UNITY_ANDROID
using RawType = UnityEngine.AndroidJavaObject;
#else
using RawType = System.Object;
#endif
public class PropertyConfigurator
{
private readonly RawType _rawObject;
internal RawType GetRawObject()
{
return _rawObject;
}
public PropertyConfigurator(RawType rawObject)
{
_rawObject = rawObject;
}
public void SetAppName(string appName)
{
PropertyConfiguratorInternal.SetAppName(_rawObject, appName);
}
public void SetAppVersion(string appVersion)
{
PropertyConfiguratorInternal.SetAppVersion(_rawObject, appVersion);
}
public void SetAppLocale(string appLocale)
{
PropertyConfiguratorInternal.SetAppLocale(_rawObject, appLocale);
}
public void SetEventProperty(string key, string value)
{
PropertyConfiguratorInternal.SetEventProperty(_rawObject, key, value);
}
public void SetEventProperty(string key, DateTime value)
{
PropertyConfiguratorInternal.SetEventProperty(_rawObject, key, value);
}
public void SetEventProperty(string key, long value)
{
PropertyConfiguratorInternal.SetEventProperty(_rawObject, key, value);
}
public void SetEventProperty(string key, double value)
{
PropertyConfiguratorInternal.SetEventProperty(_rawObject, key, value);
}
public void SetEventProperty(string key, bool value)
{
PropertyConfiguratorInternal.SetEventProperty(_rawObject, key, value);
}
public void SetUserId(string userId)
{
PropertyConfiguratorInternal.SetUserId(_rawObject, userId);
}
public void RemoveEventProperty(string key)
{
PropertyConfiguratorInternal.RemoveEventProperty(_rawObject, key);
}
public void CollectDeviceId()
{
PropertyConfiguratorInternal.CollectDeviceId(_rawObject);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 55fb0e0927ff24e679c9231f38c6d0ab
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,126 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using Microsoft.AppCenter.Unity.Analytics.Internal;
using System;
using System.Collections.Generic;
namespace Microsoft.AppCenter.Unity.Analytics
{
#if UNITY_IOS
using RawType = System.IntPtr;
#elif UNITY_ANDROID
using RawType = UnityEngine.AndroidJavaObject;
#else
using RawType = System.Object;
#endif
public class TransmissionTarget
{
private readonly RawType _rawObject;
internal RawType GetRawObject()
{
return _rawObject;
}
public TransmissionTarget(RawType rawObject)
{
_rawObject = rawObject;
}
public void TrackEvent(string eventName)
{
TransmissionTargetInternal.TrackEvent(_rawObject, eventName);
}
public void TrackEvent(string eventName, Flags flags)
{
TransmissionTargetInternal.TrackEvent(_rawObject, eventName, (int)flags);
}
public void TrackEvent(string eventName, IDictionary<string, string> properties)
{
if (properties == null)
{
TrackEvent(eventName);
}
else
{
TransmissionTargetInternal.TrackEventWithProperties(_rawObject, eventName, properties);
}
}
public void TrackEvent(string eventName, IDictionary<string, string> properties, Flags flags)
{
if (properties == null)
{
TrackEvent(eventName, flags);
}
else
{
TransmissionTargetInternal.TrackEventWithProperties(_rawObject, eventName, properties, (int)flags);
}
}
public void TrackEvent(string eventName, EventProperties properties)
{
if (properties == null)
{
TrackEvent(eventName);
}
else
{
TransmissionTargetInternal.TrackEventWithProperties(_rawObject, eventName, properties);
}
}
public void TrackEvent(string eventName, EventProperties properties, Flags flags)
{
if (properties == null)
{
TrackEvent(eventName, flags);
}
else
{
TransmissionTargetInternal.TrackEventWithProperties(_rawObject, eventName, properties, (int)flags);
}
}
public AppCenterTask<bool> IsEnabledAsync()
{
return TransmissionTargetInternal.IsEnabledAsync(_rawObject);
}
public AppCenterTask SetEnabledAsync(bool enabled)
{
return TransmissionTargetInternal.SetEnabledAsync(_rawObject, enabled);
}
public TransmissionTarget GetTransmissionTarget(string childTransmissionTargetToken)
{
if (string.IsNullOrEmpty(childTransmissionTargetToken))
{
return null;
}
bool success;
var internalObject = TransmissionTargetInternal.GetTransmissionTarget(_rawObject, childTransmissionTargetToken, out success);
return success ? new TransmissionTarget(internalObject) : null;
}
public PropertyConfigurator GetPropertyConfigurator()
{
return new PropertyConfigurator(TransmissionTargetInternal.GetPropertyConfigurator(_rawObject));
}
public void Pause()
{
TransmissionTargetInternal.Pause(_rawObject);
}
public void Resume()
{
TransmissionTargetInternal.Resume(_rawObject);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 713452dbc18f44e7da0005d414778b9a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: cef4f7e70caf5421c90c88fbceecc910
folderAsset: yes
timeCreated: 1499378836
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,87 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_WSA_10_0 && !UNITY_EDITOR
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Microsoft.AppCenter.Unity.Analytics.Internal
{
using UWPAnalytics = Microsoft.AppCenter.Analytics.Analytics;
class AnalyticsInternal
{
private static bool _warningLogged = false;
public static void PrepareEventHandlers()
{
}
public static void AddNativeType(List<Type> nativeTypes)
{
nativeTypes.Add(typeof(UWPAnalytics));
}
public static void TrackEvent(string eventName)
{
UWPAnalytics.TrackEvent(eventName);
}
public static void TrackEvent(string eventName, int flags)
{
TrackEvent(eventName);
}
public static void TrackEventWithProperties(string eventName, IDictionary<string, string> properties)
{
UWPAnalytics.TrackEvent(eventName, properties);
}
public static void TrackEventWithProperties(string eventName, EventProperties properties)
{
if (!_warningLogged)
{
Debug.LogWarning("Warning: Strongly typed properties are not supported on UWP platform. " +
"All property values will be converted to strings for this and all the future calls.");
_warningLogged = true;
}
UWPAnalytics.TrackEvent(eventName, properties.GetRawObject());
}
public static void TrackEventWithProperties(string eventName, IDictionary<string, string> properties, int flags)
{
TrackEventWithProperties(eventName, properties);
}
public static void TrackEventWithProperties(string eventName, EventProperties properties, int flags)
{
TrackEventWithProperties(eventName, properties);
}
public static AppCenterTask SetEnabledAsync(bool isEnabled)
{
return new AppCenterTask(UWPAnalytics.SetEnabledAsync(isEnabled));
}
public static AppCenterTask<bool> IsEnabledAsync()
{
return new AppCenterTask<bool>(UWPAnalytics.IsEnabledAsync());
}
public static Type GetTransmissionTarget(string transmissionTargetToken, out bool success)
{
success = false;
return null;
}
public static void Pause()
{
}
public static void Resume()
{
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 9a6f77be941594c1389be7cfade7f372
timeCreated: 1499378836
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,46 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_WSA_10_0 && !UNITY_EDITOR
using System;
using System.Collections.Generic;
using System.Globalization;
namespace Microsoft.AppCenter.Unity.Analytics.Internal
{
class EventPropertiesInternal
{
public static Dictionary<string, string> Create()
{
return new Dictionary<string, string>();
}
public static void SetString(Dictionary<string, string> properties, string key, string val)
{
properties[key] = val;
}
public static void SetNumber(Dictionary<string, string> properties, string key, long val)
{
properties[key] = val.ToString(CultureInfo.InvariantCulture);
}
public static void SetNumber(Dictionary<string, string> properties, string key, double val)
{
properties[key] = val.ToString(CultureInfo.InvariantCulture);
}
public static void SetBool(Dictionary<string, string> properties, string key, bool val)
{
properties[key] = val.ToString();
}
public static void SetDate(Dictionary<string, string> properties, string key, DateTime val)
{
var format = "yyyy-MM-dd'T'HH:mm:ss.fffK";
var dateString = val.ToString(format, CultureInfo.InvariantCulture);
properties[key] = dateString;
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d05cde6a93c1790458dbfb4a909075e9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,58 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_WSA_10_0 && !UNITY_EDITOR
using System;
using System.Collections.Generic;
using Microsoft.AppCenter.Unity.Analytics.Internal;
namespace Microsoft.AppCenter.Unity.Analytics
{
public class PropertyConfiguratorInternal
{
public static void SetAppName(object propertyConfigurator, string appName)
{
}
public static void SetUserId(object propertyConfigurator, string userId)
{
}
public static void SetAppVersion(object propertyConfigurator, string appVersion)
{
}
public static void SetAppLocale(object propertyConfigurator, string appLocale)
{
}
public static void SetEventProperty(object propertyConfigurator, string key, string value)
{
}
public static void SetEventProperty(object propertyConfigurator, string key, DateTime value)
{
}
public static void SetEventProperty(object propertyConfigurator, string key, long value)
{
}
public static void SetEventProperty(object propertyConfigurator, string key, double value)
{
}
public static void SetEventProperty(object propertyConfigurator, string key, bool value)
{
}
public static void RemoveEventProperty(object propertyConfigurator, string key)
{
}
public static void CollectDeviceId(object propertyConfigurator)
{
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1da96695a43e9487086154cd35a3b8d0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,67 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_WSA_10_0 && !UNITY_EDITOR
using Microsoft.AppCenter.Unity.Analytics.Internal;
using System;
using System.Collections.Generic;
namespace Microsoft.AppCenter.Unity.Analytics
{
public class TransmissionTargetInternal
{
public static void TrackEvent(object transmissionTarget, string eventName)
{
}
public static void TrackEvent(object transmissionTarget, string eventName, int flags)
{
}
public static void TrackEventWithProperties(object transmissionTarget, string eventName, IDictionary<string, string> properties)
{
}
public static void TrackEventWithProperties(object transmissionTarget, string eventName, EventProperties properties)
{
}
public static void TrackEventWithProperties(object transmissionTarget, string eventName, IDictionary<string, string> properties, int flags)
{
}
public static void TrackEventWithProperties(object transmissionTarget, string eventName, EventProperties properties, int flags)
{
}
public static AppCenterTask SetEnabledAsync(object transmissionTarget, bool enabled)
{
return AppCenterTask.FromCompleted();
}
public static AppCenterTask<bool> IsEnabledAsync(object transmissionTarget)
{
return AppCenterTask<bool>.FromCompleted(false);
}
public static TransmissionTargetInternal GetTransmissionTarget(object transmissionTargetParent, string transmissionTargetToken, out bool success)
{
success = false;
return null;
}
public static PropertyConfiguratorInternal GetPropertyConfigurator(object transmissionTargetParent)
{
return null;
}
public static void Pause(object transmissionTarget)
{
}
public static void Resume(object transmissionTarget)
{
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cef60ebaae8af49db8dc3de5394263ae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: eac6a5c11600045b39d3063cb58cd244
folderAsset: yes
timeCreated: 1498059871
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,114 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_IOS && !UNITY_EDITOR
using System;
using System.Linq;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Microsoft.AppCenter.Unity.Analytics.Internal
{
class AnalyticsInternal
{
public static void PrepareEventHandlers()
{
}
public static void AddNativeType(List<IntPtr> nativeTypes)
{
nativeTypes.Add(appcenter_unity_analytics_get_type());
}
public static void TrackEvent(string eventName)
{
appcenter_unity_analytics_track_event(eventName, (int)Flags.PersistenceNormal);
}
public static void TrackEvent(string eventName, int flags)
{
appcenter_unity_analytics_track_event(eventName, flags);
}
public static void TrackEventWithProperties(string eventName, EventProperties properties)
{
appcenter_unity_analytics_track_event_with_typed_properties(eventName, properties.GetRawObject(), (int)Flags.PersistenceNormal);
}
public static void TrackEventWithProperties(string eventName, IDictionary<string, string> properties)
{
appcenter_unity_analytics_track_event_with_properties(eventName, properties.Keys.ToArray(), properties.Values.ToArray(), properties.Count, (int)Flags.PersistenceNormal);
}
public static void TrackEventWithProperties(string eventName, EventProperties properties, int flags)
{
appcenter_unity_analytics_track_event_with_typed_properties(eventName, properties.GetRawObject(), flags);
}
public static void TrackEventWithProperties(string eventName, IDictionary<string, string> properties, int flags)
{
appcenter_unity_analytics_track_event_with_properties(eventName, properties.Keys.ToArray(), properties.Values.ToArray(), properties.Count, flags);
}
public static AppCenterTask SetEnabledAsync(bool isEnabled)
{
appcenter_unity_analytics_set_enabled(isEnabled);
return AppCenterTask.FromCompleted();
}
public static AppCenterTask<bool> IsEnabledAsync()
{
var isEnabled = appcenter_unity_analytics_is_enabled();
return AppCenterTask<bool>.FromCompleted(isEnabled);
}
public static IntPtr GetTransmissionTarget(string transmissionTargetToken, out bool success)
{
var target = appcenter_unity_analytics_transmission_target_for_token(transmissionTargetToken);
success = target != IntPtr.Zero;
return target;
}
public static void Pause()
{
appcenter_unity_analytics_pause();
}
public static void Resume()
{
appcenter_unity_analytics_resume();
}
#region External
[DllImport("__Internal")]
private static extern IntPtr appcenter_unity_analytics_get_type();
[DllImport("__Internal")]
private static extern void appcenter_unity_analytics_track_event(string eventName, int flags);
[DllImport("__Internal")]
private static extern void appcenter_unity_analytics_track_event_with_properties(string eventName, string[] keys, string[] values, int count, int flags);
[DllImport("__Internal")]
private static extern void appcenter_unity_analytics_track_event_with_typed_properties(string eventName, IntPtr properties, int flags);
[DllImport("__Internal")]
private static extern void appcenter_unity_analytics_set_enabled(bool isEnabled);
[DllImport("__Internal")]
private static extern bool appcenter_unity_analytics_is_enabled();
[DllImport("__Internal")]
private static extern IntPtr appcenter_unity_analytics_transmission_target_for_token(string transmissionTargetToken);
[DllImport("__Internal")]
private static extern void appcenter_unity_analytics_pause();
[DllImport("__Internal")]
private static extern void appcenter_unity_analytics_resume();
#endregion
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: cc68bbbb6d6464cec8e7a070fc38b921
timeCreated: 1497463657
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,65 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_IOS && !UNITY_EDITOR
using System;
using System.Runtime.InteropServices;
using Microsoft.AppCenter.Unity.Internal.Utility;
namespace Microsoft.AppCenter.Unity.Analytics.Internal
{
class EventPropertiesInternal
{
public static IntPtr Create()
{
return appcenter_unity_analytics_create_event_properties();
}
public static void SetString(IntPtr properties, string key, string val)
{
appcenter_unity_analytics_event_properties_set_string(properties, key, val);
}
public static void SetNumber(IntPtr properties, string key, long val)
{
appcenter_unity_analytics_event_properties_set_long(properties, key, val);
}
public static void SetNumber(IntPtr properties, string key, double val)
{
appcenter_unity_analytics_event_properties_set_double(properties, key, val);
}
public static void SetBool(IntPtr properties, string key, bool val)
{
appcenter_unity_analytics_event_properties_set_bool(properties, key, val);
}
public static void SetDate(IntPtr properties, string key, DateTime val)
{
appcenter_unity_analytics_event_properties_set_date(properties, key, NSDateHelper.DateTimeConvert(val));
}
#region External
[DllImport("__Internal")]
private static extern IntPtr appcenter_unity_analytics_create_event_properties();
[DllImport("__Internal")]
private static extern void appcenter_unity_analytics_event_properties_set_string(IntPtr properties, string key, string val);
[DllImport("__Internal")]
private static extern void appcenter_unity_analytics_event_properties_set_long(IntPtr properties, string key, long val);
[DllImport("__Internal")]
private static extern void appcenter_unity_analytics_event_properties_set_double(IntPtr properties, string key, double val);
[DllImport("__Internal")]
private static extern void appcenter_unity_analytics_event_properties_set_bool(IntPtr properties, string key, bool val);
[DllImport("__Internal")]
private static extern void appcenter_unity_analytics_event_properties_set_date(IntPtr properties, string key, IntPtr val);
#endregion
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ebf8af998d139794cb3ce191795c70ac
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,109 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_IOS && !UNITY_EDITOR
using AOT;
using System;
using System.Linq;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Microsoft.AppCenter.Unity.Internal.Utility;
namespace Microsoft.AppCenter.Unity.Analytics.Internal
{
public class PropertyConfiguratorInternal
{
public static void SetAppName(IntPtr propertyConfigurator, string appName)
{
appcenter_unity_property_configurator_set_app_name(propertyConfigurator, appName);
}
public static void SetUserId(IntPtr propertyConfigurator, string userId)
{
appcenter_unity_property_configurator_set_user_id(propertyConfigurator, userId);
}
public static void SetAppVersion(IntPtr propertyConfigurator, string appVersion)
{
appcenter_unity_property_configurator_set_app_version(propertyConfigurator, appVersion);
}
public static void SetAppLocale(IntPtr propertyConfigurator, string appLocale)
{
appcenter_unity_property_configurator_set_app_locale(propertyConfigurator, appLocale);
}
public static void SetEventProperty(IntPtr propertyConfigurator, string key, string value)
{
appcenter_unity_property_configurator_set_event_property(propertyConfigurator, key, value);
}
public static void SetEventProperty(IntPtr propertyConfigurator, string key, DateTime value)
{
appcenter_unity_property_configurator_set_event_datetime_property(propertyConfigurator, key, NSDateHelper.DateTimeConvert(value));
}
public static void SetEventProperty(IntPtr propertyConfigurator, string key, long value)
{
appcenter_unity_property_configurator_set_event_long_property(propertyConfigurator, key, value);
}
public static void SetEventProperty(IntPtr propertyConfigurator, string key, double value)
{
appcenter_unity_property_configurator_set_event_double_property(propertyConfigurator, key, value);
}
public static void SetEventProperty(IntPtr propertyConfigurator, string key, bool value)
{
appcenter_unity_property_configurator_set_event_bool_property(propertyConfigurator, key, value);
}
public static void CollectDeviceId(IntPtr propertyConfigurator)
{
appcenter_unity_property_configurator_collect_device_id(propertyConfigurator);
}
public static void RemoveEventProperty(IntPtr propertyConfigurator, string key)
{
appcenter_unity_property_configurator_remove_event_property(propertyConfigurator, key);
}
#region External
[DllImport("__Internal")]
private static extern void appcenter_unity_property_configurator_set_app_name(IntPtr propertyConfigurator, string appName);
[DllImport("__Internal")]
private static extern void appcenter_unity_property_configurator_set_user_id(IntPtr propertyConfigurator, string userId);
[DllImport("__Internal")]
private static extern void appcenter_unity_property_configurator_set_app_version(IntPtr propertyConfigurator, string appVersion);
[DllImport("__Internal")]
private static extern void appcenter_unity_property_configurator_set_app_locale(IntPtr propertyConfigurator, string appLocale);
[DllImport("__Internal")]
private static extern void appcenter_unity_property_configurator_set_event_property(IntPtr propertyConfigurator, string key, string value);
[DllImport("__Internal")]
private static extern void appcenter_unity_property_configurator_set_event_datetime_property(IntPtr propertyConfigurator, string key, IntPtr value);
[DllImport("__Internal")]
private static extern void appcenter_unity_property_configurator_set_event_long_property(IntPtr propertyConfigurator, string key, long value);
[DllImport("__Internal")]
private static extern void appcenter_unity_property_configurator_set_event_double_property(IntPtr propertyConfigurator, string key, double value);
[DllImport("__Internal")]
private static extern void appcenter_unity_property_configurator_set_event_bool_property(IntPtr propertyConfigurator, string key, bool value);
[DllImport("__Internal")]
private static extern void appcenter_unity_property_configurator_collect_device_id(IntPtr propertyConfigurator);
[DllImport("__Internal")]
private static extern void appcenter_unity_property_configurator_remove_event_property(IntPtr propertyConfigurator, string key);
#endregion
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 118ac3c5fef534a808089752a140c8a4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,110 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_IOS && !UNITY_EDITOR
using AOT;
using System;
using System.Linq;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Microsoft.AppCenter.Unity.Analytics.Internal
{
public class TransmissionTargetInternal
{
public static void TrackEvent(IntPtr transmissionTarget, string eventName)
{
appcenter_unity_transmission_target_track_event(transmissionTarget, eventName, (int)Flags.PersistenceNormal);
}
public static void TrackEvent(IntPtr transmissionTarget, string eventName, int flags)
{
appcenter_unity_transmission_target_track_event(transmissionTarget, eventName, flags);
}
public static void TrackEventWithProperties(IntPtr transmissionTarget, string eventName, IDictionary<string, string> properties)
{
appcenter_unity_transmission_target_track_event_with_props(transmissionTarget, eventName, properties.Keys.ToArray(), properties.Values.ToArray(), properties.Count, (int)Flags.PersistenceNormal);
}
public static void TrackEventWithProperties(IntPtr transmissionTarget, string eventName, EventProperties properties)
{
appcenter_unity_transmission_target_track_event_with_typed_props(transmissionTarget, eventName, properties.GetRawObject(), (int)Flags.PersistenceNormal);
}
public static void TrackEventWithProperties(IntPtr transmissionTarget, string eventName, IDictionary<string, string> properties, int flags)
{
appcenter_unity_transmission_target_track_event_with_props(transmissionTarget, eventName, properties.Keys.ToArray(), properties.Values.ToArray(), properties.Count, flags);
}
public static void TrackEventWithProperties(IntPtr transmissionTarget, string eventName, EventProperties properties, int flags)
{
appcenter_unity_transmission_target_track_event_with_typed_props(transmissionTarget, eventName, properties.GetRawObject(), flags);
}
public static AppCenterTask SetEnabledAsync(IntPtr transmissionTarget, bool enabled)
{
appcenter_unity_transmission_target_set_enabled(transmissionTarget, enabled);
return AppCenterTask.FromCompleted();
}
public static AppCenterTask<bool> IsEnabledAsync(IntPtr transmissionTarget)
{
bool isEnabled = appcenter_unity_transmission_target_is_enabled(transmissionTarget);
return AppCenterTask<bool>.FromCompleted(isEnabled);
}
public static IntPtr GetTransmissionTarget(IntPtr transmissionTargetParent, string transmissionTargetToken, out bool success)
{
var target = appcenter_unity_transmission_transmission_target_for_token(transmissionTargetParent, transmissionTargetToken);
success = target != IntPtr.Zero;
return target;
}
public static IntPtr GetPropertyConfigurator(IntPtr transmissionTarget)
{
return appcenter_unity_transmission_get_property_configurator(transmissionTarget);
}
public static void Pause(IntPtr transmissionTarget)
{
appcenter_unity_transmission_pause(transmissionTarget);
}
public static void Resume(IntPtr transmissionTarget)
{
appcenter_unity_transmission_resume(transmissionTarget);
}
#region External
[DllImport("__Internal")]
private static extern void appcenter_unity_transmission_target_track_event(IntPtr transmissionTarget, string eventName, int flags);
[DllImport("__Internal")]
private static extern void appcenter_unity_transmission_target_track_event_with_props(IntPtr transmissionTarget, string eventName, string[] keys, string[] values, int count, int flags);
[DllImport("__Internal")]
private static extern void appcenter_unity_transmission_target_track_event_with_typed_props(IntPtr transmissionTarget, string eventName, IntPtr properties, int flags);
[DllImport("__Internal")]
private static extern void appcenter_unity_transmission_target_set_enabled(IntPtr transmissionTarget, bool enabled);
[DllImport("__Internal")]
private static extern bool appcenter_unity_transmission_target_is_enabled(IntPtr transmissionTarget);
[DllImport("__Internal")]
private static extern IntPtr appcenter_unity_transmission_transmission_target_for_token(IntPtr transmissionTargetParent, string transmissionTargetToken);
[DllImport("__Internal")]
private static extern IntPtr appcenter_unity_transmission_get_property_configurator(IntPtr transmissionTarget);
[DllImport("__Internal")]
private static extern void appcenter_unity_transmission_pause(IntPtr transmissionTarget);
[DllImport("__Internal")]
private static extern void appcenter_unity_transmission_resume(IntPtr transmissionTarget);
#endregion
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cf780c8aecb2b4c2fa499bc69556e3e7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 31facfad6182ac54f887b05ac1c51e9f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 64a51ab5332d0455c9a66aaddf79e1df
folderAsset: yes
timeCreated: 1498059828
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,183 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_ANDROID && !UNITY_EDITOR
using Assets.AppCenter.Plugins.Android.Utility;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Microsoft.AppCenter.Unity.Internal
{
class AppCenterInternal
{
private static AndroidJavaClass _appCenter = new AndroidJavaClass("com.microsoft.appcenter.AppCenter");
public static void SetLogLevel(int logLevel)
{
_appCenter.CallStatic("setLogLevel", logLevel);
}
public static int GetLogLevel()
{
return _appCenter.CallStatic<int>("getLogLevel");
}
public static bool IsConfigured()
{
return _appCenter.CallStatic<bool>("isConfigured");
}
public static void SetLogUrl(string logUrl)
{
_appCenter.CallStatic("setLogUrl", logUrl);
}
public static void SetUserId(string userId)
{
_appCenter.CallStatic("setUserId", userId);
}
public static string GetSdkVersion()
{
return _appCenter.CallStatic<string>("getSdkVersion");
}
public static void SetNetworkRequestsAllowed(bool isAllowed)
{
_appCenter.CallStatic("setNetworkRequestsAllowed", isAllowed);
}
public static bool IsNetworkRequestsAllowed()
{
return _appCenter.CallStatic<bool>("isNetworkRequestsAllowed");
}
public static AppCenterTask SetEnabledAsync(bool enabled)
{
var future = _appCenter.CallStatic<AndroidJavaObject>("setEnabled", enabled);
return new AppCenterTask(future);
}
public static AppCenterTask<bool> IsEnabledAsync()
{
var future = _appCenter.CallStatic<AndroidJavaObject>("isEnabled");
return new AppCenterTask<bool>(future);
}
public static AppCenterTask<string> GetInstallIdAsync()
{
AndroidJavaObject future = _appCenter.CallStatic<AndroidJavaObject>("getInstallId");
var javaUUIDtask = new AppCenterTask<AndroidJavaObject>(future);
var stringTask = new AppCenterTask<string>();
javaUUIDtask.ContinueWith(t =>
{
var installId = t.Result == null ? null : t.Result.Call<string>("toString");
stringTask.SetResult(installId);
});
return stringTask;
}
public static void SetCustomProperties(AndroidJavaObject properties)
{
_appCenter.CallStatic("setCustomProperties", properties);
}
private static AndroidJavaObject GetAndroidApplication()
{
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
return activity.Call<AndroidJavaObject>("getApplication");
}
public static void SetWrapperSdk(string wrapperSdkVersion,
string wrapperSdkName,
string wrapperRuntimeVersion,
string liveUpdateReleaseLabel,
string liveUpdateDeploymentKey,
string liveUpdatePackageHash)
{
var wrapperSdkObject = new AndroidJavaObject("com.microsoft.appcenter.ingestion.models.WrapperSdk");
wrapperSdkObject.Call("setWrapperSdkVersion", wrapperSdkVersion);
wrapperSdkObject.Call("setWrapperSdkName", wrapperSdkName);
wrapperSdkObject.Call("setWrapperRuntimeVersion", wrapperRuntimeVersion);
wrapperSdkObject.Call("setLiveUpdateReleaseLabel", liveUpdateReleaseLabel);
wrapperSdkObject.Call("setLiveUpdateDeploymentKey", liveUpdateDeploymentKey);
wrapperSdkObject.Call("setLiveUpdatePackageHash", liveUpdatePackageHash);
_appCenter.CallStatic("setWrapperSdk", wrapperSdkObject);
}
public static void Start(string appSecret, Type[] services)
{
var nativeServiceTypes = ServicesToNativeTypes(services);
var rawAppSecretString = AndroidJNI.NewStringUTF(appSecret);
var startMethod = AndroidJNI.GetStaticMethodID(_appCenter.GetRawClass(), "start", "(Landroid/app/Application;Ljava/lang/String;[Ljava/lang/Class;)V");
AndroidJNI.CallStaticVoidMethod(_appCenter.GetRawClass(), startMethod, new jvalue[]
{
new jvalue { l = GetAndroidApplication().GetRawObject() },
new jvalue { l = rawAppSecretString },
new jvalue { l = nativeServiceTypes }
});
}
public static void Start(Type[] services)
{
var nativeServiceTypes = ServicesToNativeTypes(services);
var startMethod = AndroidJNI.GetStaticMethodID(_appCenter.GetRawClass(), "start", "(Landroid/app/Application;[Ljava/lang/Class;)V");
AndroidJNI.CallStaticVoidMethod(_appCenter.GetRawClass(), startMethod, new jvalue[]
{
new jvalue { l = GetAndroidApplication().GetRawObject() },
new jvalue { l = nativeServiceTypes }
});
}
public static void Start(Type service)
{
var nativeServiceTypes = ServicesToNativeTypes(new[] { service });
var startMethod = AndroidJNI.GetStaticMethodID(_appCenter.GetRawClass(), "start", "([Ljava/lang/Class;)V");
AndroidJNI.CallStaticVoidMethod(_appCenter.GetRawClass(), startMethod, new jvalue[]
{
new jvalue { l = nativeServiceTypes }
});
}
public static void StartFromLibrary(IntPtr servicesArray)
{
var startMethod = AndroidJNI.GetStaticMethodID(_appCenter.GetRawClass(), "startFromLibrary", "(Landroid/content/Context;[Ljava/lang/Class;)V");
AndroidJNI.CallStaticVoidMethod(_appCenter.GetRawClass(), startMethod, new jvalue[]
{
new jvalue { l = AndroidUtility.GetAndroidContext().GetRawObject() },
new jvalue { l = servicesArray }
});
}
public static IntPtr ServicesToNativeTypes(Type[] services)
{
var nativeTypes = new List<IntPtr>();
foreach (var serviceType in services)
{
serviceType.GetMethod("AddNativeType").Invoke(null, new object[] { nativeTypes });
}
var classClass = AndroidJNI.FindClass("java/lang/Class");
var array = AndroidJNI.NewObjectArray(nativeTypes.Count, classClass, classClass);
for (var i = 0; i < nativeTypes.Count; i++)
{
AndroidJNI.SetObjectArrayElement(array, i, nativeTypes[i]);
}
return array;
}
public static void SetMaxStorageSize(long size)
{
var future = _appCenter.CallStatic<AndroidJavaObject>("setMaxStorageSize", size);
new AppCenterTask<bool>(future).ContinueWith(task =>
{
if (!task.Result)
{
Debug.Log("Failed to set maximum storage size");
}
});
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b052932fad12b45e99d98bdef987081f
timeCreated: 1497286372
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,23 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_ANDROID && !UNITY_EDITOR
using UnityEngine;
namespace Microsoft.AppCenter.Unity
{
public partial class AppCenterTask
{
public AppCenterTask(AndroidJavaObject javaFuture)
{
var consumer = new UnityAppCenterConsumer<AndroidJavaObject>();
consumer.CompletionCallback = t =>
{
CompletionAction();
};
javaFuture.Call("thenAccept", consumer);
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 743be8834c3b3434f83ae6be8b0598b8
timeCreated: 1501260535
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,76 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_ANDROID && !UNITY_EDITOR
using System;
using System.Threading;
using UnityEngine;
namespace Microsoft.AppCenter.Unity
{
public partial class AppCenterTask<TResult>
{
private ManualResetEvent _completionEvent = new ManualResetEvent(false);
private TResult _result;
private Exception _exception;
private UnityAppCenterConsumer<TResult> _consumer = new UnityAppCenterConsumer<TResult>();
// This will block if it is called before the task is complete
public TResult Result
{
get
{
// Locking in here is both unnecessary and can deadlock.
_completionEvent.WaitOne();
if (_exception == null)
{
return _result;
}
else
{
throw _exception;
}
}
}
public Exception Exception
{
get
{
return _exception;
}
}
public AppCenterTask(AndroidJavaObject javaFuture)
{
_consumer.CompletionCallback = SetResult;
javaFuture.Call("thenAccept", _consumer);
}
internal void SetResult(TResult result)
{
lock (_lockObject)
{
ThrowIfCompleted();
_consumer.CompletionCallback = null;
_result = result;
_completionEvent.Set();
CompletionAction();
}
}
internal void SetException(Exception exception)
{
lock (_lockObject)
{
ThrowIfCompleted();
_consumer.CompletionCallback = null;
_exception = exception;
_completionEvent.Set();
CompletionAction();
}
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 4f35f227321dc4f6f9c684801e5cce3d
timeCreated: 1501260535
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,59 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_ANDROID && !UNITY_EDITOR
using System;
using UnityEngine;
using Microsoft.AppCenter.Unity.Internal.Utility;
namespace Microsoft.AppCenter.Unity.Internal
{
class CustomPropertiesInternal
{
public static AndroidJavaObject Create()
{
return new AndroidJavaObject("com.microsoft.appcenter.CustomProperties");
}
public static void SetString(AndroidJavaObject properties, string key, string val)
{
properties.Call<AndroidJavaObject>("set", key, val);
}
public static void SetNumber(AndroidJavaObject properties, string key, int val)
{
properties.Call<AndroidJavaObject>("set", key, JavaNumberHelper.Convert(val));
}
public static void SetNumber(AndroidJavaObject properties, string key, long val)
{
properties.Call<AndroidJavaObject>("set", key, JavaNumberHelper.Convert(val));
}
public static void SetNumber(AndroidJavaObject properties, string key, float val)
{
properties.Call<AndroidJavaObject>("set", key, JavaNumberHelper.Convert(val));
}
public static void SetNumber(AndroidJavaObject properties, string key, double val)
{
properties.Call<AndroidJavaObject>("set", key, JavaNumberHelper.Convert(val));
}
public static void SetBool(AndroidJavaObject properties, string key, bool val)
{
properties.Call<AndroidJavaObject>("set", key, val);
}
public static void SetDate(AndroidJavaObject properties, string key, DateTime val)
{
properties.Call<AndroidJavaObject>("set", key, JavaDateHelper.DateTimeConvert(val));
}
public static void Clear(AndroidJavaObject properties, string key)
{
properties.Call<AndroidJavaObject>("clear", key);
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 01d13d2a6a4d8490f96dacdc75d302e6
timeCreated: 1498588175
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_ANDROID && !UNITY_EDITOR
using UnityEngine;
using System.Threading;
using System;
namespace Microsoft.AppCenter.Unity
{
public class UnityAppCenterConsumer<T> : AndroidJavaProxy
{
internal Action<T> CompletionCallback { get; set; }
internal UnityAppCenterConsumer() : base("com.microsoft.appcenter.utils.async.AppCenterConsumer")
{
}
void accept(T t)
{
if (CompletionCallback != null)
{
CompletionCallback(t);
}
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 4844f0b5e5fec474d80ba40cee8f67ca
timeCreated: 1501260535
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: c15b21220a835491784acc2a75ef6938
folderAsset: yes
timeCreated: 1498060019
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,125 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if (!UNITY_IOS && !UNITY_ANDROID && !UNITY_WSA_10_0) || UNITY_EDITOR
using System;
using Microsoft.AppCenter.Unity;
namespace Microsoft.AppCenter.Unity.Internal
{
#if UNITY_IOS && !UNITY_EDITOR
using RawType = System.IntPtr;
using ServiceType = System.IntPtr;
#elif UNITY_ANDROID && !UNITY_EDITOR
using RawType = UnityEngine.AndroidJavaObject;
using ServiceType = System.IntPtr;
#else
using RawType = System.Object;
using ServiceType = System.Type;
#endif
class AppCenterInternal
{
public static void Configure(string appSecret)
{
}
public static string GetSdkVersion()
{
return "";
}
public static void Start(string appSecret, ServiceType[] services, int numServices)
{
}
public static void StartServices(ServiceType[] services, int numServices)
{
}
public static void Start(string appSecret, ServiceType[] services)
{
}
public static void Start(ServiceType[] services)
{
}
public static void Start(ServiceType service)
{
}
public static void StartFromLibrary(ServiceType[] services)
{
}
public static void SetLogLevel(int logLevel)
{
}
public static void SetUserId(string userId)
{
}
public static int GetLogLevel()
{
return 0;
}
public static bool IsConfigured()
{
return false;
}
public static void SetLogUrl(string logUrl)
{
}
public static bool IsNetworkRequestsAllowed()
{
return true;
}
public static void SetNetworkRequestsAllowed(bool isAllowed)
{
}
public static AppCenterTask SetEnabledAsync(bool enabled)
{
return AppCenterTask.FromCompleted();
}
public static AppCenterTask<bool> IsEnabledAsync()
{
return AppCenterTask<bool>.FromCompleted(false);
}
public static AppCenterTask<string> GetInstallIdAsync()
{
return AppCenterTask<string>.FromCompleted("");
}
public static void SetCustomProperties(RawType properties)
{
}
public static void SetWrapperSdk(string wrapperSdkVersion,
string wrapperSdkName,
string wrapperRuntimeVersion,
string liveUpdateReleaseLabel,
string liveUpdateDeploymentKey,
string liveUpdatePackageHash)
{
}
public static ServiceType[] ServicesToNativeTypes(ServiceType[] services)
{
return null;
}
public static void SetMaxStorageSize(long size)
{
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 7050ffe906ee8c14e8dc588aab4acd37
timeCreated: 1497373095
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,37 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if (!UNITY_IOS && !UNITY_ANDROID && !UNITY_WSA_10_0) || UNITY_EDITOR
using System;
namespace Microsoft.AppCenter.Unity
{
public partial class AppCenterTask<TResult>
{
public TResult Result { get; private set; }
public Exception Exception { get; private set; }
internal void SetResult(TResult result)
{
lock (_lockObject)
{
ThrowIfCompleted();
Result = result;
CompletionAction();
}
}
internal void SetException(Exception exception)
{
lock (_lockObject)
{
ThrowIfCompleted();
Exception = exception;
CompletionAction();
}
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 6f7f7f60f8159444190ef178255060ca
timeCreated: 1501269073
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,45 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if (!UNITY_IOS && !UNITY_ANDROID && !UNITY_WSA_10_0) || UNITY_EDITOR
using System;
namespace Microsoft.AppCenter.Unity.Internal
{
#if UNITY_IOS
using RawType = System.IntPtr;
#elif UNITY_ANDROID
using RawType = UnityEngine.AndroidJavaObject;
#else
using RawType = System.Object;
#endif
class CustomPropertiesInternal
{
public static RawType Create()
{
return default(RawType);
}
public static void SetString(RawType properties, string key, string val)
{
}
public static void SetNumber(RawType properties, string key, object val)
{
}
public static void SetBool(RawType properties, string key, bool val)
{
}
public static void SetDate(RawType properties, string key, DateTime val)
{
}
public static void Clear(RawType properties, string key)
{
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 74599edfdf514453db93e40271b07655
timeCreated: 1498578955
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 72df22763585c4a549241c3ae27c881a
folderAsset: yes
timeCreated: 1503694604
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,260 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using System.Collections;
using System.Reflection;
using Microsoft.AppCenter.Unity.Internal;
using UnityEngine;
using System.Runtime.InteropServices;
namespace Microsoft.AppCenter.Unity
{
#if UNITY_IOS || UNITY_ANDROID
using ServiceType = System.IntPtr;
#else
using ServiceType = System.Type;
#endif
public class AppCenter
{
private static AppCenterTask<string> _secretTask = new AppCenterTask<string>();
private static AppCenterTask<string> _logUrlTask = new AppCenterTask<string>();
private static AppCenterTask<long> _storageSizeTask = new AppCenterTask<long>();
public static LogLevel LogLevel
{
get { return (LogLevel)AppCenterInternal.GetLogLevel(); }
set { AppCenterInternal.SetLogLevel((int)value); }
}
public static AppCenterTask SetEnabledAsync(bool enabled)
{
return AppCenterInternal.SetEnabledAsync(enabled);
}
public static void StartFromLibrary(Type[] servicesArray)
{
AppCenterInternal.StartFromLibrary(AppCenterInternal.ServicesToNativeTypes(servicesArray));
}
public static AppCenterTask<bool> IsEnabledAsync()
{
return AppCenterInternal.IsEnabledAsync();
}
/// <summary>
/// Get the unique installation identifier for this application installation on this device.
/// </summary>
/// <remarks>
/// The identifier is lost if clearing application data or uninstalling application.
/// </remarks>
public static AppCenterTask<Guid?> GetInstallIdAsync()
{
var stringTask = AppCenterInternal.GetInstallIdAsync();
var guidTask = new AppCenterTask<Guid?>();
stringTask.ContinueWith(t =>
{
var installId = !string.IsNullOrEmpty(t.Result) ? new Guid(t.Result) : (Guid?)null;
guidTask.SetResult(installId);
});
return guidTask;
}
public static string GetSdkVersion()
{
return AppCenterInternal.GetSdkVersion();
}
public static AppCenterTask<string> GetLogUrlAsync()
{
if (_logUrlTask == null)
{
_logUrlTask = new AppCenterTask<string>();
}
return _logUrlTask;
}
public static AppCenterTask<long> GetStorageSizeAsync()
{
if (_storageSizeTask == null)
{
_storageSizeTask = new AppCenterTask<long>();
}
return _storageSizeTask;
}
/// <summary>
/// Change the base URL (scheme + authority + port only) used to communicate with the backend.
/// </summary>
/// <param name="logUrl">Base URL to use for server communication.</param>
public static void SetLogUrl(string logUrl)
{
AppCenterInternal.SetLogUrl(logUrl);
}
public static bool NetworkRequestsAllowed
{
get
{
return AppCenterInternal.IsNetworkRequestsAllowed();
}
set
{
AppCenterInternal.SetNetworkRequestsAllowed(value);
}
}
public static void CacheStorageSize(long storageSize)
{
if (_storageSizeTask != null)
{
_storageSizeTask.SetResult(storageSize);
}
}
public static void CacheLogUrl(string logUrl)
{
if (_logUrlTask != null)
{
_logUrlTask.SetResult(logUrl);
}
}
/// <summary>
/// Check whether SDK has already been configured or not.
/// </summary>
public static bool Configured
{
get { return AppCenterInternal.IsConfigured(); }
}
/// <summary>
/// Set the custom properties.
/// </summary>
/// <param name="customProperties">Custom properties object.</param>
public static void SetCustomProperties(Unity.CustomProperties customProperties)
{
var rawCustomProperties = customProperties.GetRawObject();
AppCenterInternal.SetCustomProperties(rawCustomProperties);
}
public static void SetWrapperSdk()
{
AppCenterInternal.SetWrapperSdk(WrapperSdk.WrapperSdkVersion, WrapperSdk.Name, WrapperSdk.WrapperRuntimeVersion, null, null, null);
}
/// <summary>
// Gets cached secret.
/// </summary>
public static AppCenterTask<string> GetSecretForPlatformAsync()
{
if (_secretTask == null)
{
_secretTask = new AppCenterTask<string>();
}
return _secretTask;
}
// Gets the first instance of an app secret corresponding to the given platform name, or returns the string
// as-is if no identifier can be found.
public static string ParseAndSaveSecretForPlatform(string secrets)
{
var platformIdentifier = GetPlatformIdentifier();
if (platformIdentifier == null)
{
// Return as is for unsupported platform.
return secrets;
}
if (secrets == null)
{
// If "secrets" is null, return that and let the error be dealt
// with downstream.
return secrets;
}
// If there are no equals signs, then there are no named identifiers
if (!secrets.Contains("="))
{
return secrets;
}
var platformIndicator = platformIdentifier + "=";
var secretIdx = secrets.IndexOf(platformIndicator, StringComparison.Ordinal);
if (secretIdx == -1)
{
// If the platform indicator can't be found, return the original
// string and let the error be dealt with downstream.
return secrets;
}
secretIdx += platformIndicator.Length;
var platformSecret = string.Empty;
while (secretIdx < secrets.Length)
{
var nextChar = secrets[secretIdx++];
if (nextChar == ';')
{
break;
}
platformSecret += nextChar;
}
if (_secretTask != null)
{
_secretTask.SetResult(platformSecret);
}
return platformSecret;
}
public static void SetUserId(string userId)
{
AppCenterInternal.SetUserId(userId);
}
#if ENABLE_IL2CPP
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
public delegate void SetMaxStorageSizeCompletionHandler(bool result);
private static string GetPlatformIdentifier()
{
#if UNITY_IOS
return "ios";
#elif UNITY_ANDROID
return "android";
#elif UNITY_WSA_10_0
return "uwp";
#else
return null;
#endif
}
public static Type Analytics
{
get { return AppCenterAssembly.GetType("Microsoft.AppCenter.Unity.Analytics.Analytics"); }
}
public static Type Crashes
{
get { return AppCenterAssembly.GetType("Microsoft.AppCenter.Unity.Crashes.Crashes"); }
}
public static Type Distribute
{
get { return AppCenterAssembly.GetType("Microsoft.AppCenter.Unity.Distribute.Distribute"); }
}
private static Assembly AppCenterAssembly
{
get
{
#if !UNITY_EDITOR && UNITY_WSA_10_0
return typeof(AppCenterSettings).GetTypeInfo().Assembly;
#else
return Assembly.GetExecutingAssembly();
#endif
}
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e56c11cd54154473f90634ed7e9ca5ff
timeCreated: 1497042836
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,106 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using System.Collections.Generic;
namespace Microsoft.AppCenter.Unity
{
/// <summary>
/// AppCenterTask provides a way of performing long-running
/// tasks on any thread and invoking callbacks upon completion.
/// </summary>
public partial class AppCenterTask
{
private readonly List<Action<AppCenterTask>> _continuationActions = new List<Action<AppCenterTask>>();
protected readonly object _lockObject = new object();
/// <summary>
/// Gets a value indicating whether this <see cref="T:Microsoft.AppCenter.Unity.AppCenterTask"/> is complete.
/// </summary>
/// <value><c>true</c> if it is complete; otherwise, <c>false</c>.</value>
public bool IsComplete { get; private set; }
public AppCenterTask()
{
}
/// <summary>
/// Adds a callback that will be invoked once the task is complete. If
/// the task is already complete, it is invoked immediately after being set.
/// </summary>
/// <param name="continuationAction">Callback to be invoked after task completion.</param>
public void ContinueWith(Action<AppCenterTask> continuationAction)
{
lock (_lockObject)
{
_continuationActions.Add(continuationAction);
InvokeContinuationActions();
}
}
/// <summary>
/// Invokes callbacks and sets completion flag.
/// </summary>
protected virtual void CompletionAction()
{
lock (_lockObject)
{
IsComplete = true;
InvokeContinuationActions();
}
}
/// <summary>
/// Throws an exception if the task has completed.
/// </summary>
protected void ThrowIfCompleted()
{
lock (_lockObject)
{
if (IsComplete)
{
throw new InvalidOperationException("The task has already completed");
}
}
}
/// <summary>
/// Returns an already completed task.
/// </summary>
/// <returns>The completed task.</returns>
internal static AppCenterTask FromCompleted()
{
var task = new AppCenterTask();
task.CompletionAction();
return task;
}
private void InvokeContinuationActions()
{
// Save the actions and then invoke them; could have a deadlock
// if one of the actions calls ContinueWith on another thread for
// the same task object.
var continuationActionsSnapshot = new List<Action<AppCenterTask>>();
lock (_lockObject)
{
if (!IsComplete)
{
return;
}
foreach (var action in _continuationActions)
{
if (action != null)
{
continuationActionsSnapshot.Add(action);
}
}
_continuationActions.Clear();
}
foreach (var action in continuationActionsSnapshot)
{
action(this);
}
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 1b355d0a7f1d647e589c9af62ffdcb77
timeCreated: 1501260535
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,41 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if NET_4_6 || CSHARP_7_3_OR_NEWER || (UNITY_2018_3_OR_NEWER && NET_STANDARD_2_0)
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace Microsoft.AppCenter.Unity
{
public partial class AppCenterTask
{
public TaskAwaiter GetAwaiter()
{
var taskCompletionSource = new TaskCompletionSource<bool>();
ContinueWith(task => taskCompletionSource.SetResult(true));
return ((Task)taskCompletionSource.Task).GetAwaiter();
}
}
public partial class AppCenterTask<TResult>
{
public new TaskAwaiter<TResult> GetAwaiter()
{
var taskCompletionSource = new TaskCompletionSource<TResult>();
ContinueWith(task =>
{
if (task.Exception == null)
{
taskCompletionSource.SetResult(task.Result);
}
else{
taskCompletionSource.SetException(task.Exception);
}
});
return taskCompletionSource.Task.GetAwaiter();
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ce92b141edc605e43a3a3183c25b34fb
timeCreated: 1502286255
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,41 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
namespace Microsoft.AppCenter.Unity
{
/// <summary>
/// AppCenterTask&lt;TResult&gt; extends the functionality of AppCenterTask
/// to support return values.
/// </summary>
/// <typeparam name="TResult">The return type of the task.</typeparam>
/// <seealso cref="AppCenterTask"/>
public partial class AppCenterTask<TResult> : AppCenterTask
{
public AppCenterTask() : base()
{
}
/// <summary>
/// Adds a callback that will be invoked once the task is complete. If
/// the task is already complete, it is invoked immediately after being set.
/// </summary>
/// <param name="continuationAction">Callback to be invoked after task completion.</param>
public void ContinueWith(Action<AppCenterTask<TResult>> continuationAction)
{
base.ContinueWith(task => continuationAction(this));
}
/// <summary>
/// Returns an already completed task with a given result.
/// </summary>
/// <returns>The completed task.</returns>
internal static AppCenterTask<TResult> FromCompleted(TResult result)
{
var task = new AppCenterTask<TResult>();
task.SetResult(result);
return task;
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: dd2e77c86f30b4e44a532389560faf3e
timeCreated: 1501260535
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,15 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using UnityEngine;
namespace Microsoft.AppCenter.Unity
{
public partial class AppCenterTask : CustomYieldInstruction
{
public override bool keepWaiting
{
get { return !IsComplete; }
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: dea2e27c94e4e4b4c81b4066dbf1310f
timeCreated: 1502286090
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,133 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using Microsoft.AppCenter.Unity.Internal;
namespace Microsoft.AppCenter.Unity
{
#if UNITY_IOS
using RawType = System.IntPtr;
#elif UNITY_ANDROID
using RawType = UnityEngine.AndroidJavaObject;
#else
using RawType = System.Object;
#endif
public class CustomProperties
{
private readonly RawType _rawObject;
internal RawType GetRawObject()
{
return _rawObject;
}
public CustomProperties()
{
_rawObject = CustomPropertiesInternal.Create();
}
/// <summary>
/// Set the specified property value with the specified key.
/// If the properties previously contained a property for the key, the old value is replaced.
/// </summary>
/// <param name="key">Key with which the specified value is to be set.</param>
/// <param name="val">Value to be set with the specified key.</param>
/// <returns>This instance.</returns>
public CustomProperties Set(string key, string val)
{
CustomPropertiesInternal.SetString(_rawObject, key, val);
return this;
}
/// <summary>
/// Set the specified property value with the specified key.
/// If the properties previously contained a property for the key, the old value is replaced.
/// </summary>
/// <param name="key">Key with which the specified value is to be set.</param>
/// <param name="val">Value to be set with the specified key.</param>
/// <returns>This instance.</returns>
public CustomProperties Set(string key, DateTime val)
{
CustomPropertiesInternal.SetDate(_rawObject, key, val);
return this;
}
/// <summary>
/// Set the specified property value with the specified key.
/// If the properties previously contained a property for the key, the old value is replaced.
/// </summary>
/// <param name="key">Key with which the specified value is to be set.</param>
/// <param name="val">Value to be set with the specified key.</param>
/// <returns>This instance.</returns>
public CustomProperties Set(string key, int val)
{
CustomPropertiesInternal.SetNumber(_rawObject, key, val);
return this;
}
/// <summary>
/// Set the specified property value with the specified key.
/// If the properties previously contained a property for the key, the old value is replaced.
/// </summary>
/// <param name="key">Key with which the specified value is to be set.</param>
/// <param name="val">Value to be set with the specified key.</param>
/// <returns>This instance.</returns>
public CustomProperties Set(string key, long val)
{
CustomPropertiesInternal.SetNumber(_rawObject, key, val);
return this;
}
/// <summary>
/// Set the specified property value with the specified key.
/// If the properties previously contained a property for the key, the old value is replaced.
/// </summary>
/// <param name="key">Key with which the specified value is to be set.</param>
/// <param name="val">Value to be set with the specified key.</param>
/// <returns>This instance.</returns>
public CustomProperties Set(string key, float val)
{
CustomPropertiesInternal.SetNumber(_rawObject, key, val);
return this;
}
/// <summary>
/// Set the specified property value with the specified key.
/// If the properties previously contained a property for the key, the old value is replaced.
/// </summary>
/// <param name="key">Key with which the specified value is to be set.</param>
/// <param name="val">Value to be set with the specified key.</param>
/// <returns>This instance.</returns>
public CustomProperties Set(string key, double val)
{
CustomPropertiesInternal.SetNumber(_rawObject, key, val);
return this;
}
/// <summary>
/// Set the specified property value with the specified key.
/// If the properties previously contained a property for the key, the old value is replaced.
/// </summary>
/// <param name="key">Key with which the specified value is to be set.</param>
/// <param name="val">Value to be set with the specified key.</param>
/// <returns>This instance.</returns>
public CustomProperties Set(string key, bool val)
{
CustomPropertiesInternal.SetBool(_rawObject, key, val);
return this;
}
/// <summary>
/// Clear the property for the specified key.
/// </summary>
/// <param name="key">Key whose mapping is to be cleared.</param>
/// <returns>This instance.</returns>
public CustomProperties Clear(string key)
{
CustomPropertiesInternal.Clear(_rawObject, key);
return this;
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b5bc08888e1954d1586b49469659b087
timeCreated: 1498516072
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,110 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
namespace Microsoft.AppCenter.Unity
{
public class Device
{
/// <summary>
/// Name of the SDK.
/// </summary>
public string SdkName { get; private set; }
/// <summary>
/// Version of the SDK.
/// </summary>
public string SdkVersion { get; private set; }
/// <summary>
/// Device model (example: iPad2,3).
/// </summary>
public string Model { get; private set; }
/// <summary>
/// Device manufacturer (example: HTC).
/// </summary>
public string OemName { get; private set; }
/// <summary>
/// OS name (example: iOS).
/// </summary>
public string OsName { get; private set; }
/// <summary>
/// OS version (example: 9.3.0).
/// </summary>
public string OsVersion { get; private set; }
/// <summary>
/// OS build code (example: LMY47X).
/// </summary>
public string OsBuild { get; private set; }
/// <summary>
/// API level when applicable like in Android (example: 15).
/// </summary>
public int OsApiLevel { get; private set; }
/// <summary>
/// Language code (example: en_US).
/// </summary>
public string Locale { get; private set; }
/// <summary>
/// The offset in minutes from UTC for the device time zone, including daylight savings time.
/// </summary>
public int TimeZoneOffset { get; private set; }
/// <summary>
/// Screen size of the device in pixels (example: 640x480).
/// </summary>
public string ScreenSize { get; private set; }
/// <summary>
/// Application version name.
/// </summary>
public string AppVersion { get; private set; }
/// <summary>
/// Carrier name (for mobile devices).
/// </summary>
public string CarrierName { get; private set; }
/// <summary>
/// Carrier country code (for mobile devices).
/// </summary>
public string CarrierCountry { get; private set; }
/// <summary>
/// The app's build number, e.g. 42.
/// </summary>
public string AppBuild { get; private set; }
/// <summary>
/// The bundle identifier, package identifier, or namespace, depending on what the individual platforms use, .e.g com.microsoft.example.
/// </summary>
public string AppNamespace { get; private set; }
public Device(string sdkName, string sdkVersion, string model, string oemName, string osName, string osVersion, string osBuild,
int osApiLevel, string locale, int timeZoneOffset, string screenSize, string appVersion, string carrierName,
string carrierCountry, string appBuild, string appNamespace)
{
SdkName = sdkName;
SdkVersion = sdkVersion;
Model = model;
OemName = oemName;
OsName = osName;
OsVersion = osVersion;
OsBuild = osBuild;
OsApiLevel = osApiLevel;
Locale = locale;
TimeZoneOffset = timeZoneOffset;
ScreenSize = screenSize;
AppVersion = appVersion;
CarrierName = carrierName;
CarrierCountry = carrierCountry;
AppBuild = appBuild;
AppNamespace = appNamespace;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b59dd73cf53a7d2499c8a01185dcc11b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,50 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
namespace Microsoft.AppCenter.Unity
{
/// <summary>
/// Log level threshold for logs emitted by the SDK.
/// </summary>
public enum LogLevel
{
/// <summary>
/// SDK emits all possible level of logs.
/// </summary>
Verbose = 2,
/// <summary>
/// SDK emits debug, info, warn, error and assert logs.
/// </summary>
Debug = 3,
/// <summary>
/// SDK emits info, warn, error, and assert logs.
/// </summary>
Info = 4,
/// <summary>
/// SDK emits warn, error, and assert logs.
/// </summary>
Warn = 5,
/// <summary>
/// SDK error and assert logs.
/// </summary>
Error = 6,
/// <summary>
/// Only assert logs are emitted by SDK.
/// </summary>
Assert = 7,
/// <summary>
/// No log is emitted by SDK.
/// </summary>
#if UNITY_IOS
None = 99
#else
None = 8
#endif
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 81f2ae24f118f4c119ce594be70b0271
timeCreated: 1497285830
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,39 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
namespace Microsoft.AppCenter.Unity
{
/// <summary>
/// SDK Startup mode.
/// </summary>
public enum StartupType
{
/// <summary>
/// The app starts with SDK using an appSecret that is targeting AppCenter.
/// If you send events in the app it will thus go to App Center portal.
/// </summary>
AppCenter = 0,
/// <summary>
/// Only Analytics is usable, other modules appear disabled.
/// </summary>
OneCollector = 1,
/// <summary>
/// Events go to OneCollector, crashes go to AppCenter.
/// </summary>
Both = 2,
/// <summary>
/// Sending an event does nothing and you have to use alternate transmission targets.
/// Only the Analytics module appears enabled.
/// </summary>
NoSecret = 3,
/// <summary>
/// Don’t start the SDK: like NoSecret, except the SDK is not even started when launching the application.
/// All modules will appear disabled.
/// </summary>
Skip = 4
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4ae70a3509fd43342bbbe6b6527ef068
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,56 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using System.Collections;
using UnityEngine;
namespace Microsoft.AppCenter.Unity.Internal.Utils
{
#if UNITY_WSA_10_0
using WSAApplication = UnityEngine.WSA.Application;
#endif
public class UnityCoroutineHelper : MonoBehaviour
{
private static UnityCoroutineHelper Instance
{
get
{
var instance = FindObjectOfType<UnityCoroutineHelper>();
if (instance == null)
{
var gameObject = new GameObject("App Center Helper")
{
hideFlags = HideFlags.HideAndDontSave
};
DontDestroyOnLoad(gameObject);
instance = gameObject.AddComponent<UnityCoroutineHelper>();
}
return instance;
}
}
#if UNITY_WSA_10_0
public static void StartCoroutine(Func<IEnumerator> coroutine)
{
if (WSAApplication.RunningOnAppThread())
{
Instance.StartCoroutine(coroutine());
}
else
{
WSAApplication.InvokeOnAppThread(() =>
{
Instance.StartCoroutine(coroutine());
}, false);
}
}
#else
public static void StartCoroutine(Func<IEnumerator> coroutine)
{
Instance.StartCoroutine(coroutine());
}
#endif
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: de568185273ac461ebcb0c983415f3d8
timeCreated: 1502882164
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,42 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using System.Reflection;
namespace Microsoft.AppCenter.Unity
{
public static class WrapperSdk
{
private static string _wrapperRuntimeVersion;
private static bool _hasAttemptedToGetRuntimeVersion;
public const string Name = "appcenter.unity";
public const string WrapperSdkVersion = "4.3.0";
internal static string WrapperRuntimeVersion
{
get
{
// Use a flag instead of checking if _wrapperRuntimeVersion == null, because
// GetWrapperRuntimeVersion() can return null
return _hasAttemptedToGetRuntimeVersion ? _wrapperRuntimeVersion : (_wrapperRuntimeVersion = GetWrapperRuntimeVersion());
}
}
private static string GetWrapperRuntimeVersion()
{
_hasAttemptedToGetRuntimeVersion = true;
Type type = Type.GetType("Mono.Runtime");
if (type != null)
{
MethodInfo displayName = type.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static);
if (displayName != null)
{
return (string)displayName.Invoke(null, null);
}
}
return null;
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f8d397a69ce0a4b8c84b42327b4002ef
timeCreated: 1498672772
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 0264c79b11cbf46a5b28a709e86af451
folderAsset: yes
timeCreated: 1498600925
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,241 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_WSA_10_0 && !UNITY_EDITOR
#if ENABLE_DOTNET
#error .NET scripting backed is not supported. Use IL2CPP instead.
#endif
using Microsoft.AppCenter.Unity.Internal.Utils;
using Microsoft.AppCenter.Utils;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System;
namespace Microsoft.AppCenter.Unity.Internal
{
using UWPAppCenter = Microsoft.AppCenter.AppCenter;
class AppCenterInternal
{
private static bool _prepared = false;
private static object _lockObject = new object();
public static void Configure(string appSecret)
{
Prepare();
UWPAppCenter.Configure(appSecret);
}
public static void Start(string appSecret, Type[] services)
{
var nativeServiceTypes = ServicesToNativeTypes(services);
Prepare();
UWPAppCenter.Start(appSecret, nativeServiceTypes);
}
public static void Start(Type[] services)
{
var nativeServiceTypes = ServicesToNativeTypes(services);
Prepare();
UWPAppCenter.Start(nativeServiceTypes);
}
public static void Start(Type service)
{
}
public static string GetSdkVersion()
{
return "";
}
public static void StartServices(Type[] services, int numServices)
{
Prepare();
UWPAppCenter.Start(services);
}
public static void SetLogLevel(int logLevel)
{
Prepare();
UWPAppCenter.LogLevel = (Microsoft.AppCenter.LogLevel)LogLevelFromUnity(logLevel);
}
public static void SetUserId(string userId)
{
Prepare();
UWPAppCenter.SetUserId(userId);
}
public static int GetLogLevel()
{
Prepare();
return (int)LogLevelFromUnity((int)UWPAppCenter.LogLevel);
}
public static bool IsConfigured()
{
Prepare();
return UWPAppCenter.Configured;
}
public static void SetLogUrl(string logUrl)
{
Prepare();
UWPAppCenter.SetLogUrl(logUrl);
}
public static void SetNetworkRequestsAllowed(bool isAllowed)
{
Prepare();
UWPAppCenter.IsNetworkRequestsAllowed = isAllowed;
}
public static bool IsNetworkRequestsAllowed()
{
Prepare();
return UWPAppCenter.IsNetworkRequestsAllowed;
}
public static AppCenterTask SetEnabledAsync(bool isEnabled)
{
Prepare();
return new AppCenterTask(UWPAppCenter.SetEnabledAsync(isEnabled));
}
public static AppCenterTask<bool> IsEnabledAsync()
{
Prepare();
return new AppCenterTask<bool>(UWPAppCenter.IsEnabledAsync());
}
public static AppCenterTask<string> GetInstallIdAsync()
{
Prepare();
var installIdTask = UWPAppCenter.GetInstallIdAsync();
var stringTask = new AppCenterTask<string>();
installIdTask.ContinueWith(t =>
{
var installId = t.Result?.ToString();
stringTask.SetResult(installId);
});
return stringTask;
}
public static void SetCustomProperties(object properties)
{
Prepare();
var uwpProperties = properties as Microsoft.AppCenter.CustomProperties;
UWPAppCenter.SetCustomProperties(uwpProperties);
}
public static void SetWrapperSdk(string wrapperSdkVersion,
string wrapperSdkName,
string wrapperRuntimeVersion,
string liveUpdateReleaseLabel,
string liveUpdateDeploymentKey,
string liveUpdatePackageHash)
{
Prepare();
var wrapperSdk = new Microsoft.AppCenter.WrapperSdk(wrapperSdkName, wrapperSdkVersion, wrapperRuntimeVersion, liveUpdateReleaseLabel, liveUpdateDeploymentKey, liveUpdatePackageHash);
UWPAppCenter.SetWrapperSdk(wrapperSdk);
}
private static int LogLevelToUnity(int logLevel)
{
switch ((Microsoft.AppCenter.LogLevel)logLevel)
{
case Microsoft.AppCenter.LogLevel.Verbose:
return (int)Microsoft.AppCenter.Unity.LogLevel.Verbose;
case Microsoft.AppCenter.LogLevel.Debug:
return (int)Microsoft.AppCenter.Unity.LogLevel.Debug;
case Microsoft.AppCenter.LogLevel.Info:
return (int)Microsoft.AppCenter.Unity.LogLevel.Info;
case Microsoft.AppCenter.LogLevel.Warn:
return (int)Microsoft.AppCenter.Unity.LogLevel.Warn;
case Microsoft.AppCenter.LogLevel.Error:
return (int)Microsoft.AppCenter.Unity.LogLevel.Error;
case Microsoft.AppCenter.LogLevel.Assert:
return (int)Microsoft.AppCenter.Unity.LogLevel.Assert;
case Microsoft.AppCenter.LogLevel.None:
return (int)Microsoft.AppCenter.Unity.LogLevel.None;
default:
return logLevel;
}
}
private static Microsoft.AppCenter.LogLevel LogLevelFromUnity(int logLevel)
{
switch ((Microsoft.AppCenter.Unity.LogLevel)logLevel)
{
case Microsoft.AppCenter.Unity.LogLevel.Verbose:
return Microsoft.AppCenter.LogLevel.Verbose;
case Microsoft.AppCenter.Unity.LogLevel.Debug:
return Microsoft.AppCenter.LogLevel.Debug;
case Microsoft.AppCenter.Unity.LogLevel.Info:
return Microsoft.AppCenter.LogLevel.Info;
case Microsoft.AppCenter.Unity.LogLevel.Warn:
return Microsoft.AppCenter.LogLevel.Warn;
case Microsoft.AppCenter.Unity.LogLevel.Error:
return Microsoft.AppCenter.LogLevel.Error;
case Microsoft.AppCenter.Unity.LogLevel.Assert:
return Microsoft.AppCenter.LogLevel.Assert;
case Microsoft.AppCenter.Unity.LogLevel.None:
return Microsoft.AppCenter.LogLevel.None;
default:
return (Microsoft.AppCenter.LogLevel)logLevel;
}
}
public static void StartFromLibrary(Type[] services)
{
}
public static Type[] ServicesToNativeTypes(Type[] services)
{
var nativeTypes = new List<Type>();
foreach (var service in services)
{
service.GetMethod("AddNativeType").Invoke(null, new object[] { nativeTypes });
}
return nativeTypes.ToArray();
}
public static void SetMaxStorageSize(long size)
{
Prepare();
UWPAppCenter.SetMaxStorageSizeAsync(size);
}
private static void Prepare()
{
lock (_lockObject)
{
if (!_prepared)
{
UnityScreenSizeProvider.Initialize();
DeviceInformationHelper.SetScreenSizeProviderFactory(new UnityScreenSizeProviderFactory());
/**
* Workaround for known IL2CPP issue.
* Currently it is not required, but since this workaround stores settings in separate file,
* and not generic unity mechanism, a migration is required to transition users who store data in old file to built-in mechanism.
* See https://issuetracker.unity3d.com/issues/il2cpp-use-of-windows-dot-foundation-dot-collections-dot-propertyset-throws-a-notsupportedexception-on-uwp
*
* NotSupportedException: Cannot call method
* 'System.Boolean System.Runtime.InteropServices.WindowsRuntime.IMapToIDictionaryAdapter`2::System.Collections.Generic.IDictionary`2.TryGetValue(TKey,TValue&)'.
* IL2CPP does not yet support calling this projected method.
* TODO: Can be removed after migration for settings is added.
*/
UnityApplicationSettings.Initialize();
UWPAppCenter.SetApplicationSettingsFactory(new UnityApplicationSettingsFactory());
_prepared = true;
}
}
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 0ae3729a942dd41ca8c8152ae46b232e
timeCreated: 1498600933
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,24 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_WSA_10_0 && !UNITY_EDITOR
using UnityEngine;
using System.Threading.Tasks;
namespace Microsoft.AppCenter.Unity
{
public partial class AppCenterTask
{
// Task parameter should be started already!
public AppCenterTask(Task task)
{
// Use the *actual* TPL's ContinueWith implementation to
// perform the user's ContinueWith callbacks
task.ContinueWith(t => {
CompletionAction();
});
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b970ebe9345904544b42d260f6785283
timeCreated: 1501281270
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,89 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_WSA_10_0 && !UNITY_EDITOR
using System;
using System.Collections;
using System.Threading;
using System.Threading.Tasks;
using UnityEngine;
namespace Microsoft.AppCenter.Unity
{
public partial class AppCenterTask<TResult>
{
private Task<TResult> _task;
private ManualResetEvent _completionEvent = new ManualResetEvent(false);
private TResult _result;
private Exception _exception;
// This will block if it is called before the task is complete
public TResult Result
{
get
{
_completionEvent.WaitOne();
if (_exception == null)
{
return _result;
}
else
{
throw _exception;
}
}
}
public Exception Exception
{
get
{
return _exception;
}
}
public AppCenterTask(Task<TResult> task) : base(task)
{
// Need to save the task to access result later
_task = task;
}
protected override void CompletionAction()
{
lock (_lockObject)
{
if (IsComplete)
{
return;
}
_result = _task.Result;
_completionEvent.Set();
base.CompletionAction();
}
}
internal void SetResult(TResult result)
{
lock (_lockObject)
{
ThrowIfCompleted();
_result = result;
_completionEvent.Set();
base.CompletionAction();
}
}
internal void SetException(Exception exception)
{
lock (_lockObject)
{
ThrowIfCompleted();
_exception = exception;
_completionEvent.Set();
base.CompletionAction();
}
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 54f6a05c3c11840eb8a1f3b76554ff94
timeCreated: 1501281270
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,67 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_WSA_10_0 && !UNITY_EDITOR
using System;
namespace Microsoft.AppCenter.Unity.Internal
{
using UWPCustomProperties = Microsoft.AppCenter.CustomProperties;
class CustomPropertiesInternal
{
public static object Create()
{
return new UWPCustomProperties();
}
public static void SetString(object properties, string key, string val)
{
var uwpProperties = properties as UWPCustomProperties;
uwpProperties.Set(key, val);
}
public static void SetNumber(object properties, string key, int val)
{
var uwpProperties = properties as UWPCustomProperties;
uwpProperties.Set(key, val);
}
public static void SetNumber(object properties, string key, long val)
{
var uwpProperties = properties as UWPCustomProperties;
uwpProperties.Set(key, val);
}
public static void SetNumber(object properties, string key, float val)
{
var uwpProperties = properties as UWPCustomProperties;
uwpProperties.Set(key, val);
}
public static void SetNumber(object properties, string key, double val)
{
var uwpProperties = properties as UWPCustomProperties;
uwpProperties.Set(key, val);
}
public static void SetBool(object properties, string key, bool val)
{
var uwpProperties = properties as UWPCustomProperties;
uwpProperties.Set(key, val);
}
public static void SetDate(object properties, string key, DateTime val)
{
var uwpProperties = properties as UWPCustomProperties;
uwpProperties.Set(key, val);
}
public static void Clear(object properties, string key)
{
var uwpProperties = properties as UWPCustomProperties;
uwpProperties.Clear(key);
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e4a40f8a8c4ac5b4e80acd82f5bb940e
timeCreated: 1498670691
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,114 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_WSA_10_0 && ENABLE_IL2CPP && !UNITY_EDITOR
using Microsoft.AppCenter.Utils;
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Microsoft.AppCenter.Unity.Internal.Utils
{
public class UnityApplicationSettings : IApplicationSettings
{
private const string AppCenterSettingsKey = "AppCenterSettings";
private static readonly object _lockObject = new object();
private static IDictionary<string, object> _current;
private static bool _dirty = false;
public T GetValue<T>(string key, T defaultValue)
{
lock (_lockObject)
{
object result;
var found = _current.TryGetValue(key, out result);
if (found)
{
// This is a workaround for a bug on UWP where Install-Id cannot be read
// from Unity.PlayerPrefs, because it is saved as System.Guid, but read as a string.
if (typeof(T) == typeof(Guid?) && result is string)
{
try
{
object guid = new Guid((string)result);
return (T)guid;
}
catch (FormatException ex)
{
Debug.LogErrorFormat("Guid cannot be parsed due to a format exception: {0}", ex.Message);
return defaultValue;
}
}
return (T)result;
}
}
SetValue(key, defaultValue);
return defaultValue;
}
public void SetValue(string key, object value)
{
lock (_lockObject)
{
_current[key] = value;
_dirty = true;
}
}
public bool ContainsKey(string key)
{
lock (_lockObject)
{
return _current.ContainsKey(key);
}
}
public void Remove(string key)
{
lock (_lockObject)
{
_current.Remove(key);
_dirty = true;
}
}
private static IDictionary<string, object> ReadAll()
{
var json = PlayerPrefs.GetString(AppCenterSettingsKey, null);
var settings = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
return settings != null ? settings : new Dictionary<string, object>();
}
public static void Initialize()
{
// Read current values.
_current = ReadAll();
// Create helper for coroutine.
UnityCoroutineHelper.StartCoroutine(MainThreadCoroutine);
}
private static IEnumerator MainThreadCoroutine()
{
while (true)
{
yield return null;
if (_dirty)
{
string json;
lock (_lockObject)
{
json = JsonConvert.SerializeObject(_current);
_dirty = false;
}
PlayerPrefs.SetString(AppCenterSettingsKey, json);
PlayerPrefs.Save();
}
}
}
}
}
#endif
Loaded 100 of 719 files, more files were not shown because too many files have changed in this diff. Show more