app center;增加發送ping的秒
This commit is contained in:
1 parent
1bd1ffdb5a
commit
d754ff3b15
719 files changed
+34172
-2875
No files matched your search
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 12452918d45f0491a8254ea6beaaeeaa
|
||||
folderAsset: yes
|
||||
timeCreated: 1499463013
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
using UnityEngine;
|
||||
|
||||
namespace Microsoft.AppCenter.Unity.Distribute.Internal
|
||||
{
|
||||
class DistributeDelegate : AndroidJavaProxy
|
||||
{
|
||||
private DistributeDelegate() : base("com.microsoft.appcenter.distribute.DistributeListener")
|
||||
{
|
||||
}
|
||||
|
||||
public static void SetDelegate()
|
||||
{
|
||||
var distribute = new AndroidJavaClass("com.microsoft.appcenter.distribute.Distribute");
|
||||
distribute.CallStatic("setListener", new DistributeDelegate());
|
||||
}
|
||||
|
||||
bool onReleaseAvailable(AndroidJavaObject activity, AndroidJavaObject details)
|
||||
{
|
||||
if (Distribute.ReleaseAvailable == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var releaseDetails = ReleaseDetailsHelper.ReleaseDetailsConvert(details);
|
||||
return Distribute.ReleaseAvailable.Invoke(releaseDetails);
|
||||
}
|
||||
|
||||
void onNoReleaseAvailable(AndroidJavaObject activity)
|
||||
{
|
||||
if (Distribute.NoReleaseAvailable == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Distribute.NoReleaseAvailable.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5565f155f9c0341da9553fceba984a9b
|
||||
timeCreated: 1499731881
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,87 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AppCenter.Unity.Internal;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Microsoft.AppCenter.Unity.Distribute.Internal
|
||||
{
|
||||
class DistributeInternal
|
||||
{
|
||||
private static AndroidJavaClass _distribute = new AndroidJavaClass("com.microsoft.appcenter.distribute.Distribute");
|
||||
|
||||
public static void PrepareEventHandlers()
|
||||
{
|
||||
AppCenterBehavior.InitializingServices += Initialize;
|
||||
AppCenterBehavior.Started += StartBehavior;
|
||||
}
|
||||
|
||||
private static void Initialize()
|
||||
{
|
||||
DistributeDelegate.SetDelegate();
|
||||
}
|
||||
|
||||
private static void StartBehavior()
|
||||
{
|
||||
var instance = _distribute.CallStatic<AndroidJavaObject>("getInstance");
|
||||
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
|
||||
AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
|
||||
instance.Call("onActivityResumed", activity);
|
||||
}
|
||||
|
||||
public static AppCenterTask SetEnabledAsync(bool isEnabled)
|
||||
{
|
||||
var future = _distribute.CallStatic<AndroidJavaObject>("setEnabled", isEnabled);
|
||||
return new AppCenterTask(future);
|
||||
}
|
||||
|
||||
public static AppCenterTask<bool> IsEnabledAsync()
|
||||
{
|
||||
var future = _distribute.CallStatic<AndroidJavaObject>("isEnabled");
|
||||
return new AppCenterTask<bool>(future);
|
||||
}
|
||||
|
||||
public static void AddNativeType(List<IntPtr> nativeTypes)
|
||||
{
|
||||
nativeTypes.Add(AndroidJNI.FindClass("com/microsoft/appcenter/distribute/Distribute"));
|
||||
}
|
||||
|
||||
public static void SetInstallUrl(string installUrl)
|
||||
{
|
||||
_distribute.CallStatic("setInstallUrl", installUrl);
|
||||
}
|
||||
|
||||
public static void SetApiUrl(string apiUrl)
|
||||
{
|
||||
_distribute.CallStatic("setApiUrl", apiUrl);
|
||||
}
|
||||
|
||||
public static void NotifyUpdateAction(int updateAction)
|
||||
{
|
||||
var nativeAction = -2;
|
||||
switch((UpdateAction)updateAction) {
|
||||
case UpdateAction.Update:
|
||||
nativeAction = -1;
|
||||
break;
|
||||
case UpdateAction.Postpone:
|
||||
nativeAction = -2;
|
||||
break;
|
||||
}
|
||||
_distribute.CallStatic("notifyUpdateAction", nativeAction);
|
||||
}
|
||||
|
||||
public static void CheckForUpdate()
|
||||
{
|
||||
_distribute.CallStatic("checkForUpdate");
|
||||
}
|
||||
|
||||
public static void StartDistribute()
|
||||
{
|
||||
AppCenterInternal.Start(AppCenter.Distribute);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c1521cae000a1431baeec88f1fc4656b
|
||||
timeCreated: 1499725672
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Microsoft.AppCenter.Unity.Distribute.Internal
|
||||
{
|
||||
class ReleaseDetailsHelper
|
||||
{
|
||||
public static ReleaseDetails ReleaseDetailsConvert(AndroidJavaObject details)
|
||||
{
|
||||
var id = details.Call<int>("getId");
|
||||
var version = details.Call<int>("getVersion").ToString();
|
||||
var shortVersion = details.Call<string>("getShortVersion");
|
||||
var releaseNotes = details.Call<string>("getReleaseNotes");
|
||||
var mandatoryUpdate = details.Call<bool>("isMandatoryUpdate");
|
||||
var javaUri = details.Call<AndroidJavaObject>("getReleaseNotesUrl");
|
||||
var uriString = javaUri.Call<string>("toString");
|
||||
var uri = new Uri(uriString);
|
||||
|
||||
return new ReleaseDetails
|
||||
{
|
||||
Id = id,
|
||||
Version = version,
|
||||
ShortVersion = shortVersion,
|
||||
ReleaseNotes = releaseNotes,
|
||||
MandatoryUpdate = mandatoryUpdate,
|
||||
ReleaseNotesUrl = uri
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1301d17c916574ed1a03ba682d73fa10
|
||||
timeCreated: 1499731881
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 24aa0d1ff15d14448bbda7267480dd0f
|
||||
folderAsset: yes
|
||||
timeCreated: 1499465707
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,56 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#if (!UNITY_IOS && !UNITY_ANDROID && !UNITY_WSA_10_0) || UNITY_EDITOR
|
||||
|
||||
namespace Microsoft.AppCenter.Unity.Distribute.Internal
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
using RawType = System.IntPtr;
|
||||
#else
|
||||
using RawType = System.Type;
|
||||
#endif
|
||||
|
||||
class DistributeInternal
|
||||
{
|
||||
public static void PrepareEventHandlers()
|
||||
{
|
||||
}
|
||||
|
||||
public static void AddNativeType(List<RawType> nativeTypes)
|
||||
{
|
||||
}
|
||||
|
||||
public static AppCenterTask SetEnabledAsync(bool enabled)
|
||||
{
|
||||
return AppCenterTask.FromCompleted();
|
||||
}
|
||||
|
||||
public static AppCenterTask<bool> IsEnabledAsync()
|
||||
{
|
||||
return AppCenterTask<bool>.FromCompleted(false);
|
||||
}
|
||||
|
||||
public static void SetInstallUrl(string installUrl)
|
||||
{
|
||||
}
|
||||
|
||||
public static void SetApiUrl(string apiUrl)
|
||||
{
|
||||
}
|
||||
|
||||
public static void NotifyUpdateAction(int updateAction)
|
||||
{
|
||||
}
|
||||
|
||||
public static void StartDistribute()
|
||||
{
|
||||
}
|
||||
|
||||
public static void CheckForUpdate()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ece8cf2ab2a84482ae4b62dbe028324
|
||||
timeCreated: 1499465889
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c25d137b36c1841b6b2a732e6e8d6e6b
|
||||
folderAsset: yes
|
||||
timeCreated: 1503941150
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,106 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AppCenter.Unity.Distribute.Internal;
|
||||
|
||||
namespace Microsoft.AppCenter.Unity.Distribute
|
||||
{
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
using RawType = System.IntPtr;
|
||||
#else
|
||||
using RawType = System.Type;
|
||||
#endif
|
||||
|
||||
public class Distribute
|
||||
{
|
||||
// Used by App Center Unity Editor Extensions: https://github.com/Microsoft/AppCenter-SDK-Unity-Extension
|
||||
public const string DistributeSDKVersion = "4.3.0";
|
||||
|
||||
public static void PrepareEventHandlers()
|
||||
{
|
||||
DistributeInternal.PrepareEventHandlers();
|
||||
}
|
||||
|
||||
public static void AddNativeType(List<RawType> nativeTypes)
|
||||
{
|
||||
DistributeInternal.AddNativeType(nativeTypes);
|
||||
}
|
||||
|
||||
public static AppCenterTask<bool> IsEnabledAsync()
|
||||
{
|
||||
return DistributeInternal.IsEnabledAsync();
|
||||
}
|
||||
|
||||
public static AppCenterTask SetEnabledAsync(bool enabled)
|
||||
{
|
||||
return DistributeInternal.SetEnabledAsync(enabled);
|
||||
}
|
||||
|
||||
public static void CheckForUpdate()
|
||||
{
|
||||
DistributeInternal.CheckForUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change the base URL opened in the browser to get update token from user login information.
|
||||
/// </summary>
|
||||
/// <param name="installUrl">Install base URL.</param>
|
||||
public static void SetInstallUrl(string installUrl)
|
||||
{
|
||||
DistributeInternal.SetInstallUrl(installUrl);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change the base URL used to make API calls.
|
||||
/// </summary>
|
||||
/// <param name="apiUrl">API base URL.</param>
|
||||
public static void SetApiUrl(string apiUrl)
|
||||
{
|
||||
DistributeInternal.SetApiUrl(apiUrl);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the release available callback.
|
||||
/// </summary>
|
||||
/// <value>The release available callback.</value>
|
||||
public static ReleaseAvailableCallback ReleaseAvailable
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the app will exit callback.
|
||||
/// </summary>
|
||||
/// <value>The app will exit callback.</value>
|
||||
public static WillExitAppCallback WillExitApp
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the no release available callback.
|
||||
/// </summary>
|
||||
/// <value>The no release available callback.</value>
|
||||
public static NoReleaseAvailableCallback NoReleaseAvailable
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public static void StartDistribute()
|
||||
{
|
||||
DistributeInternal.StartDistribute();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If update dialog is customized by returning <c>true</c> in <see cref="ReleaseAvailableCallback"/>,
|
||||
/// You need to tell the distribute SDK using this function what is the user action.
|
||||
/// </summary>
|
||||
/// <param name="updateAction">Update action. On mandatory update, you can only pass <see cref="UpdateAction.Update"/></param>
|
||||
public static void NotifyUpdateAction(UpdateAction updateAction)
|
||||
{
|
||||
DistributeInternal.NotifyUpdateAction((int)updateAction);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e80f1c986884b44879be715a6b8af353
|
||||
timeCreated: 1503941150
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Microsoft.AppCenter.Unity.Distribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Release available callback.
|
||||
/// </summary>
|
||||
public delegate bool ReleaseAvailableCallback(ReleaseDetails releaseDetails);
|
||||
|
||||
/// <summary>
|
||||
/// App will exit callback.
|
||||
/// </summary>
|
||||
public delegate void WillExitAppCallback();
|
||||
|
||||
/// <summary>
|
||||
/// No Release available callback.
|
||||
/// </summary>
|
||||
public delegate void NoReleaseAvailableCallback();
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f98458dc0e38d44ee97fb5245326b20d
|
||||
timeCreated: 1505175083
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,53 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AppCenter.Unity.Distribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Release details.
|
||||
/// </summary>
|
||||
public class ReleaseDetails
|
||||
{
|
||||
internal ReleaseDetails()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Release identifier.
|
||||
/// </summary>
|
||||
/// <value>Release identifier.</value>
|
||||
public int Id { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Build number or version code.
|
||||
/// </summary>
|
||||
/// <value>The version.</value>
|
||||
public string Version { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Human readable version.
|
||||
/// </summary>
|
||||
/// <value>The version.</value>
|
||||
public string ShortVersion { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Release notes.
|
||||
/// </summary>
|
||||
/// <value>The release notes.</value>
|
||||
public string ReleaseNotes { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Release notes URL.
|
||||
/// </summary>
|
||||
/// <value>The release notes URL.</value>
|
||||
public Uri ReleaseNotesUrl { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns <c>true</c> if this release update is mandatory, otherwise <c>false</c>.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if mandatory update; otherwise, <c>false</c>.</value>
|
||||
public bool MandatoryUpdate { get; internal set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f7a6695be4af4d6ba53b3faf384d4bc
|
||||
timeCreated: 1505175083
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,21 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Microsoft.AppCenter.Unity.Distribute
|
||||
{
|
||||
/// <summary>
|
||||
/// User update action.
|
||||
/// </summary>
|
||||
public enum UpdateAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Action to trigger the download of the release.
|
||||
/// </summary>
|
||||
Update,
|
||||
|
||||
/// <summary>
|
||||
/// Action to postpone optional updates for 1 day.
|
||||
/// </summary>
|
||||
Postpone
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b51f8b22ef03a4780a0d598af3edcd2a
|
||||
timeCreated: 1499463000
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Microsoft.AppCenter.Unity.Distribute
|
||||
{
|
||||
public enum UpdateTrack
|
||||
{
|
||||
/// <summary>
|
||||
/// Releases from the public group that don't require authentication.
|
||||
/// </summary>
|
||||
Public = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Releases from private groups that require authentication, also contain public releases.
|
||||
/// </summary>
|
||||
Private = 2
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5bfc9c7086d352f409ef43f1bbeddbd8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88b09d17fd0344c86853703d0a605b08
|
||||
folderAsset: yes
|
||||
timeCreated: 1499731881
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,57 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#if UNITY_WSA_10_0 && !UNITY_EDITOR
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.AppCenter.Unity.Distribute.Internal
|
||||
{
|
||||
class DistributeInternal
|
||||
{
|
||||
public static void PrepareEventHandlers()
|
||||
{
|
||||
}
|
||||
|
||||
public static void AddNativeType(List<Type> nativeTypes)
|
||||
{
|
||||
}
|
||||
|
||||
public static AppCenterTask SetEnabledAsync(bool isEnabled)
|
||||
{
|
||||
return AppCenterTask.FromCompleted();
|
||||
}
|
||||
|
||||
public static AppCenterTask<bool> IsEnabledAsync()
|
||||
{
|
||||
return AppCenterTask<bool>.FromCompleted(false);
|
||||
}
|
||||
|
||||
public static void SetInstallUrl(string installUrl)
|
||||
{
|
||||
}
|
||||
|
||||
public static void SetApiUrl(string apiUrl)
|
||||
{
|
||||
}
|
||||
|
||||
public static void NotifyUpdateAction(int updateAction)
|
||||
{
|
||||
}
|
||||
|
||||
public static void StartDistribute()
|
||||
{
|
||||
}
|
||||
|
||||
public static void CheckForUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
private class Distribute
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 660527a98fa0d4e59b7dbf405bdbe77c
|
||||
timeCreated: 1499731881
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9131bc23ceae442e591db0cb1b191a3c
|
||||
folderAsset: yes
|
||||
timeCreated: 1499463007
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,159 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using AOT;
|
||||
|
||||
namespace Microsoft.AppCenter.Unity.Distribute.Internal
|
||||
{
|
||||
class DistributeInternal
|
||||
{
|
||||
#region Distribute delegate
|
||||
#if ENABLE_IL2CPP
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
#endif
|
||||
delegate void WillExitAppDelegate();
|
||||
delegate void NoReleaseAvailableDelegate();
|
||||
delegate bool ReleaseAvailableDelegate(IntPtr details);
|
||||
|
||||
static WillExitAppDelegate willExitAppDel;
|
||||
static NoReleaseAvailableDelegate noReleaseDel;
|
||||
static ReleaseAvailableDelegate del;
|
||||
static IntPtr ptr;
|
||||
|
||||
[MonoPInvokeCallback(typeof(ReleaseAvailableDelegate))]
|
||||
static bool ReleaseAvailableFunc(IntPtr details)
|
||||
{
|
||||
if (Distribute.ReleaseAvailable == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var releaseDetails = ReleaseDetailsHelper.ReleaseDetailsConvert(details);
|
||||
return Distribute.ReleaseAvailable.Invoke(releaseDetails);
|
||||
}
|
||||
|
||||
[MonoPInvokeCallback(typeof(NoReleaseAvailableDelegate))]
|
||||
static void NoReleaseAvailableFunc()
|
||||
{
|
||||
Distribute.NoReleaseAvailable?.Invoke();
|
||||
}
|
||||
|
||||
[MonoPInvokeCallback(typeof(WillExitAppDelegate))]
|
||||
static void WillExitAppFunc()
|
||||
{
|
||||
Distribute.WillExitApp?.Invoke();
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static void PrepareEventHandlers()
|
||||
{
|
||||
AppCenterBehavior.InitializingServices += Initialize;
|
||||
AppCenterBehavior.Started += StartBehavior;
|
||||
}
|
||||
|
||||
private static void StartBehavior()
|
||||
{
|
||||
appcenter_unity_distribute_replay_release_available();
|
||||
}
|
||||
|
||||
private static void Initialize()
|
||||
{
|
||||
appcenter_unity_distribute_set_delegate();
|
||||
del = ReleaseAvailableFunc;
|
||||
willExitAppDel = WillExitAppFunc;
|
||||
noReleaseDel = NoReleaseAvailableFunc;
|
||||
appcenter_unity_distribute_set_release_available_impl(del);
|
||||
appcenter_unity_distribute_set_no_release_available_impl(noReleaseDel);
|
||||
appcenter_unity_distribute_set_will_exit_app_impl(willExitAppDel);
|
||||
}
|
||||
|
||||
public static void StartDistribute()
|
||||
{
|
||||
appcenter_unity_start_distribute();
|
||||
}
|
||||
|
||||
public static void AddNativeType(List<IntPtr> nativeTypes)
|
||||
{
|
||||
nativeTypes.Add(appcenter_unity_distribute_get_type());
|
||||
}
|
||||
|
||||
public static AppCenterTask SetEnabledAsync(bool isEnabled)
|
||||
{
|
||||
appcenter_unity_distribute_set_enabled(isEnabled);
|
||||
return AppCenterTask.FromCompleted();
|
||||
}
|
||||
|
||||
public static AppCenterTask<bool> IsEnabledAsync()
|
||||
{
|
||||
var isEnabled = appcenter_unity_distribute_is_enabled();
|
||||
return AppCenterTask<bool>.FromCompleted(isEnabled);
|
||||
}
|
||||
|
||||
public static void SetInstallUrl(string installUrl)
|
||||
{
|
||||
appcenter_unity_distribute_set_install_url(installUrl);
|
||||
}
|
||||
|
||||
public static void SetApiUrl(string apiUrl)
|
||||
{
|
||||
appcenter_unity_distribute_set_api_url(apiUrl);
|
||||
}
|
||||
|
||||
public static void NotifyUpdateAction(int updateAction)
|
||||
{
|
||||
appcenter_unity_distribute_notify_update_action(updateAction);
|
||||
}
|
||||
|
||||
public static void CheckForUpdate()
|
||||
{
|
||||
appcenter_unity_distribute_check_for_update();
|
||||
}
|
||||
|
||||
#region External
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern IntPtr appcenter_unity_distribute_get_type();
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void appcenter_unity_distribute_set_enabled(bool isEnabled);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern bool appcenter_unity_distribute_is_enabled();
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void appcenter_unity_distribute_set_install_url(string installUrl);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void appcenter_unity_distribute_set_api_url(string apiUrl);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void appcenter_unity_distribute_notify_update_action(int updateAction);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void appcenter_unity_distribute_set_release_available_impl(ReleaseAvailableDelegate functionPtr);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void appcenter_unity_distribute_set_will_exit_app_impl(WillExitAppDelegate functionPtr);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void appcenter_unity_distribute_set_no_release_available_impl(NoReleaseAvailableDelegate functionPtr);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void appcenter_unity_distribute_replay_release_available();
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void appcenter_unity_distribute_set_delegate();
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void appcenter_unity_distribute_check_for_update();
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void appcenter_unity_start_distribute();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f4a38be21ed54bc2906880c8e424da9
|
||||
timeCreated: 1499465694
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,56 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Microsoft.AppCenter.Unity.Distribute.Internal
|
||||
{
|
||||
class ReleaseDetailsHelper
|
||||
{
|
||||
public static ReleaseDetails ReleaseDetailsConvert(IntPtr details)
|
||||
{
|
||||
var id = appcenter_unity_release_details_get_id(details);
|
||||
var version = appcenter_unity_release_details_get_version(details);
|
||||
var shortVersion = appcenter_unity_release_details_get_short_version(details);
|
||||
var releaseNotes = appcenter_unity_release_details_get_release_notes(details);
|
||||
var mandatoryUpdate = appcenter_unity_release_details_get_mandatory_update(details);
|
||||
var urlString = appcenter_unity_release_details_get_url(details);
|
||||
var uri = new Uri(urlString);
|
||||
|
||||
return new ReleaseDetails
|
||||
{
|
||||
Id = id,
|
||||
Version = version,
|
||||
ShortVersion = shortVersion,
|
||||
ReleaseNotes = releaseNotes,
|
||||
MandatoryUpdate = mandatoryUpdate,
|
||||
ReleaseNotesUrl = uri
|
||||
};
|
||||
}
|
||||
|
||||
#region External
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern int appcenter_unity_release_details_get_id(IntPtr details);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern string appcenter_unity_release_details_get_version(IntPtr details);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern string appcenter_unity_release_details_get_short_version(IntPtr details);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern string appcenter_unity_release_details_get_release_notes(IntPtr details);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern bool appcenter_unity_release_details_get_mandatory_update(IntPtr details);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern string appcenter_unity_release_details_get_url(IntPtr details);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b004972b6e2d047bd9d10090df552752
|
||||
timeCreated: 1499467878
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user