app center;增加發送ping的秒
This commit is contained in:
1 parent
1bd1ffdb5a
commit
d754ff3b15
719 files changed
+34172
-2875
No files matched your search
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: afed194a733530a4eb52e6e0d76a80b1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,34 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 65a57d979f383420a894f22dfe19f005
|
||||
folderAsset: yes
|
||||
timeCreated: 1498496047
|
||||
licenseType: Pro
|
||||
PluginImporter:
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
platformData:
|
||||
data:
|
||||
first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets.AppCenter.Plugins.Android.Utility
|
||||
{
|
||||
class AndroidUtility
|
||||
{
|
||||
private static AndroidJavaObject _context;
|
||||
private const string PREFS_NAME = "AppCenterUserPrefs";
|
||||
|
||||
public static AndroidJavaObject GetAndroidContext()
|
||||
{
|
||||
if (_context != null)
|
||||
{
|
||||
return _context;
|
||||
}
|
||||
var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
|
||||
var activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
|
||||
_context = activity.Call<AndroidJavaObject>("getApplicationContext");
|
||||
return _context;
|
||||
}
|
||||
|
||||
public static void SetPreferenceInt(string prefKey, int prefValue)
|
||||
{
|
||||
AndroidJavaObject context = GetAndroidContext();
|
||||
AndroidJavaObject sharedPreferences = context.Call<AndroidJavaObject>("getSharedPreferences", new object[] { PREFS_NAME, 0 });
|
||||
AndroidJavaObject editor = sharedPreferences.Call<AndroidJavaObject>("edit");
|
||||
editor = editor.Call<AndroidJavaObject>("putInt", new object[] { prefKey, prefValue });
|
||||
editor.Call("apply");
|
||||
}
|
||||
|
||||
public static void SetPreferenceString(string prefKey, string prefValue)
|
||||
{
|
||||
AndroidJavaObject context = GetAndroidContext();
|
||||
AndroidJavaObject sharedPreferences = context.Call<AndroidJavaObject>("getSharedPreferences", new object[] { PREFS_NAME, 0 });
|
||||
AndroidJavaObject editor = sharedPreferences.Call<AndroidJavaObject>("edit");
|
||||
editor = editor.Call<AndroidJavaObject>("putString", new object[] { prefKey, prefValue });
|
||||
editor.Call("apply");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c7653ac593f8a4859bc75b4952e2a9dc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,49 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#if UNITY_ANDROID
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Microsoft.AppCenter.Unity.Internal.Utility
|
||||
{
|
||||
public class JavaDateHelper
|
||||
{
|
||||
private const string DotNetDateFormat = "yyyy-MM-dd'T'HH:mm:ss.fffK";
|
||||
|
||||
private static AndroidJavaObject _javaDateFormatter;
|
||||
private static AndroidJavaObject JavaDateFormatter
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_javaDateFormatter == null)
|
||||
{
|
||||
_javaDateFormatter = new AndroidJavaObject("java.text.SimpleDateFormat", "yyyy-MM-dd'T'HH:mm:ss.SSSZ");
|
||||
}
|
||||
return _javaDateFormatter;
|
||||
}
|
||||
}
|
||||
|
||||
public static AndroidJavaObject DateTimeConvert(DateTime date)
|
||||
{
|
||||
// 'DotNetDateFormat' contains timezone info with time separator.
|
||||
// 'javaDateFormatter' uses date format with timezone info without time separator.
|
||||
// Time separator should be removed from date string before 'parse' call.
|
||||
var dateString = date.ToString(DotNetDateFormat);
|
||||
int separatorIndex = dateString.LastIndexOf(CultureInfo.CurrentCulture.DateTimeFormat.TimeSeparator);
|
||||
dateString = dateString.Remove(separatorIndex, 1);
|
||||
return JavaDateFormatter.Call<AndroidJavaObject>("parse", dateString);
|
||||
}
|
||||
|
||||
public static DateTimeOffset DateTimeConvert(AndroidJavaObject date)
|
||||
{
|
||||
// Unable to use DateTimeOffset.ParseExact(dateString, DotNetDateFormat, CultureInfo.InvariantCulture) here
|
||||
// because it throws "Invalid format string" exception
|
||||
var dateString = JavaDateFormatter.Call<string>("format", date);
|
||||
var dateTime = DateTime.ParseExact(dateString, DotNetDateFormat, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal);
|
||||
return new DateTimeOffset(dateTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ebd2662d8c212481b8ae72fe6be77873
|
||||
timeCreated: 1498578955
|
||||
licenseType: Pro
|
||||
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_ANDROID
|
||||
using UnityEngine;
|
||||
|
||||
namespace Microsoft.AppCenter.Unity.Internal.Utility
|
||||
{
|
||||
public class JavaNumberHelper
|
||||
{
|
||||
public static AndroidJavaObject Convert(int val)
|
||||
{
|
||||
AndroidJavaObject javaInteger = new AndroidJavaObject("java.lang.Integer", val);
|
||||
return javaInteger;
|
||||
}
|
||||
|
||||
public static AndroidJavaObject Convert(long val)
|
||||
{
|
||||
AndroidJavaObject javaLong = new AndroidJavaObject("java.lang.Long", val);
|
||||
return javaLong;
|
||||
}
|
||||
|
||||
public static AndroidJavaObject Convert(float val)
|
||||
{
|
||||
AndroidJavaObject javaFloat = new AndroidJavaObject("java.lang.Float", val);
|
||||
return javaFloat;
|
||||
}
|
||||
|
||||
public static AndroidJavaObject Convert(double val)
|
||||
{
|
||||
AndroidJavaObject javaDouble = new AndroidJavaObject("java.lang.Double", val);
|
||||
return javaDouble;
|
||||
}
|
||||
|
||||
//TODO how to support decimal?
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dcfb87d5b5fb94c77b4d361b4791a677
|
||||
timeCreated: 1498578955
|
||||
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_ANDROID
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Microsoft.AppCenter.Unity.Internal.Utility
|
||||
{
|
||||
public class JavaStringMapHelper
|
||||
{
|
||||
public static Dictionary<string, string> ConvertFromJava(AndroidJavaObject map)
|
||||
{
|
||||
var keySet = map.Call<AndroidJavaObject>("keySet");
|
||||
var keyArray = keySet.Call<AndroidJavaObject>("toArray");
|
||||
string[] keys = AndroidJNIHelper.ConvertFromJNIArray<string[]>(keyArray.GetRawObject());
|
||||
var dictionary = new Dictionary<string, string>();
|
||||
foreach (var key in keys)
|
||||
{
|
||||
var val = map.Call<string>("get", key);
|
||||
dictionary[key] = val;
|
||||
}
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
public static AndroidJavaObject ConvertToJava(IDictionary<string, string> properties)
|
||||
{
|
||||
if (properties == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
string[] keys = properties.Keys.ToArray();
|
||||
string[] values = properties.Values.ToArray();
|
||||
int count = properties.Count;
|
||||
var javaMap = new AndroidJavaObject("java.util.HashMap");
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
javaMap.Call<AndroidJavaObject>("put", keys[i], values[i]);
|
||||
}
|
||||
return javaMap;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 80fb4bb7b657748d399b89f4367331e8
|
||||
timeCreated: 1498496048
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,21 @@
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT license.
|
||||
|
||||
param
|
||||
(
|
||||
[Parameter(Position=0, Mandatory = $false, HelpMessage="Source folder", ValueFromPipeline = $true)]
|
||||
$Source,
|
||||
[Parameter(Position=1, Mandatory = $false, HelpMessage="Destination file path", ValueFromPipeline = $true)]
|
||||
$Destination
|
||||
)
|
||||
|
||||
Try
|
||||
{
|
||||
Add-Type -assembly "system.io.compression.filesystem"
|
||||
[io.compression.zipfile]::CreateFromDirectory($Source, $Destination)
|
||||
}
|
||||
Catch
|
||||
{
|
||||
$Exc = $_.Exception.Message
|
||||
Write-Error "File $Destination was not created. Error: $Exc"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27462eedb9e0e4dee8d0ff51fe4dee0d
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,23 @@
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT license.
|
||||
|
||||
param
|
||||
(
|
||||
[Parameter(Position=0, Mandatory = $false, HelpMessage="Source file", ValueFromPipeline = $true)]
|
||||
$Source,
|
||||
[Parameter(Position=1, Mandatory = $false, HelpMessage="Destination path", ValueFromPipeline = $true)]
|
||||
$Destination
|
||||
)
|
||||
|
||||
New-Item -ItemType directory -Path $Destination
|
||||
|
||||
Try
|
||||
{
|
||||
Add-Type -assembly "system.io.compression.filesystem"
|
||||
[io.compression.zipfile]::ExtractToDirectory($Source, $Destination)
|
||||
}
|
||||
Catch
|
||||
{
|
||||
$Exc = $_.Exception.Message
|
||||
Write-Error "Folder $Destination was not created. Error: $Exc"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7fff91df92b854ad680ee28ba1c36fce
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f313f109a3454802b5cae94a72ee306
|
||||
timeCreated: 1504718816
|
||||
licenseType: Pro
|
||||
PluginImporter:
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
platformData:
|
||||
data:
|
||||
first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,31 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 20e621e7423ed4dd4b6826b8dab0c7eb
|
||||
timeCreated: 1512463304
|
||||
licenseType: Free
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
platformData:
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68c3a86f609b440b1b95a05639da7861
|
||||
timeCreated: 1504718816
|
||||
licenseType: Pro
|
||||
PluginImporter:
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
platformData:
|
||||
data:
|
||||
first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1865e2b19b6434dcf9e4f48f7208d7a0
|
||||
timeCreated: 1503351439
|
||||
licenseType: Pro
|
||||
PluginImporter:
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
platformData:
|
||||
data:
|
||||
first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10c16a9d75c5c48cca25985ae8bf3ec6
|
||||
timeCreated: 1504718816
|
||||
licenseType: Pro
|
||||
PluginImporter:
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
platformData:
|
||||
data:
|
||||
first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4de8fbe7ed99aa245bf6616636b6c980
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 514cee750a1f56f4bab5c663b3a4f557
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+70
@@ -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
|
||||
+11
@@ -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
|
||||
+11
@@ -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
|
||||
+11
@@ -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
|
||||
+11
@@ -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
|
||||
+11
@@ -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
|
||||
+11
@@ -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
|
||||
+11
@@ -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
|
||||
+11
@@ -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<TResult> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loaded 100 of 719 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user