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,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
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 9ce97215d8cac604bb8592f172a20089
timeCreated: 1502878843
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,17 @@
// 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;
namespace Microsoft.AppCenter.Unity.Internal.Utils
{
public class UnityApplicationSettingsFactory : IApplicationSettingsFactory
{
public IApplicationSettings CreateApplicationSettings()
{
return new UnityApplicationSettings();
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c5f91c5d3f7aebb4999bb4dc6d6b0f0c
timeCreated: 1502882164
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,13 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_WSA_10_0
using UnityEngine;
namespace Microsoft.AppCenter.Unity.Internal.Utils
{
public class UnityApplicationSettingsHelper : MonoBehaviour
{
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: bb2b96fcb50fa4d91902322f2530fdf9
timeCreated: 1502882164
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,38 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_WSA_10_0 && !UNITY_EDITOR
using System;
using System.Threading.Tasks;
using UnityEngine;
using Microsoft.AppCenter.Utils;
namespace Microsoft.AppCenter.Unity.Internal.Utils
{
public class UnityScreenSizeProvider : ScreenSizeProviderBase
{
private static int _height;
private static int _width;
private static TaskCompletionSource<bool> _initializationTaskSource = new TaskCompletionSource<bool>();
public override int Height => _height;
public override int Width => _width;
public static void Initialize()
{
// This must occur on the main thread
_height = Screen.currentResolution.height;
_width = Screen.currentResolution.width;
_initializationTaskSource.SetResult(true);
}
#pragma warning disable 0067
public override event EventHandler ScreenSizeChanged;
#pragma warning restore 0067
public override Task WaitUntilReadyAsync()
{
return _initializationTaskSource.Task;
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f31145d1cb97b6b4e96ec422fc7e1b7d
timeCreated: 1500921084
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,19 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_WSA_10_0 && !UNITY_EDITOR
using Microsoft.AppCenter.Utils;
namespace Microsoft.AppCenter.Unity.Internal.Utils
{
public class UnityScreenSizeProviderFactory : IScreenSizeProviderFactory
{
public IScreenSizeProvider CreateScreenSizeProvider()
{
return new UnityScreenSizeProvider();
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 285d8e08793969346b271d56b8c696f3
timeCreated: 1500923200
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 4c9d8b2c84f08414e8b264580dde54ad
folderAsset: yes
timeCreated: 1498059824
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,200 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_IOS && !UNITY_EDITOR
using AOT;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using UnityEngine;
namespace Microsoft.AppCenter.Unity.Internal
{
class AppCenterInternal
{
public static void SetLogLevel(int logLevel)
{
appcenter_unity_set_log_level(logLevel);
}
public static void SetUserId(string userId)
{
appcenter_unity_set_user_id(userId);
}
public static int GetLogLevel()
{
return appcenter_unity_get_log_level();
}
public static string GetSdkVersion()
{
return appcenter_unity_get_sdk_version();
}
public static bool IsConfigured()
{
return appcenter_unity_is_configured();
}
public static void SetLogUrl(string logUrl)
{
appcenter_unity_set_log_url(logUrl);
}
public static void SetNetworkRequestsAllowed(bool isAllowed)
{
appcenter_unity_set_network_requests_allowed(isAllowed);
}
public static bool IsNetworkRequestsAllowed()
{
return appcenter_unity_is_network_requests_allowed();
}
public static AppCenterTask SetEnabledAsync(bool isEnabled)
{
appcenter_unity_set_enabled(isEnabled);
return AppCenterTask.FromCompleted();
}
public static AppCenterTask<bool> IsEnabledAsync()
{
var isEnabled = appcenter_unity_is_enabled();
return AppCenterTask<bool>.FromCompleted(isEnabled);
}
public static AppCenterTask<string> GetInstallIdAsync()
{
var installId = appcenter_unity_get_install_id();
return AppCenterTask<string>.FromCompleted(installId);
}
public static void SetCustomProperties(IntPtr properties)
{
appcenter_unity_set_custom_properties(properties);
}
public static void SetWrapperSdk(string wrapperSdkVersion,
string wrapperSdkName,
string wrapperRuntimeVersion,
string liveUpdateReleaseLabel,
string liveUpdateDeploymentKey,
string liveUpdatePackageHash)
{
appcenter_unity_set_wrapper_sdk(wrapperSdkVersion,
wrapperSdkName,
wrapperRuntimeVersion,
liveUpdateReleaseLabel,
liveUpdateDeploymentKey,
liveUpdatePackageHash);
}
public static void Start(string appSecret, Type[] services)
{
var nativeServiceTypes = ServicesToNativeTypes(services);
appcenter_unity_start(appSecret, nativeServiceTypes, nativeServiceTypes.Length);
}
public static void Start(Type[] services)
{
var nativeServiceTypes = ServicesToNativeTypes(services);
appcenter_unity_start_no_secret(nativeServiceTypes, nativeServiceTypes.Length);
}
public static void Start(Type service)
{
}
public static void StartFromLibrary(IntPtr[] services)
{
appcenter_unity_start_from_library(services, services.Length);
}
public static IntPtr[] ServicesToNativeTypes(Type[] services)
{
var nativeTypes = new List<IntPtr>();
foreach (var serviceType in services)
{
serviceType.GetMethod("AddNativeType").Invoke(null, new object[] { nativeTypes });
}
return nativeTypes.ToArray();
}
public static void SetMaxStorageSize(long size)
{
appcenter_unity_set_storage_size(size, SetStorageSizeCompletionHandler);
}
[MonoPInvokeCallback(typeof(AppCenter.SetMaxStorageSizeCompletionHandler))]
private static void SetStorageSizeCompletionHandler(bool result)
{
if (!result)
{
Debug.Log("Failed to set maximum storage size");
}
}
#region External
[DllImport("__Internal")]
private static extern void appcenter_unity_set_log_level(int logLevel);
[DllImport("__Internal")]
private static extern void appcenter_unity_set_user_id(string userId);
[DllImport("__Internal")]
private static extern int appcenter_unity_get_log_level();
[DllImport("__Internal")]
private static extern string appcenter_unity_get_sdk_version();
[DllImport("__Internal")]
private static extern bool appcenter_unity_is_configured();
[DllImport("__Internal")]
private static extern void appcenter_unity_set_log_url(string logUrl);
[DllImport("__Internal")]
private static extern void appcenter_unity_set_enabled(bool isEnabled);
[DllImport("__Internal")]
private static extern void appcenter_unity_set_network_requests_allowed(bool isAllowed);
[DllImport("__Internal")]
private static extern bool appcenter_unity_is_network_requests_allowed();
[DllImport("__Internal")]
private static extern bool appcenter_unity_is_enabled();
[DllImport("__Internal")]
private static extern string appcenter_unity_get_install_id();
[DllImport("__Internal")]
private static extern void appcenter_unity_start(string appSecret, IntPtr[] classes, int count);
[DllImport("__Internal")]
private static extern void appcenter_unity_start_no_secret(IntPtr[] classes, int count);
[DllImport("__Internal")]
private static extern void appcenter_unity_start_from_library(IntPtr[] classes, int count);
[DllImport("__Internal")]
private static extern void appcenter_unity_set_custom_properties(IntPtr properties);
[DllImport("__Internal")]
private static extern void appcenter_unity_set_wrapper_sdk(string wrapperSdkVersion,
string wrapperSdkName,
string wrapperRuntimeVersion,
string liveUpdateReleaseLabel,
string liveUpdateDeploymentKey,
string liveUpdatePackageHash);
[DllImport("__Internal")]
private static extern void appcenter_unity_set_storage_size(long size, AppCenter.SetMaxStorageSizeCompletionHandler handler);
#endregion
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f8cd42a72e249df42b1d2447dc9333b9
timeCreated: 1497372965
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,18 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_IOS && !UNITY_EDITOR
using UnityEngine;
namespace Microsoft.AppCenter.Unity
{
public partial class AppCenterTask
{
internal void SetResult()
{
CompletionAction();
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 0b6acf881c8f345de98d17cffa208d8e
timeCreated: 1501280010
licenseType: Pro
MonoImporter:
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_EDITOR
using System;
using System.Collections;
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;
public TResult Result
{
get
{
_completionEvent.WaitOne();
if (_exception == null)
{
return _result;
}
else
{
throw _exception;
}
}
}
public Exception Exception
{
get
{
return _exception;
}
}
internal void SetResult(TResult result)
{
lock (_lockObject)
{
ThrowIfCompleted();
_result = result;
_completionEvent.Set();
CompletionAction();
}
}
internal void SetException(Exception exception)
{
lock (_lockObject)
{
ThrowIfCompleted();
_exception = exception;
_completionEvent.Set();
CompletionAction();
}
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c4991171420d3459abbefd760cfba51e
timeCreated: 1501280010
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,81 @@
// 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.Internal
{
class CustomPropertiesInternal
{
public static IntPtr Create()
{
return appcenter_unity_custom_properties_create();
}
public static void SetString(IntPtr properties, string key, string val)
{
appcenter_unity_custom_properties_set_string(properties, key, val);
}
public static void SetNumber(IntPtr properties, string key, int val)
{
appcenter_unity_custom_properties_set_number(properties, key, NSNumberHelper.Convert(val));
}
public static void SetNumber(IntPtr properties, string key, long val)
{
appcenter_unity_custom_properties_set_number(properties, key, NSNumberHelper.Convert(val));
}
public static void SetNumber(IntPtr properties, string key, float val)
{
appcenter_unity_custom_properties_set_number(properties, key, NSNumberHelper.Convert(val));
}
public static void SetNumber(IntPtr properties, string key, double val)
{
appcenter_unity_custom_properties_set_number(properties, key, NSNumberHelper.Convert(val));
}
public static void SetBool(IntPtr properties, string key, bool val)
{
appcenter_unity_custom_properties_set_bool(properties, key, val);
}
public static void SetDate(IntPtr properties, string key, DateTime val)
{
appcenter_unity_custom_properties_set_date(properties, key, NSDateHelper.DateTimeConvert(val));
}
public static void Clear(IntPtr properties, string key)
{
appcenter_unity_custom_properties_clear(properties, key);
}
#region External
[DllImport("__Internal")]
private static extern IntPtr appcenter_unity_custom_properties_create();
[DllImport("__Internal")]
private static extern void appcenter_unity_custom_properties_set_string(IntPtr properties, string key, string val);
[DllImport("__Internal")]
private static extern void appcenter_unity_custom_properties_set_number(IntPtr properties, string key, IntPtr val);
[DllImport("__Internal")]
private static extern void appcenter_unity_custom_properties_set_bool(IntPtr properties, string key, bool val);
[DllImport("__Internal")]
private static extern void appcenter_unity_custom_properties_set_date(IntPtr properties, string key, IntPtr val);
[DllImport("__Internal")]
private static extern void appcenter_unity_custom_properties_clear(IntPtr properties, string key);
#endregion
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: dd933e7104204430682354c11c40d2f2
timeCreated: 1498515938
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: