删除appcenter;删除打包后的debug

This commit is contained in:
CaiYanPeng 2021-11-15 11:36:08 +08:00
parent 402f19b8a5
commit b79584f745
712 changed files with 1 additions and 31184 deletions

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 3924cc2cd3f083b4b89f4ade5ab4137f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,200 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using Microsoft.AppCenter.Unity;
using UnityEngine;
using System;
using System.Reflection;
using Microsoft.AppCenter.Unity.Internal;
using System.Linq;
using Assets.Scenes.Ride.Scripts;
[HelpURL("https://docs.microsoft.com/en-us/appcenter/sdk/crashes/unity")]
public class AppCenterBehavior : MonoSingleton<AppCenterBehavior>
{
public static event Action InitializingServices;
public static event Action InitializedAppCenterAndServices;
public static event Action Started;
private static AppCenterBehavior _instance;
public AppCenterSettings Settings;
private void Awake()
{
// Make sure that App Center have only one instance.
if (_instance != null)
{
//Debug.LogError("App Center Behavior should have only one instance!");
//DestroyImmediate(gameObject);
return;
}
_instance = this;
DontDestroyOnLoad(gameObject);
#if UNITY_WSA_10_0
StartAppCenter();
#endif
}
private void Start()
{
#if !UNITY_WSA_10_0
StartAppCenter();
#endif
}
#if UNITY_EDITOR
public void Reset()
{
if (FindObjectsOfType<AppCenterBehavior>().Length > 1)
{
Debug.LogError("Only one game object with App Center Behaviour should exist.");
DestroyImmediate(this);
}
}
#endif
private void StartAppCenter()
{
if (Settings == null)
{
Debug.LogError("App Center isn't configured!");
return;
}
var services = Settings.Services;
PrepareEventHandlers(services);
InvokeInitializingServices();
AppCenter.SetWrapperSdk();
AppCenter.CacheStorageSize(Settings.MaxStorageSize.Size);
if (Settings.CustomLogUrl.UseCustomUrl)
{
AppCenter.CacheLogUrl(Settings.CustomLogUrl.Url);
}
var appSecret = AppCenter.ParseAndSaveSecretForPlatform(Settings.AppSecret);
var advancedSettings = GetComponent<AppCenterBehaviorAdvanced>();
AppCenter.NetworkRequestsAllowed = Settings.AllowNetworkRequests;
if (IsStartFromAppCenterBehavior(advancedSettings))
{
AppCenter.LogLevel = Settings.InitialLogLevel;
if (Settings.CustomLogUrl.UseCustomUrl)
{
AppCenter.SetLogUrl(Settings.CustomLogUrl.Url);
}
if (Settings.MaxStorageSize.UseCustomMaxStorageSize && Settings.MaxStorageSize.Size > 0)
{
AppCenterInternal.SetMaxStorageSize(Settings.MaxStorageSize.Size);
}
var startupType = GetStartupType(advancedSettings);
if (startupType != StartupType.Skip)
{
var transmissionTargetToken = GetTransmissionTargetToken(advancedSettings);
var appSecretString = GetAppSecretString(appSecret, transmissionTargetToken, startupType);
if (string.IsNullOrEmpty(appSecretString))
{
AppCenterInternal.Start(services);
}
else
{
AppCenterInternal.Start(appSecretString, services);
}
}
}
#if UNITY_IOS || UNITY_ANDROID
else
{
foreach (var service in services)
{
#if UNITY_IOS || UNITY_ANDROID
// On iOS and Android we start crash service here, to give app an opportunity to assign handlers after crash and restart in Awake method
var startCrashes = service.GetMethod("StartCrashes");
if (startCrashes != null)
startCrashes.Invoke(null, null);
// On iOS and Android we start distribute service here, to give app an opportunity to assign handlers after distribute and restart in Awake method
var startDistribute = service.GetMethod("StartDistribute");
if (startDistribute != null)
startDistribute.Invoke(null, null);
#endif
}
}
#endif
InvokeInitializedServices();
if (Started != null)
{
Started.Invoke();
}
}
private bool IsStartFromAppCenterBehavior(AppCenterBehaviorAdvanced advancedSettings)
{
#if UNITY_IOS
return advancedSettings != null && advancedSettings.SettingsAdvanced != null && advancedSettings.SettingsAdvanced.StartIOSNativeSDKFromAppCenterBehavior;
#elif UNITY_ANDROID
return advancedSettings != null && advancedSettings.SettingsAdvanced != null && advancedSettings.SettingsAdvanced.StartAndroidNativeSDKFromAppCenterBehavior;
#else
return true;
#endif
}
private StartupType GetStartupType(AppCenterBehaviorAdvanced advancedSettings)
{
return advancedSettings != null && advancedSettings.SettingsAdvanced != null ?
advancedSettings.SettingsAdvanced.GetStartupType() :
StartupType.AppCenter;
}
private string GetTransmissionTargetToken(AppCenterBehaviorAdvanced advancedSettings)
{
return advancedSettings != null && advancedSettings.SettingsAdvanced != null ?
advancedSettings.SettingsAdvanced.TransmissionTargetToken :
string.Empty;
}
private string GetAppSecretString(string appSecret, string transmissionTargetToken, StartupType startupType)
{
#if UNITY_WSA_10_0
return appSecret;
#else
switch (startupType)
{
default:
case StartupType.AppCenter:
return appSecret;
case StartupType.NoSecret:
return string.Empty;
case StartupType.OneCollector:
return string.Format("target={0}", transmissionTargetToken);
case StartupType.Both:
return string.Format("appsecret={0};target={1}", appSecret, transmissionTargetToken);
}
#endif
}
private static void PrepareEventHandlers(Type[] services)
{
foreach (var service in services)
{
var method = service.GetMethod("PrepareEventHandlers");
if (method != null)
{
method.Invoke(null, null);
}
}
}
private static void InvokeInitializingServices()
{
if (InitializingServices != null)
{
InitializingServices.Invoke();
}
}
private static void InvokeInitializedServices()
{
if (InitializedAppCenterAndServices != null)
{
InitializedAppCenterAndServices.Invoke();
}
}
}

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: b9a3a6a28c6a80a46adde9b4e01eeb93
timeCreated: 1502267991
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 2778c316eec875d46bbd2ecbfba6db4a, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,30 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using UnityEngine;
[HelpURL("https://docs.microsoft.com/en-us/appcenter/sdk/crashes/unity")]
public class AppCenterBehaviorAdvanced : MonoBehaviour
{
public AppCenterSettingsAdvanced SettingsAdvanced;
private void Awake()
{
// Make sure that App Center have the default behavior attached.
if (gameObject.GetComponent<AppCenterBehavior>() == null)
{
Debug.LogError("App Center Behavior Advanced should have the App Center Behavior instance attached to the same game object.");
}
}
#if UNITY_EDITOR
public void Reset()
{
if (FindObjectsOfType<AppCenterBehaviorAdvanced>().Length > 1)
{
Debug.LogError("Only one game object with App Center Behaviour Advanced should exist.");
DestroyImmediate(this);
}
}
#endif
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 0d5e2b5dc171f164b8ef2a7b94198b04
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 2778c316eec875d46bbd2ecbfba6db4a, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,40 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 07ef30b23b2586041aedf18c9486176d, type: 3}
m_Name: AppCenterSettings
m_EditorClassIdentifier:
iOSAppSecret: d8e69880-4b16-468e-9216-d0eec8fff482
AndroidAppSecret: d212c44e-8438-499e-83b8-dbb0b6cafc54
UWPAppSecret: 43bc58e0-d103-4d4a-87e6-ddc26adff8ba
UseAnalytics: 1
UseCrashes: 1
UseDistribute: 1
CustomApiUrl:
UrlName: API
UseCustomUrl: 0
Url:
CustomInstallUrl:
UrlName: Install
UseCustomUrl: 0
Url:
EnableDistributeForDebuggableBuild: 0
AutomaticCheckForUpdate: 1
InitialLogLevel: 4
AllowNetworkRequests: 1
UpdateTrack: 1
CustomLogUrl:
UrlName: Log
UseCustomUrl: 0
Url:
MaxStorageSize:
UseCustomMaxStorageSize: 0
Size: 0

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: a4dbc5962d52f8a4886748301216ab73
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,92 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Microsoft.AppCenter.Unity;
using UnityEngine;
[Serializable]
public class AppCenterSettings : ScriptableObject
{
[AppSecret("iOS App Secret")]
public string iOSAppSecret = "";
[AppSecret]
public string AndroidAppSecret = "";
[AppSecret]
public string UWPAppSecret = "";
[Tooltip("App Center Analytics helps you understand user behavior and customer engagement to improve your app.")]
public bool UseAnalytics = true;
[Tooltip("App Center Crashes will automatically generate a crash log every time your app crashes.")]
public bool UseCrashes = true;
[Tooltip("App Center Distribute will let your users install a new version of the app when you distribute it via the App Center.")]
public bool UseDistribute = true;
public CustomUrlProperty CustomApiUrl = new CustomUrlProperty("API");
public CustomUrlProperty CustomInstallUrl = new CustomUrlProperty("Install");
[Tooltip("By default, App Center Distribute is disabled for debuggable builds. Check this to enable it.")]
public bool EnableDistributeForDebuggableBuild = false;
[Tooltip("By default, App Center Distribute checks for update at application startup automatically. Uncheck this to check for updates manually instead.")]
public bool AutomaticCheckForUpdate = true;
public LogLevel InitialLogLevel = LogLevel.Info;
[Tooltip("By default, the network requests is allowed. Uncheck this to disallow network requests.")]
public bool AllowNetworkRequests = true;
[CustomDropDownProperty("Public", 1)]
[CustomDropDownProperty("Private", 2)]
public int UpdateTrack;
public CustomUrlProperty CustomLogUrl = new CustomUrlProperty("Log");
public MaxStorageSizeProperty MaxStorageSize = new MaxStorageSizeProperty();
public string AppSecret
{
get
{
var appSecrets = new Dictionary<string, string>
{
{ "ios", iOSAppSecret },
{ "android", AndroidAppSecret },
{ "uwp", UWPAppSecret }
};
return string.Concat(appSecrets
.Where(i => !string.IsNullOrEmpty(i.Value))
.Select(i => string.Format("{0}={1};", i.Key, i.Value))
.ToArray());
}
}
public Type[] Services
{
get
{
var services = new List<Type>();
if (UseAnalytics)
{
services.Add(AppCenter.Analytics);
}
if (UseCrashes)
{
services.Add(AppCenter.Crashes);
}
if (UseDistribute)
{
services.Add(AppCenter.Distribute);
}
return services.Where(i => i != null).ToArray();
}
}
}

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 07ef30b23b2586041aedf18c9486176d
timeCreated: 1502272754
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,50 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using System.Reflection;
using Microsoft.AppCenter.Unity;
using UnityEngine;
[Serializable]
public class AppCenterSettingsAdvanced : ScriptableObject
{
[AppSecret("Transmission Target Token")]
public string TransmissionTargetToken = "";
[Tooltip("Configure the way App Center is started. For more info on startup types refer to the documentation.")]
public StartupType AppCenterStartupType = StartupType.Both;
[Tooltip("Start Android native SDK from the App Center Behavior script instead of the native plugin")]
#if APPCENTER_DONT_USE_NATIVE_STARTER
public bool StartAndroidNativeSDKFromAppCenterBehavior = true;
#else
public bool StartAndroidNativeSDKFromAppCenterBehavior = false;
#endif
[Tooltip("Start iOS native SDK from the App Center Behavior script instead of the native plugin")]
#if APPCENTER_DONT_USE_NATIVE_STARTER
public bool StartIOSNativeSDKFromAppCenterBehavior = true;
#else
public bool StartIOSNativeSDKFromAppCenterBehavior = false;
#endif
public StartupType GetStartupType()
{
return AppCenterStartupType == StartupType.Both && string.IsNullOrEmpty(TransmissionTargetToken) ?
StartupType.AppCenter :
AppCenterStartupType;
}
private static Assembly AppCenterAssembly
{
get
{
#if !UNITY_EDITOR && UNITY_WSA_10_0
return typeof(AppCenterSettingsAdvanced).GetTypeInfo().Assembly;
#else
return Assembly.GetExecutingAssembly();
#endif
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 0254b6f16506aa345aa7e5b4229b8fdc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 1d57433ef86b55d4f891a2bae99af818
folderAsset: yes
timeCreated: 1502266378
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,108 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System.Diagnostics;
using System.Text;
using UnityEngine;
public static class AndroidLibraryHelper
{
public static void ZipFile(string sourceFile, string destinationFile)
{
var stringBuilder = new StringBuilder();
var args = "";
var processName = "";
if (Application.platform == RuntimePlatform.WindowsEditor)
{
args = stringBuilder
.Append("/c powershell")
.Append(" -executionpolicy bypass")
.Append(" -File \"")
.Append(AppCenterSettingsContext.AppCenterPath)
.Append("/Plugins/Android/Utility/archive.ps1 \"")
.Append(" -Source ")
.Append(sourceFile)
.Append(" -Destination ")
.Append(destinationFile)
.ToString();
processName = "cmd";
}
else if (Application.platform == RuntimePlatform.OSXEditor)
{
args = stringBuilder
.Append("-c \"cd ")
.Append(sourceFile)
.Append(" ; zip -r ")
.Append("../")
.Append(destinationFile)
.Append(" * \"")
.ToString();
processName = "/bin/bash";
}
if (processName.Length > 0)
{
ExecuteProcess(processName, args);
}
}
public static void UnzipFile(string sourceFile, string destinationFile)
{
var stringBuilder = new StringBuilder();
var args = "";
var processName = "";
if (Application.platform == RuntimePlatform.WindowsEditor)
{
args = stringBuilder
.Append("/c powershell")
.Append(" -executionpolicy bypass")
.Append(" -File \"")
.Append(AppCenterSettingsContext.AppCenterPath)
.Append("/Plugins/Android/Utility/unarchive.ps1 \"")
.Append(" -Source ")
.Append(sourceFile)
.Append(" -Destination ")
.Append(destinationFile)
.ToString();
processName = "cmd";
}
else if (Application.platform == RuntimePlatform.OSXEditor)
{
args = stringBuilder
.Append("-c \"unzip ")
.Append(sourceFile)
.Append(" -d ")
.Append(destinationFile)
.Append(" \"")
.ToString();
processName = "/bin/bash";
}
if (processName.Length > 0)
{
ExecuteProcess(processName, args);
}
}
private static void ExecuteProcess(string processName, string args)
{
var process = new Process()
{
StartInfo = new ProcessStartInfo
{
FileName = processName,
Arguments = args,
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
CreateNoWindow = true,
}
};
process.Start();
string output = process.StandardOutput.ReadToEnd();
string error = process.StandardError.ReadToEnd();
process.WaitForExit();
if (output.Length > 0 || error.Length > 0)
{
UnityEngine.Debug.Log(output + error);
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 2dd8894ba1c74f64eba3405e0e466702
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,30 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using UnityEditor;
using UnityEditor.SceneManagement;
[CustomEditor(typeof(AppCenterBehavior))]
public class AppCenterBehaviorEditor : Editor
{
private Editor settingsEditor;
public override void OnInspectorGUI()
{
// Load or create settings.
var behaviour = (AppCenterBehavior) target;
if (behaviour.Settings == null)
{
behaviour.Settings = AppCenterSettingsContext.SettingsInstance;
EditorUtility.SetDirty(behaviour);
EditorSceneManager.MarkSceneDirty(behaviour.gameObject.scene);
}
// Draw settings.
if (settingsEditor == null)
{
settingsEditor = CreateEditor(behaviour.Settings);
}
settingsEditor.OnInspectorGUI();
}
}

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 8b75da1d7e1a6444bb6ca0bfefc96bca
timeCreated: 1502266489
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,36 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using UnityEditor;
[CustomEditor(typeof(AppCenterBehaviorAdvanced))]
public class AppCenterBehaviorEditorAdvanced : Editor
{
private Editor settingsEditorAdvanced;
public override void OnInspectorGUI()
{
// Load or create settings.
var behaviour = (AppCenterBehaviorAdvanced) target;
if (behaviour.SettingsAdvanced == null)
{
behaviour.SettingsAdvanced = AppCenterSettingsContext.CreateSettingsInstanceAdvanced();
}
// Draw settings.
if (settingsEditorAdvanced == null)
{
settingsEditorAdvanced = CreateEditor(behaviour.SettingsAdvanced);
}
settingsEditorAdvanced.OnInspectorGUI();
}
public void OnDestroy()
{
// If the component is removed from GameObject then remove the related asset.
if (!target && FindObjectsOfType<AppCenterBehaviorAdvanced>().Length == 0)
{
AppCenterSettingsContext.DeleteSettingsInstanceAdvanced();
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a931e43ece37e0f49a55725bf9250637
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 924 B

View File

@ -1,106 +0,0 @@
fileFormatVersion: 2
guid: 2778c316eec875d46bbd2ecbfba6db4a
timeCreated: 1502267776
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -1
wrapU: 1
wrapV: -1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: iPhone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Android
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Windows Store Apps
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,340 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using Microsoft.AppCenter.Unity;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml.Linq;
using System;
using System.Collections.Generic;
using UnityEditor.Build.Reporting;
using UnityEditor.Build;
using UnityEditor;
using UnityEngine;
using System.Reflection;
// Warning: Don't use #if #endif for conditional compilation here as Unity
// doesn't always set the flags early enough.
public class AppCenterPostBuild : IPostprocessBuildWithReport
{
public int callbackOrder { get { return 0; } }
private const string AppManifestFileName = "Package.appxmanifest";
private const string CapabilitiesElement = "Capabilities";
private const string CapabilityElement = "Capability";
private const string CapabilityNameAttribute = "Name";
private const string CapabilityNameAttributeValue = "internetClient";
private const string AppIl2cppXaml = "App.xaml.cpp";
private const string AppIl2cppD3d = "App.cpp";
public void OnPostprocessBuild(BuildReport report)
{
OnPostprocessBuild(report.summary.platform, report.summary.outputPath);
}
public void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
{
if (target == BuildTarget.WSAPlayer)
{
AddInternetClientCapability(pathToBuiltProject);
if (PlayerSettings.GetScriptingBackend(BuildTargetGroup.WSA) == ScriptingImplementation.IL2CPP)
{
// Fix System.Diagnostics.Debug IL2CPP implementation.
FixIl2CppLogging(pathToBuiltProject);
}
}
if (target == BuildTarget.iOS &&
PBXProjectWrapper.PBXProjectIsAvailable &&
PlistDocumentWrapper.PlistDocumentIsAvailable)
{
var pbxProject = new PBXProjectWrapper(pathToBuiltProject);
// Update project.
OnPostprocessProject(pbxProject);
pbxProject.WriteToFile();
// Update Info.plist.
var settings = AppCenterSettingsContext.SettingsInstance;
var infoPath = pathToBuiltProject + "/Info.plist";
var info = new PlistDocumentWrapper(infoPath);
OnPostprocessInfo(info, settings);
info.WriteToFile();
// Update capabilities (if possible).
if (ProjectCapabilityManagerWrapper.ProjectCapabilityManagerIsAvailable)
{
var capabilityManager = new ProjectCapabilityManagerWrapper(pbxProject.ProjectPath,
PBXProjectWrapper.GetUnityTargetName(),
pbxProject.GetUnityTargetGuid());
capabilityManager.WriteToFile();
}
}
}
#region UWP Methods
/// <summary>
/// In order to have App Center SDK logs we are using 'OutputDebugStringW' func to display them.
/// To use 'OutputDebugStringW' we should update autogenerated Debugger.cpp file.
/// </summary>
/// <param name="pathToBuiltProject">Path to build project</param>
public static void FixIl2CppLogging(string pathToBuiltProject)
{
var destDebuggerPath = Path.Combine(pathToBuiltProject,
"Il2CppOutputProject\\IL2CPP\\libil2cpp\\icalls\\mscorlib\\System.Diagnostics\\Debugger.cpp");
if (!File.Exists(destDebuggerPath))
{
throw new FileNotFoundException("Debugger.cpp file not found");
}
var codeLines = File.ReadAllLines(destDebuggerPath).ToList();
// Update #include and #undef derictives.
var lastIncludeLineIndex = SearchForLine(codeLines, "#include", true);
if (lastIncludeLineIndex == -1)
{
throw new Exception("Unexpected content of Debugger.cpp");
}
// Add '#include <Windows.h>' which provides 'OutputDebugStringW'.
codeLines.Insert(lastIncludeLineIndex + 1, "#include <Windows.h>");
/*
* 'GetCurrentDirectory' define conflicts with generated code and new versions of Unity
* combine some files on the compilation so the changes in one file can affect another.
*/
codeLines.Insert(lastIncludeLineIndex + 2, "#undef GetCurrentDirectory");
// Add logging method.
var logMethodLineIndex = SearchForLine(codeLines, "void Debugger::Log");
if (logMethodLineIndex == -1)
{
throw new Exception("Unexpected content of Debugger.cpp");
}
var insertingPosition = GetFirstLineInMethodBody(codeLines, logMethodLineIndex);
codeLines.Insert(insertingPosition, "OutputDebugStringW(message->chars);");
// Enable logging.
var isLoggingMethodLineIndex = SearchForLine(codeLines, "bool Debugger::IsLogging");
if (isLoggingMethodLineIndex == -1)
{
throw new Exception("Unexpected content of Debugger.cpp");
}
var firstLineInMethodBody = GetFirstLineInMethodBody(codeLines, isLoggingMethodLineIndex);
var lastLineInMethodBody = GetLastLineInMethodBody(codeLines, isLoggingMethodLineIndex);
codeLines.RemoveRange(firstLineInMethodBody, lastLineInMethodBody - firstLineInMethodBody);
codeLines.Insert(firstLineInMethodBody, "return true;");
File.WriteAllLines(destDebuggerPath, codeLines.ToArray());
}
private static int GetFirstLineInMethodBody(List<string> lines, int currentLineIndex)
{
while (currentLineIndex <= lines.Count && !lines[currentLineIndex].Contains("{"))
{
currentLineIndex++;
}
if (currentLineIndex >= lines.Count)
{
throw new Exception("Unexpected content of Debugger.cpp");
}
return currentLineIndex + 1;
}
private static int GetLastLineInMethodBody(List<string> lines, int currentLineIndex)
{
var lineIndex = GetFirstLineInMethodBody(lines, currentLineIndex);
int bracketsBalance = lines[lineIndex - 1].Count((item) => item == '{');
while (lineIndex <= lines.Count && bracketsBalance != 0)
{
bracketsBalance += lines[lineIndex].Count((item) => item == '{');
bracketsBalance -= lines[lineIndex].Count((item) => item == '}');
lineIndex++;
}
if (bracketsBalance != 0)
{
throw new Exception("Unexpected content of Debugger.cpp");
}
return lineIndex - 1;
}
private static int SearchForLine(List<string> lines, string searchString, bool returnTheLast = false)
{
int position = -1;
for (var i = 0; i < lines.Count; i++)
{
if (lines[i].Contains(searchString))
{
if (returnTheLast)
{
position = i;
}
else
{
return i;
}
}
}
return position;
}
public static string GetAppFilePath(string pathToBuiltProject, string filename)
{
var candidate = Path.Combine(pathToBuiltProject, Application.productName);
candidate = Path.Combine(candidate, filename);
return File.Exists(candidate) ? candidate : null;
}
public static void ProcessUwpIl2CppDependencies()
{
var binaries = AssetDatabase.FindAssets("*", new[] { AppCenterSettingsContext.AppCenterPath + "/Plugins/WSA/IL2CPP" });
foreach (var guid in binaries)
{
var assetPath = AssetDatabase.GUIDToAssetPath(guid);
var importer = AssetImporter.GetAtPath(assetPath) as PluginImporter;
if (importer != null)
{
importer.SetPlatformData(BuildTarget.WSAPlayer, "SDK", "UWP");
importer.SetPlatformData(BuildTarget.WSAPlayer, "ScriptingBackend", "Il2Cpp");
importer.SaveAndReimport();
}
}
}
private static void ExecuteCommand(string command, string arguments, int timeout = 600)
{
try
{
var buildProcess = new System.Diagnostics.Process
{
StartInfo =
{
FileName = command,
Arguments = arguments
}
};
buildProcess.Start();
buildProcess.WaitForExit(timeout * 1000);
}
catch (Exception exception)
{
Debug.LogException(exception);
}
}
private static void AddInternetClientCapability(string pathToBuiltProject)
{
/* Package.appxmanifest file example:
<Package>
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
</Package> */
var appManifests = Directory.GetFiles(pathToBuiltProject, AppManifestFileName, SearchOption.AllDirectories);
if (appManifests.Length == 0)
{
Debug.LogWarning("Failed to add the `InternetClient` capability, file `" + AppManifestFileName + "` is not found");
return;
}
else if (appManifests.Length > 1)
{
Debug.LogWarning("Failed to add the `InternetClient` capability, multiple `" + AppManifestFileName + "` files found");
return;
}
var appManifestFilePath = appManifests[0];
var xmlFile = XDocument.Load(appManifestFilePath);
var defaultNamespace = xmlFile.Root.GetDefaultNamespace().NamespaceName;
var capabilitiesElements = xmlFile.Root.Elements().Where(element => element.Name.LocalName == CapabilitiesElement).ToList();
if (capabilitiesElements.Count > 1)
{
Debug.LogWarning("Failed to add the `InternetClient` capability, multiple `Capabilities` elements found inside `" + appManifestFilePath + "` file");
return;
}
else if (capabilitiesElements.Count == 0)
{
xmlFile.Root.Add(new XElement(XName.Get(CapabilitiesElement, defaultNamespace), GetInternetClientCapabilityElement(defaultNamespace)));
}
else // capabilitiesElements.Count == 1
{
var capabilitiesElement = capabilitiesElements[0];
foreach (var element in capabilitiesElement.Elements())
{
if (element.Name.LocalName == CapabilityElement &&
GetAttributeValue(element, CapabilityNameAttribute) == CapabilityNameAttributeValue)
{
return;
}
}
capabilitiesElement.Add(GetInternetClientCapabilityElement(defaultNamespace));
}
xmlFile.Save(appManifestFilePath);
}
private static XElement GetInternetClientCapabilityElement(string defaultNamespace)
{
return new XElement(XName.Get(CapabilityElement, defaultNamespace),
new XAttribute(CapabilityNameAttribute, CapabilityNameAttributeValue));
}
internal static string GetAttributeValue(XElement element, string attributeName)
{
var attribute = element.Attribute(attributeName);
return attribute == null ? null : attribute.Value;
}
#endregion
#region iOS Methods
private static void OnPostprocessProject(PBXProjectWrapper project)
{
// Need to add SQLite and zlib dependencies.
project.AddBuildProperty("OTHER_LDFLAGS", "-lsqlite3 -lz");
#if UNITY_2019_3_OR_NEWER
project.AddBuildProperty("CLANG_ENABLE_MODULES", "YES", true);
#else
project.AddBuildProperty("CLANG_ENABLE_MODULES", "YES");
#endif
}
private static void OnPostprocessInfo(PlistDocumentWrapper info, AppCenterSettings settings)
{
if (settings.UseDistribute && AppCenter.Distribute != null)
{
// Add App Center URL scemes.
var schemes = new List<string>() { "appcenter-" + settings.iOSAppSecret };
// Create a reflection call for getting custom schemes from iOS settings.
var playerSettingsClass = typeof(PlayerSettings.iOS);
var iOSURLSchemesMethod = playerSettingsClass.GetMethod("GetURLSchemes", BindingFlags.Static | BindingFlags.NonPublic);
// Verify that method exists and call it for getting custom schemes.
if (iOSURLSchemesMethod != null)
{
var schemesFromSettings = (string[])iOSURLSchemesMethod.Invoke(null, null);
schemes.AddRange(schemesFromSettings.ToList<string>());
}
// Generate scheme information.
var root = info.GetRoot();
var urlTypes = root.GetType().GetMethod("CreateArray").Invoke(root, new object[] { "CFBundleURLTypes" });
if (settings.UseDistribute && AppCenter.Distribute != null)
{
var urlType = urlTypes.GetType().GetMethod("AddDict").Invoke(urlTypes, null);
var setStringMethod = urlType.GetType().GetMethod("SetString");
setStringMethod.Invoke(urlType, new object[] { "CFBundleTypeRole", "None" });
setStringMethod.Invoke(urlType, new object[] { "CFBundleURLName", ApplicationIdHelper.GetApplicationId() });
var urlSchemes = urlType.GetType().GetMethod("CreateArray").Invoke(urlType, new[] { "CFBundleURLSchemes" });
// Add custom schemes defined in Unity players settings.
foreach (var scheme in schemes)
{
urlSchemes.GetType().GetMethod("AddString").Invoke(urlSchemes, new[] { scheme });
}
}
}
}
#endregion
}

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 1c0067cc6476946b180484e48966b142
timeCreated: 1497896393
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,190 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using Microsoft.AppCenter.Unity;
using System;
using System.IO;
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEngine;
public class AppCenterPreBuild : IPreprocessBuildWithReport
{
private const string AarFilePattern = "appcenter-{0}-release";
public int callbackOrder { get { return 0; } }
#if UNITY_WSA
private readonly Version RequiredMinimalUWPVersion = new Version("10.0.16299.0");
#endif
public void OnPreprocessBuild(BuildReport report)
{
OnPreprocessBuild(report.summary.platform, report.summary.outputPath);
}
public void OnPreprocessBuild(BuildTarget target, string path)
{
if (target == BuildTarget.Android)
{
#if !APPCENTER_DONT_USE_NATIVE_STARTER
var settingsMaker = new AppCenterSettingsMakerAndroid();
AddStartupCode(settingsMaker);
#if UNITY_ANDROID
AddSettingsFileToLoader(settingsMaker);
#endif
#endif
}
else if (target == BuildTarget.iOS)
{
#if !APPCENTER_DONT_USE_NATIVE_STARTER
AddStartupCode(new AppCenterSettingsMakerIos());
#endif
}
else if (target == BuildTarget.WSAPlayer)
{
#if UNITY_WSA
var currentMinimalPlatformVersion = new Version(EditorUserBuildSettings.wsaMinUWPSDK);
if (currentMinimalPlatformVersion < RequiredMinimalUWPVersion)
{
Debug.LogWarning($"Minimum platform version should be set to {RequiredMinimalUWPVersion} or higher. App Center does not support lower versions but it is set to {currentMinimalPlatformVersion}");
}
#endif
}
if (target == BuildTarget.Android)
{
// No linking/unlinking in case module isn't added.
if (AppCenter.Distribute != null)
{
LinkModule(AppCenterSettingsContext.SettingsInstance.UseDistribute, "distribute");
}
if (AppCenter.Analytics != null)
{
LinkModule(AppCenterSettingsContext.SettingsInstance.UseAnalytics, "analytics");
}
if (AppCenter.Crashes != null)
{
LinkModule(AppCenterSettingsContext.SettingsInstance.UseCrashes, "crashes");
}
}
}
#if UNITY_ANDROID
public static void AddSettingsFileToLoader(AppCenterSettingsMakerAndroid settingsMaker)
{
var loaderZipFile = AppCenterSettingsContext.AppCenterPath + "/Plugins/Android/appcenter-loader-release.aar";
const string loaderFolder = "appcenter-loader-release";
const string settingsFilePath = loaderFolder + "/res/values/appcenter-settings.xml";
const string settingsMetaFilePath = loaderFolder + "/res/values/appcenter-settings.xml.meta";
if (!File.Exists(loaderZipFile))
{
throw new IOException("Failed to load dependency file appcenter-loader-release.aar");
}
// Delete unzipped directory if it already exists.
if (Directory.Exists(loaderFolder))
{
Directory.Delete(loaderFolder, true);
}
AndroidLibraryHelper.UnzipFile(loaderZipFile, loaderFolder);
if (!Directory.Exists(loaderFolder))
{
throw new IOException("Unzipping loader folder failed.");
}
settingsMaker.CommitSettings(settingsFilePath);
// Delete the appcenter-settings.xml.meta file if generated.
if (File.Exists(settingsMetaFilePath))
{
File.Delete(settingsMetaFilePath);
}
// Delete the original aar file and zipped the extracted folder to generate a new one.
File.Delete(loaderZipFile);
AndroidLibraryHelper.ZipFile(loaderFolder, loaderZipFile);
Directory.Delete(loaderFolder, true);
}
#endif
private void AddStartupCode(IAppCenterSettingsMaker settingsMaker)
{
var settings = AppCenterSettingsContext.SettingsInstance;
var advancedSettings = AppCenterSettingsContext.SettingsInstanceAdvanced;
settingsMaker.SetAppSecret(settings);
settingsMaker.SetLogLevel((int)settings.InitialLogLevel);
settingsMaker.IsAllowNetworkRequests((bool)settings.AllowNetworkRequests);
if (settings.CustomLogUrl.UseCustomUrl)
{
settingsMaker.SetLogUrl(settings.CustomLogUrl.Url);
}
if (settings.MaxStorageSize.UseCustomMaxStorageSize && settings.MaxStorageSize.Size > 0)
{
settingsMaker.SetMaxStorageSize(settings.MaxStorageSize.Size);
}
if (settings.UseAnalytics && settingsMaker.IsAnalyticsAvailable())
{
settingsMaker.StartAnalyticsClass();
}
if (settings.UseCrashes && settingsMaker.IsCrashesAvailable())
{
settingsMaker.StartCrashesClass();
}
if (settings.UseDistribute && settingsMaker.IsDistributeAvailable())
{
if (settings.CustomApiUrl.UseCustomUrl)
{
settingsMaker.SetApiUrl(settings.CustomApiUrl.Url);
}
if (settings.CustomInstallUrl.UseCustomUrl)
{
settingsMaker.SetInstallUrl(settings.CustomInstallUrl.Url);
}
if (settings.EnableDistributeForDebuggableBuild)
{
settingsMaker.SetShouldEnableDistributeForDebuggableBuild();
}
if (!settings.AutomaticCheckForUpdate)
{
settingsMaker.SetDistributeDisableAutomaticCheckForUpdate();
}
settingsMaker.SetUpdateTrack(settings.UpdateTrack);
settingsMaker.StartDistributeClass();
}
if (advancedSettings != null)
{
var startupType = settingsMaker.IsStartFromAppCenterBehavior(advancedSettings) ? StartupType.Skip : advancedSettings.GetStartupType();
settingsMaker.SetStartupType((int)startupType);
settingsMaker.SetTransmissionTargetToken(advancedSettings.TransmissionTargetToken);
}
else
{
settingsMaker.SetStartupType((int)StartupType.AppCenter);
}
settingsMaker.CommitSettings();
}
#region Android Methods
private static void LinkModule(bool isEnabled, string moduleName)
{
var aarName = string.Format(AarFilePattern, moduleName);
var aarFileAsset = AssetDatabase.FindAssets(aarName, new[] { AppCenterSettingsContext.AppCenterPath + "/Plugins/Android" });
if (aarFileAsset.Length == 0)
{
Debug.LogWarning("Failed to link " + moduleName + ", file `" + aarName + "` is not found");
return;
}
var assetPath = AssetDatabase.GUIDToAssetPath(aarFileAsset[0]);
var importer = AssetImporter.GetAtPath(assetPath) as PluginImporter;
if (importer != null)
{
Debug.Log (moduleName + " is " + (isEnabled ? "" : "not ") + "enabled. " +
(isEnabled ? "Linking " : "Unlinking ") + aarName);
importer.SetCompatibleWithPlatform(BuildTarget.Android, isEnabled);
importer.SaveAndReimport();
}
}
#endregion
}

View File

@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: 16e4e6da5f50549cfb7ca7a683d8ae8f
timeCreated: 1513203132
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,86 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Linq;
public class AppCenterSettingsContext : ScriptableObject
{
private static string appCenterPath;
private static readonly string SettingsPath = AppCenterPath + "/AppCenterSettings.asset";
private static readonly string AdvancedSettingsPath = AppCenterPath + "/AppCenterSettingsAdvanced.asset";
public static string AppCenterPath
{
get
{
if (string.IsNullOrEmpty(appCenterPath))
{
appCenterPath = FindSubfolderPath("Assets", "AppCenter");
}
return appCenterPath;
}
}
public static AppCenterSettings SettingsInstance
{
get
{
// No need to lock because this can only be accessed from the main thread.
var instance = AssetDatabase.LoadAssetAtPath<AppCenterSettings>(SettingsPath);
if (instance == null)
{
instance = CreateInstance<AppCenterSettings>();
AssetDatabase.CreateAsset(instance, SettingsPath);
AssetDatabase.SaveAssets();
}
return instance;
}
}
public static AppCenterSettingsAdvanced SettingsInstanceAdvanced
{
get
{
// No need to lock because this can only be accessed from the main thread.
return AssetDatabase.LoadAssetAtPath<AppCenterSettingsAdvanced>(AdvancedSettingsPath);
}
}
private static string FindSubfolderPath(string parentFolder, string searchFolder)
{
string[] folders = AssetDatabase.GetSubFolders(parentFolder);
string resultFolder = folders.FirstOrDefault(folder => (new DirectoryInfo(folder)).Name == searchFolder);
if (string.IsNullOrEmpty(resultFolder) && folders.Length > 0)
{
string temp;
for (int i = 0; i < folders.Length; i++)
{
temp = FindSubfolderPath(folders[i], searchFolder);
if (!string.IsNullOrEmpty(temp))
{
return temp;
}
}
}
return resultFolder;
}
public static AppCenterSettingsAdvanced CreateSettingsInstanceAdvanced()
{
var instance = AssetDatabase.LoadAssetAtPath<AppCenterSettingsAdvanced>(AdvancedSettingsPath);
if (instance == null)
{
instance = CreateInstance<AppCenterSettingsAdvanced>();
AssetDatabase.CreateAsset(instance, AdvancedSettingsPath);
AssetDatabase.SaveAssets();
}
return instance;
}
public static void DeleteSettingsInstanceAdvanced()
{
AssetDatabase.DeleteAsset(AdvancedSettingsPath);
}
}

View File

@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: a2039654418774fd1a596ae0de6ec117
timeCreated: 1513203491
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,58 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using UnityEngine;
using UnityEditor;
using Microsoft.AppCenter.Unity;
[CustomEditor(typeof(AppCenterSettings))]
public class AppCenterSettingsEditor : Editor
{
public override void OnInspectorGUI()
{
serializedObject.Update();
// Draw app secrets.
Header("App Secrets");
EditorGUILayout.PropertyField(serializedObject.FindProperty("iOSAppSecret"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("AndroidAppSecret"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("UWPAppSecret"));
// Draw modules.
if (AppCenter.Analytics != null)
{
Header("Analytics");
EditorGUILayout.PropertyField(serializedObject.FindProperty("UseAnalytics"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("MaxStorageSize"));
}
if (AppCenter.Crashes != null)
{
Header("Crashes");
EditorGUILayout.PropertyField(serializedObject.FindProperty("UseCrashes"));
}
if (AppCenter.Distribute != null)
{
Header("Distribute");
var serializedProperty = serializedObject.FindProperty("UseDistribute");
EditorGUILayout.PropertyField(serializedProperty);
EditorGUILayout.PropertyField(serializedObject.FindProperty("UpdateTrack"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("AutomaticCheckForUpdate"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("EnableDistributeForDebuggableBuild"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("CustomApiUrl"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("CustomInstallUrl"));
}
// Draw other.
Header("Other Setup");
EditorGUILayout.PropertyField(serializedObject.FindProperty("InitialLogLevel"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("CustomLogUrl"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("AllowNetworkRequests"));
serializedObject.ApplyModifiedProperties();
}
private static void Header(string label)
{
GUILayout.Label(label, EditorStyles.boldLabel);
GUILayout.Space(-4);
}
}

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: a8247f056cc059c4aa3d9b57058f5d64
timeCreated: 1502269651
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,20 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(AppCenterSettingsAdvanced))]
public class AppCenterSettingsEditorAdvanced : Editor
{
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(serializedObject.FindProperty("TransmissionTargetToken"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("StartAndroidNativeSDKFromAppCenterBehavior"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("StartIOSNativeSDKFromAppCenterBehavior"), new GUIContent("Start iOS Native SDK From App Center Behavior"));
//The following line can be useful if you want to be able to configure StartupType from AppCenter Behaviour Advanced.
//EditorGUILayout.PropertyField(serializedObject.FindProperty("AppCenterStartupType"));
serializedObject.ApplyModifiedProperties();
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 3a11f2b13c794884191a36df20b65b1a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,140 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System.Collections.Generic;
using System.IO;
public class AppCenterSettingsMakerAndroid : IAppCenterSettingsMaker
{
private const string AppSecretKey = "appcenter_app_secret";
private const string AllowNetworkRequestsKey = "allow_network_requests";
private const string TransmissionTargetTokenKey = "appcenter_transmission_target_token";
private const string CustomLogUrlKey = "appcenter_custom_log_url";
private const string UseCustomLogUrlKey = "appcenter_use_custom_log_url";
private const string InitialLogLevelKey = "appcenter_initial_log_level";
private const string StartupTypeKey = "appcenter_startup_type";
private const string UseCrashesKey = "appcenter_use_crashes";
private const string UseAnalyticsKey = "appcenter_use_analytics";
private const string UseDistributeKey = "appcenter_use_distribute";
private const string DistributeDisableAutomaticCheckForUpdateKey = "appcenter_distribute_disable_automatic_check_for_update";
private const string CustomApiUrlKey = "appcenter_custom_api_url";
private const string UseCustomApiUrlKey = "appcenter_use_custom_api_url";
private const string CustomInstallUrlKey = "appcenter_custom_install_url";
private const string UseCustomInstallUrlKey = "appcenter_use_custom_install_url";
private const string MaxStorageSizeKey = "appcenter_max_storage_size";
private const string UpdateTrackKey = "appcenter_update_track";
private const string EnableDistributeForDebuggableBuildKey = "appcenter_enable_distribute_for_debuggable_build";
private readonly IDictionary<string, string> _resourceValues = new Dictionary<string, string>();
public void SetLogLevel(int logLevel)
{
_resourceValues[InitialLogLevelKey] = logLevel.ToString();
}
public void SetStartupType(int startupType)
{
_resourceValues[StartupTypeKey] = startupType.ToString();
}
public void SetUpdateTrack(int updateTrack)
{
_resourceValues[UpdateTrackKey] = updateTrack.ToString();
}
public void SetLogUrl(string logUrl)
{
_resourceValues[CustomLogUrlKey] = logUrl;
_resourceValues[UseCustomLogUrlKey] = true.ToString();
}
public void IsAllowNetworkRequests(bool isAllowed)
{
_resourceValues[AllowNetworkRequestsKey] = isAllowed.ToString();
}
public void SetAppSecret(AppCenterSettings settings)
{
_resourceValues[AppSecretKey] = settings.AndroidAppSecret;
}
public void SetTransmissionTargetToken(string transmissionTargetToken)
{
_resourceValues[TransmissionTargetTokenKey] = transmissionTargetToken;
}
public void StartCrashesClass()
{
_resourceValues[UseCrashesKey] = true.ToString();
}
public void StartAnalyticsClass()
{
_resourceValues[UseAnalyticsKey] = true.ToString();
}
public void StartDistributeClass()
{
_resourceValues[UseDistributeKey] = true.ToString();
}
public void SetDistributeDisableAutomaticCheckForUpdate()
{
_resourceValues[DistributeDisableAutomaticCheckForUpdateKey] = true.ToString();
}
public void SetApiUrl(string apiUrl)
{
_resourceValues[CustomApiUrlKey] = apiUrl;
_resourceValues[UseCustomApiUrlKey] = true.ToString();
}
public void SetInstallUrl(string installUrl)
{
_resourceValues[CustomInstallUrlKey] = installUrl;
_resourceValues[UseCustomInstallUrlKey] = true.ToString();
}
public void SetMaxStorageSize(long size)
{
_resourceValues[MaxStorageSizeKey] = size.ToString();
}
public void CommitSettings()
{
}
public void CommitSettings(string filePath)
{
if (File.Exists(filePath))
{
File.Delete(filePath);
}
XmlResourceHelper.WriteXmlResource(filePath, _resourceValues);
}
public bool IsStartFromAppCenterBehavior(AppCenterSettingsAdvanced advancedSettings)
{
return advancedSettings.StartAndroidNativeSDKFromAppCenterBehavior;
}
public bool IsAnalyticsAvailable()
{
return File.Exists(AppCenterSettingsContext.AppCenterPath + "/Plugins/Android/appcenter-analytics-release.aar");
}
public bool IsCrashesAvailable()
{
return File.Exists(AppCenterSettingsContext.AppCenterPath + "/Plugins/Android/appcenter-crashes-release.aar");
}
public bool IsDistributeAvailable()
{
return File.Exists(AppCenterSettingsContext.AppCenterPath + "/Plugins/Android/appcenter-distribute-release.aar");
}
public void SetShouldEnableDistributeForDebuggableBuild()
{
_resourceValues[EnableDistributeForDebuggableBuildKey] = true.ToString();
}
}

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 0b2133faca91a47b49acd4d0fe6e076f
timeCreated: 1502322233
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,150 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System.IO;
using UnityEditor;
public class AppCenterSettingsMakerIos : IAppCenterSettingsMaker
{
private static readonly string TemplateFilePath = AppCenterSettingsContext.AppCenterPath + "/Plugins/iOS/Core/AppCenterStarter.original";
private static readonly string TargetFilePath = AppCenterSettingsContext.AppCenterPath + "/Plugins/iOS/Core/AppCenterStarter.m";
private const string AppSecretSearchText = "appcenter-app-secret";
private const string AllowNetworkRequestsText = "allow-network-requests";
private const string TransmissionTargetTokenSearchText = "appcenter-transmission-target-token";
private const string LogUrlSearchText = "custom-log-url";
private const string LogUrlToken = "APPCENTER_UNITY_USE_CUSTOM_LOG_URL";
private const string LogLevelSearchText = "0/*LOG_LEVEL*/";
private const string StartupTypeSearchText = "0/*STARTUP_TYPE*/";
private const string UseCrashesToken = "APPCENTER_UNITY_USE_CRASHES";
private const string UseAnalyticsToken = "APPCENTER_UNITY_USE_ANALYTICS";
private const string UseDistributeToken = "APPCENTER_UNITY_USE_DISTRIBUTE";
private const string DistributeDisableAutomaticCheckForUpdateToken = "APPCENTER_DISTRIBUTE_DISABLE_AUTOMATIC_CHECK_FOR_UPDATE";
private const string ApiUrlSearchText = "custom-api-url";
private const string ApiUrlToken = "APPCENTER_UNITY_USE_CUSTOM_API_URL";
private const string InstallUrlSearchText = "custom-install-url";
private const string InstallUrlToken = "APPCENTER_UNITY_USE_CUSTOM_INSTALL_URL";
private const string UseCustomMaxStorageSize = "APPCENTER_USE_CUSTOM_MAX_STORAGE_SIZE";
private const string MaxStorageSize = "APPCENTER_MAX_STORAGE_SIZE";
private const string UpdateTrackSearchText = "1 /*UPDATE_TRACK*/";
private string _loaderFileText;
private bool _enableDistributeForDebuggableBuild;
public AppCenterSettingsMakerIos()
{
_loaderFileText = File.ReadAllText(TemplateFilePath);
}
public void SetLogLevel(int logLevel)
{
_loaderFileText = _loaderFileText.Replace(LogLevelSearchText, logLevel.ToString());
}
public void IsAllowNetworkRequests(bool isAllowed)
{
_loaderFileText = _loaderFileText.Replace(AllowNetworkRequestsText, isAllowed ? "YES" : "NO");
}
public void SetStartupType(int startupType)
{
_loaderFileText = _loaderFileText.Replace(StartupTypeSearchText, startupType.ToString());
}
public void SetLogUrl(string logUrl)
{
AddToken(LogUrlToken);
_loaderFileText = _loaderFileText.Replace(LogUrlSearchText, logUrl);
}
public void SetAppSecret(AppCenterSettings settings)
{
_loaderFileText = _loaderFileText.Replace(AppSecretSearchText, settings.iOSAppSecret);
}
public void SetTransmissionTargetToken(string transmissionTargetToken)
{
_loaderFileText = _loaderFileText.Replace(TransmissionTargetTokenSearchText, transmissionTargetToken);
}
public void StartCrashesClass()
{
AddToken(UseCrashesToken);
}
public void StartDistributeClass()
{
if (_enableDistributeForDebuggableBuild || !EditorUserBuildSettings.development)
{
AddToken(UseDistributeToken);
}
}
public void StartAnalyticsClass()
{
AddToken(UseAnalyticsToken);
}
public void SetApiUrl(string apiUrl)
{
AddToken(ApiUrlToken);
_loaderFileText = _loaderFileText.Replace(ApiUrlSearchText, apiUrl);
}
public void SetInstallUrl(string installUrl)
{
AddToken(InstallUrlToken);
_loaderFileText = _loaderFileText.Replace(InstallUrlSearchText, installUrl);
}
public void CommitSettings()
{
File.WriteAllText(TargetFilePath, _loaderFileText);
}
public void SetMaxStorageSize(long size)
{
AddToken(UseCustomMaxStorageSize);
_loaderFileText = _loaderFileText.Replace(MaxStorageSize, size.ToString());
}
private void AddToken(string token)
{
var tokenText = "#define " + token + "\n";
_loaderFileText = tokenText + _loaderFileText;
}
public bool IsStartFromAppCenterBehavior(AppCenterSettingsAdvanced advancedSettings)
{
return advancedSettings.StartIOSNativeSDKFromAppCenterBehavior;
}
public bool IsAnalyticsAvailable()
{
return Directory.Exists(AppCenterSettingsContext.AppCenterPath + "/Plugins/iOS/Analytics");
}
public bool IsCrashesAvailable()
{
return Directory.Exists(AppCenterSettingsContext.AppCenterPath + "/Plugins/iOS/Crashes");
}
public bool IsDistributeAvailable()
{
return Directory.Exists(AppCenterSettingsContext.AppCenterPath + "/Plugins/iOS/Distribute");
}
public void SetShouldEnableDistributeForDebuggableBuild()
{
_enableDistributeForDebuggableBuild = true;
}
public void SetDistributeDisableAutomaticCheckForUpdate()
{
AddToken(DistributeDisableAutomaticCheckForUpdateToken);
}
public void SetUpdateTrack(int updateTrack)
{
_loaderFileText = _loaderFileText.Replace(UpdateTrackSearchText, updateTrack.ToString());
}
}

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: bb87d249dd7a048688f34b63e118a7b0
timeCreated: 1502216315
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,19 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using UnityEditor;
using UnityEngine;
[CustomPropertyDrawer(typeof(AppSecretAttribute))]
public class AppSecretDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
var name = ((AppSecretAttribute) attribute).Name;
if (!string.IsNullOrEmpty(name))
{
label.text = name;
}
EditorGUI.PropertyField(position, property, label);
}
}

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 119814cc89d1e4652975a06e6df567c6
timeCreated: 1504046963
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,12 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using UnityEditor;
public static class ApplicationIdHelper
{
public static string GetApplicationId()
{
return PlayerSettings.applicationIdentifier;
}
}

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: c39732e4de5a34bfbbda09c28c8e7f9f
timeCreated: 1503349438
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,39 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
[CustomPropertyDrawer(typeof(CustomDropDownPropertyAttribute))]
public class CustomDropDownPropertyDrawer : PropertyDrawer
{
bool _initialized = false;
object[] _attributes = null;
Dictionary<string, int> _optionsDictionary = new Dictionary<string, int>();
string[] _options = null;
int _selectedIndex = 0;
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
if (!_initialized)
{
_attributes = fieldInfo.GetCustomAttributes(typeof(CustomDropDownPropertyAttribute), false);
foreach (var itemAttribute in _attributes)
{
var customPropertyAttribute = itemAttribute as CustomDropDownPropertyAttribute;
_optionsDictionary.Add(customPropertyAttribute.SelectedKey, customPropertyAttribute.SelectedValue);
if (customPropertyAttribute.SelectedValue == AppCenterSettingsContext.SettingsInstance.UpdateTrack)
{
_selectedIndex = ArrayUtility.IndexOf(_attributes, itemAttribute);
}
}
_options = _optionsDictionary.Keys.ToArray();
_initialized = true;
}
_selectedIndex = EditorGUI.Popup(position, property.displayName, _selectedIndex, _options);
property.intValue = _optionsDictionary[_options[_selectedIndex]];
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: f0e8996e972247549b62c85a8d7aa869
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,43 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using UnityEngine;
using UnityEditor;
[CustomPropertyDrawer(typeof(CustomUrlProperty))]
public class CustomUrlPropertyDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
property.Next(true);
var urlName = property.stringValue;
var useLabel = new GUIContent("Use Custom " + urlName + " URL");
var urlLabel = new GUIContent("Custom " + urlName + " URL");
// Though the property may have double height, each child should have
// half that height.
position.height = EditorGUIUtility.singleLineHeight;
property.Next(false);
EditorGUI.PropertyField(position, property, useLabel);
if (property.boolValue)
{
property.Next(false);
position.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(position, property, urlLabel);
}
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
// If "set custom log url" is true, need to make room for the text field.
property.Next(true);
property.Next(false);
var height = base.GetPropertyHeight(property, label);
if (property.boolValue)
{
height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
return height;
}
}

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: ebeca1d941dd04282895d881deecbc6c
timeCreated: 1504725583
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,26 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
public interface IAppCenterSettingsMaker
{
bool IsAnalyticsAvailable();
bool IsCrashesAvailable();
void IsAllowNetworkRequests(bool isAllowed);
bool IsDistributeAvailable();
void StartAnalyticsClass();
void StartCrashesClass();
void StartDistributeClass();
void SetAppSecret(AppCenterSettings settings);
void SetTransmissionTargetToken(string transmissionTargetToken);
void SetLogLevel(int logLevel);
bool IsStartFromAppCenterBehavior(AppCenterSettingsAdvanced advancedSettings);
void SetStartupType(int startupType);
void SetLogUrl(string logUrl);
void SetApiUrl(string apiUrl);
void SetInstallUrl(string installUrl);
void SetMaxStorageSize(long size);
void CommitSettings();
void SetShouldEnableDistributeForDebuggableBuild();
void SetDistributeDisableAutomaticCheckForUpdate();
void SetUpdateTrack(int updateTrack);
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a40c6c75c7d49cd4ab84b0d6d68a509f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,35 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using UnityEngine;
using UnityEditor;
[CustomPropertyDrawer(typeof(MaxStorageSizeProperty))]
public class MaxStorageSizePropertyDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
var useLabel = new GUIContent("Use Custom Max Storage Size");
var urlLabel = new GUIContent("Max Storage Size Bytes");
position.height = EditorGUIUtility.singleLineHeight; // Though the property may have double height, each child should have half that height.
property.Next(true);
EditorGUI.PropertyField(position, property, useLabel);
if (property.boolValue)
{
property.Next(false);
position.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(position, property, urlLabel);
}
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
property.Next(true); // If "Use Custom Max Storage Size" is true, need to make room for the text field.
var height = base.GetPropertyHeight(property, label);
if (property.boolValue)
{
height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
return height;
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 428e5cf118c809a40b0fbc4b93d77e60
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,103 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using System.Reflection;
/*
* Wrapper class for PBXProject that invokes methods via reflection. Needed
* because there are cases when conditional compilation symbols are not
* defined soon enough to use the class directly. Using the class directly
* can cause problems on Windows machines that don't have the iOS build
* tool installed.
*/
public class PBXProjectWrapper
{
private static readonly Type PBXProjectType;
private object _pbxProject;
private string _projectPath;
static PBXProjectWrapper()
{
var xcExtensionsAssembly = Assembly.Load("UnityEditor.iOS.Extensions.Xcode");
if (xcExtensionsAssembly != null)
{
PBXProjectType = xcExtensionsAssembly.GetType("UnityEditor.iOS.Xcode.PBXProject");
}
}
public static string GetUnityTargetName()
{
var flags = BindingFlags.Public | BindingFlags.Static;
return PBXProjectType.GetMethod("GetUnityTargetName", flags)
.Invoke(PBXProjectType, null) as string;
}
public string GetUnityTargetGuid()
{
#if UNITY_2019_3_OR_NEWER
return PBXProjectType.GetMethod("GetUnityFrameworkTargetGuid")
.Invoke(_pbxProject, null).ToString();
#else
return null;
#endif
}
public static bool PBXProjectIsAvailable
{
get
{
return PBXProjectType != null;
}
}
public string ProjectPath
{
get
{
return _projectPath;
}
}
public PBXProjectWrapper(string pathToBuiltProject)
{
var flags = BindingFlags.Public | BindingFlags.Static;
var arguments = new object[] { pathToBuiltProject };
_projectPath = PBXProjectType.GetMethod("GetPBXProjectPath", flags)
.Invoke(PBXProjectType, arguments) as string;
_pbxProject = PBXProjectType.GetConstructor(Type.EmptyTypes).Invoke(null);
PBXProjectType.GetMethod("ReadFromFile").Invoke(_pbxProject, new[] { _projectPath });
}
public void WriteToFile()
{
PBXProjectType.GetMethod("WriteToFile").Invoke(_pbxProject, new[] { _projectPath });
}
#if UNITY_2019_3_OR_NEWER
public void AddBuildProperty(string name, string value, bool toFrameworkTarget = false)
#else
public void AddBuildProperty(string name, string value)
#endif
{
object targetGuid;
#if UNITY_2019_3_OR_NEWER
targetGuid = PBXProjectType.GetMethod("GetUnityMainTargetGuid")
.Invoke(_pbxProject, null);
if (toFrameworkTarget)
{
object frameworkTarget = PBXProjectType.GetMethod("GetUnityFrameworkTargetGuid").Invoke(_pbxProject, null);
PBXProjectType.GetMethod("AddBuildProperty", new[] { typeof(string), typeof(string), typeof(string) })
.Invoke(_pbxProject, new[] { frameworkTarget, name, value });
}
#else
var targetName = GetUnityTargetName();
targetGuid = PBXProjectType.GetMethod("TargetGuidByName")
.Invoke(_pbxProject, new object[] { targetName });
#endif
PBXProjectType.GetMethod("AddBuildProperty",
new[] { typeof(string), typeof(string), typeof(string) })
.Invoke(_pbxProject,
new[] { targetGuid, name, value });
}
}

View File

@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: f4e4b5327bd6d4fa1b30a0da2ba6ae46
timeCreated: 1513288156
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,46 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using System.Reflection;
public class PlistDocumentWrapper
{
private object _plistDocument;
private string _path;
private static readonly Type PlistDocumentType;
static PlistDocumentWrapper()
{
var xcExtensionsAssembly = Assembly.Load("UnityEditor.iOS.Extensions.Xcode");
if (xcExtensionsAssembly != null)
{
PlistDocumentType = xcExtensionsAssembly.GetType("UnityEditor.iOS.Xcode.PlistDocument");
}
}
public static bool PlistDocumentIsAvailable
{
get
{
return PlistDocumentType != null;
}
}
public PlistDocumentWrapper(string path)
{
_path = path;
_plistDocument = PlistDocumentType.GetConstructor(Type.EmptyTypes).Invoke(null);
PlistDocumentType.GetMethod("ReadFromFile").Invoke(_plistDocument, new[] { _path });
}
public object GetRoot()
{
return PlistDocumentType.GetField("root").GetValue(_plistDocument);
}
public void WriteToFile()
{
PlistDocumentType.GetMethod("WriteToFile").Invoke(_plistDocument, new[] { _path });
}
}

View File

@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: 1fce65b4e1d6646dda661bf55f78e3f6
timeCreated: 1513288156
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,53 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using System.Reflection;
public class ProjectCapabilityManagerWrapper
{
private static readonly Type ProjectCapabilityManagerType;
private object _capabilityManager;
static ProjectCapabilityManagerWrapper()
{
var xcExtensionsAssembly = Assembly.Load("UnityEditor.iOS.Extensions.Xcode");
if (xcExtensionsAssembly != null)
{
ProjectCapabilityManagerType = xcExtensionsAssembly.GetType("UnityEditor.iOS.Xcode.ProjectCapabilityManager");
}
}
public void AddRemoteNotificationsToBackgroundModes()
{
var backgroundModesEnumType = ProjectCapabilityManagerType.Assembly.GetType("UnityEditor.iOS.Xcode.BackgroundModesOptions");
var remoteNotifEnum = Enum.Parse(backgroundModesEnumType, "RemoteNotifications");
ProjectCapabilityManagerType.GetMethod("AddBackgroundModes").Invoke(_capabilityManager, new object[] { remoteNotifEnum });
}
public static bool ProjectCapabilityManagerIsAvailable
{
get
{
return ProjectCapabilityManagerType != null;
}
}
public ProjectCapabilityManagerWrapper(string projectPath, string targetName, string targetGuid)
{
#if UNITY_2019_3_OR_NEWER
_capabilityManager = ProjectCapabilityManagerType
.GetConstructor(new[] { typeof(string), typeof(string), typeof(string), typeof(string) })
.Invoke(new object[] { projectPath, targetName + ".entitlements", targetName, targetGuid });
#else
_capabilityManager = ProjectCapabilityManagerType
.GetConstructor(new[] { typeof(string), typeof(string), typeof(string)})
.Invoke(new object[] { projectPath, targetName + ".entitlements", targetName });
#endif
}
public void WriteToFile()
{
ProjectCapabilityManagerType.GetMethod("WriteToFile").Invoke(_capabilityManager, null);
}
}

View File

@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: 6ca2e2a428dbc432c930ec7a5b186fba
timeCreated: 1513288156
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,40 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System.Collections.Generic;
using System.IO;
using System.Xml;
public static class XmlResourceHelper
{
public static void WriteXmlResource(string path, IDictionary<string, string> resourceValues)
{
var xws = new XmlWriterSettings
{
Indent = true
};
using (var sw = File.Create(path))
using (var xw = XmlWriter.Create(sw, xws))
{
xw.WriteStartDocument();
xw.WriteStartElement("resources");
foreach (var kvp in resourceValues)
{
if (!string.IsNullOrEmpty(kvp.Value))
{
xw.WriteStartElement("string");
xw.WriteAttributeString("name", kvp.Key);
xw.WriteAttributeString("translatable", "false");
xw.WriteString(kvp.Value);
xw.WriteEndElement();
}
}
xw.WriteEndElement();
xw.WriteEndDocument();
xw.Flush();
xw.Close();
}
}
}

View File

@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: dc5634190b21448b6bdeac14c833304c
timeCreated: 1513106215
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: e2b03a217b6ed8349b372a679a0f7aae
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: afed194a733530a4eb52e6e0d76a80b1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,34 +0,0 @@
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:

View File

@ -1,43 +0,0 @@
// 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");
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: c7653ac593f8a4859bc75b4952e2a9dc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,49 +0,0 @@
// 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

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: ebd2662d8c212481b8ae72fe6be77873
timeCreated: 1498578955
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,38 +0,0 @@
// 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

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: dcfb87d5b5fb94c77b4d361b4791a677
timeCreated: 1498578955
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,46 +0,0 @@
// 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

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 80fb4bb7b657748d399b89f4367331e8
timeCreated: 1498496048
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,21 +0,0 @@
# 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"
}

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 27462eedb9e0e4dee8d0ff51fe4dee0d
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,23 +0,0 @@
# 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"
}

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 7fff91df92b854ad680ee28ba1c36fce
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,33 +0,0 @@
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:

View File

@ -1,31 +0,0 @@
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:

View File

@ -1,33 +0,0 @@
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:

View File

@ -1,33 +0,0 @@
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:

View File

@ -1,33 +0,0 @@
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:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 4de8fbe7ed99aa245bf6616636b6c980
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 3834fae7b40ff624cbea26abb8c648d4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 3081e1f5b9e3f4598ba1d4ec33c30d17
folderAsset: yes
timeCreated: 1498059874
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,96 +0,0 @@
// 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

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: a713100f59727486c9ad45c500332234
timeCreated: 1497467718
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,44 +0,0 @@
// 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

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 514cee750a1f56f4bab5c663b3a4f557
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,70 +0,0 @@
// 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

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: e670e8c4e24f54cb3b15b96cba63313b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,82 +0,0 @@
// 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

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 9b4de3e63b6764e059567a9e87feda60
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 05baa696b2306473096af3c82bf25429
folderAsset: yes
timeCreated: 1498059884
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,83 +0,0 @@
// 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

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 632c05efd92fe4ec9b424381b5392d76
timeCreated: 1497465139
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,41 +0,0 @@
// 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

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 61494a0be6a398041ad0f0aa1de5408e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,66 +0,0 @@
// 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

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 09033f50c9aa64a7bae8097136a84d14
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,75 +0,0 @@
// 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

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 619352a0db14645c2a7441de0d98e790
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 7c61caec9e69a40ae90907778a8ccc69
folderAsset: yes
timeCreated: 1503941147
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More