app center;增加發送ping的秒

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

No files matched your search

@@ -0,0 +1,200 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_IOS && !UNITY_EDITOR
using AOT;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using UnityEngine;
namespace Microsoft.AppCenter.Unity.Internal
{
class AppCenterInternal
{
public static void SetLogLevel(int logLevel)
{
appcenter_unity_set_log_level(logLevel);
}
public static void SetUserId(string userId)
{
appcenter_unity_set_user_id(userId);
}
public static int GetLogLevel()
{
return appcenter_unity_get_log_level();
}
public static string GetSdkVersion()
{
return appcenter_unity_get_sdk_version();
}
public static bool IsConfigured()
{
return appcenter_unity_is_configured();
}
public static void SetLogUrl(string logUrl)
{
appcenter_unity_set_log_url(logUrl);
}
public static void SetNetworkRequestsAllowed(bool isAllowed)
{
appcenter_unity_set_network_requests_allowed(isAllowed);
}
public static bool IsNetworkRequestsAllowed()
{
return appcenter_unity_is_network_requests_allowed();
}
public static AppCenterTask SetEnabledAsync(bool isEnabled)
{
appcenter_unity_set_enabled(isEnabled);
return AppCenterTask.FromCompleted();
}
public static AppCenterTask<bool> IsEnabledAsync()
{
var isEnabled = appcenter_unity_is_enabled();
return AppCenterTask<bool>.FromCompleted(isEnabled);
}
public static AppCenterTask<string> GetInstallIdAsync()
{
var installId = appcenter_unity_get_install_id();
return AppCenterTask<string>.FromCompleted(installId);
}
public static void SetCustomProperties(IntPtr properties)
{
appcenter_unity_set_custom_properties(properties);
}
public static void SetWrapperSdk(string wrapperSdkVersion,
string wrapperSdkName,
string wrapperRuntimeVersion,
string liveUpdateReleaseLabel,
string liveUpdateDeploymentKey,
string liveUpdatePackageHash)
{
appcenter_unity_set_wrapper_sdk(wrapperSdkVersion,
wrapperSdkName,
wrapperRuntimeVersion,
liveUpdateReleaseLabel,
liveUpdateDeploymentKey,
liveUpdatePackageHash);
}
public static void Start(string appSecret, Type[] services)
{
var nativeServiceTypes = ServicesToNativeTypes(services);
appcenter_unity_start(appSecret, nativeServiceTypes, nativeServiceTypes.Length);
}
public static void Start(Type[] services)
{
var nativeServiceTypes = ServicesToNativeTypes(services);
appcenter_unity_start_no_secret(nativeServiceTypes, nativeServiceTypes.Length);
}
public static void Start(Type service)
{
}
public static void StartFromLibrary(IntPtr[] services)
{
appcenter_unity_start_from_library(services, services.Length);
}
public static IntPtr[] ServicesToNativeTypes(Type[] services)
{
var nativeTypes = new List<IntPtr>();
foreach (var serviceType in services)
{
serviceType.GetMethod("AddNativeType").Invoke(null, new object[] { nativeTypes });
}
return nativeTypes.ToArray();
}
public static void SetMaxStorageSize(long size)
{
appcenter_unity_set_storage_size(size, SetStorageSizeCompletionHandler);
}
[MonoPInvokeCallback(typeof(AppCenter.SetMaxStorageSizeCompletionHandler))]
private static void SetStorageSizeCompletionHandler(bool result)
{
if (!result)
{
Debug.Log("Failed to set maximum storage size");
}
}
#region External
[DllImport("__Internal")]
private static extern void appcenter_unity_set_log_level(int logLevel);
[DllImport("__Internal")]
private static extern void appcenter_unity_set_user_id(string userId);
[DllImport("__Internal")]
private static extern int appcenter_unity_get_log_level();
[DllImport("__Internal")]
private static extern string appcenter_unity_get_sdk_version();
[DllImport("__Internal")]
private static extern bool appcenter_unity_is_configured();
[DllImport("__Internal")]
private static extern void appcenter_unity_set_log_url(string logUrl);
[DllImport("__Internal")]
private static extern void appcenter_unity_set_enabled(bool isEnabled);
[DllImport("__Internal")]
private static extern void appcenter_unity_set_network_requests_allowed(bool isAllowed);
[DllImport("__Internal")]
private static extern bool appcenter_unity_is_network_requests_allowed();
[DllImport("__Internal")]
private static extern bool appcenter_unity_is_enabled();
[DllImport("__Internal")]
private static extern string appcenter_unity_get_install_id();
[DllImport("__Internal")]
private static extern void appcenter_unity_start(string appSecret, IntPtr[] classes, int count);
[DllImport("__Internal")]
private static extern void appcenter_unity_start_no_secret(IntPtr[] classes, int count);
[DllImport("__Internal")]
private static extern void appcenter_unity_start_from_library(IntPtr[] classes, int count);
[DllImport("__Internal")]
private static extern void appcenter_unity_set_custom_properties(IntPtr properties);
[DllImport("__Internal")]
private static extern void appcenter_unity_set_wrapper_sdk(string wrapperSdkVersion,
string wrapperSdkName,
string wrapperRuntimeVersion,
string liveUpdateReleaseLabel,
string liveUpdateDeploymentKey,
string liveUpdatePackageHash);
[DllImport("__Internal")]
private static extern void appcenter_unity_set_storage_size(long size, AppCenter.SetMaxStorageSizeCompletionHandler handler);
#endregion
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f8cd42a72e249df42b1d2447dc9333b9
timeCreated: 1497372965
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,18 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_IOS && !UNITY_EDITOR
using UnityEngine;
namespace Microsoft.AppCenter.Unity
{
public partial class AppCenterTask
{
internal void SetResult()
{
CompletionAction();
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 0b6acf881c8f345de98d17cffa208d8e
timeCreated: 1501280010
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,66 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_IOS && !UNITY_EDITOR
using System;
using System.Collections;
using System.Threading;
using UnityEngine;
namespace Microsoft.AppCenter.Unity
{
public partial class AppCenterTask<TResult>
{
private ManualResetEvent _completionEvent = new ManualResetEvent(false);
private TResult _result;
private Exception _exception;
public TResult Result
{
get
{
_completionEvent.WaitOne();
if (_exception == null)
{
return _result;
}
else
{
throw _exception;
}
}
}
public Exception Exception
{
get
{
return _exception;
}
}
internal void SetResult(TResult result)
{
lock (_lockObject)
{
ThrowIfCompleted();
_result = result;
_completionEvent.Set();
CompletionAction();
}
}
internal void SetException(Exception exception)
{
lock (_lockObject)
{
ThrowIfCompleted();
_exception = exception;
_completionEvent.Set();
CompletionAction();
}
}
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c4991171420d3459abbefd760cfba51e
timeCreated: 1501280010
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,81 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_IOS && !UNITY_EDITOR
using System;
using System.Runtime.InteropServices;
using Microsoft.AppCenter.Unity.Internal.Utility;
namespace Microsoft.AppCenter.Unity.Internal
{
class CustomPropertiesInternal
{
public static IntPtr Create()
{
return appcenter_unity_custom_properties_create();
}
public static void SetString(IntPtr properties, string key, string val)
{
appcenter_unity_custom_properties_set_string(properties, key, val);
}
public static void SetNumber(IntPtr properties, string key, int val)
{
appcenter_unity_custom_properties_set_number(properties, key, NSNumberHelper.Convert(val));
}
public static void SetNumber(IntPtr properties, string key, long val)
{
appcenter_unity_custom_properties_set_number(properties, key, NSNumberHelper.Convert(val));
}
public static void SetNumber(IntPtr properties, string key, float val)
{
appcenter_unity_custom_properties_set_number(properties, key, NSNumberHelper.Convert(val));
}
public static void SetNumber(IntPtr properties, string key, double val)
{
appcenter_unity_custom_properties_set_number(properties, key, NSNumberHelper.Convert(val));
}
public static void SetBool(IntPtr properties, string key, bool val)
{
appcenter_unity_custom_properties_set_bool(properties, key, val);
}
public static void SetDate(IntPtr properties, string key, DateTime val)
{
appcenter_unity_custom_properties_set_date(properties, key, NSDateHelper.DateTimeConvert(val));
}
public static void Clear(IntPtr properties, string key)
{
appcenter_unity_custom_properties_clear(properties, key);
}
#region External
[DllImport("__Internal")]
private static extern IntPtr appcenter_unity_custom_properties_create();
[DllImport("__Internal")]
private static extern void appcenter_unity_custom_properties_set_string(IntPtr properties, string key, string val);
[DllImport("__Internal")]
private static extern void appcenter_unity_custom_properties_set_number(IntPtr properties, string key, IntPtr val);
[DllImport("__Internal")]
private static extern void appcenter_unity_custom_properties_set_bool(IntPtr properties, string key, bool val);
[DllImport("__Internal")]
private static extern void appcenter_unity_custom_properties_set_date(IntPtr properties, string key, IntPtr val);
[DllImport("__Internal")]
private static extern void appcenter_unity_custom_properties_clear(IntPtr properties, string key);
#endregion
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: dd933e7104204430682354c11c40d2f2
timeCreated: 1498515938
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: