* version 0.1.3

* uncomment collectDeviceId usage on iOS

* Pause/Resume for Analytics and Transmission Target

* SetStorageSize method implemented

* Pause/Resume buttons

* SetStorageSize renamed to SetMaxStorageSize

* no toggle Paused
This commit is contained in:
Alexander Oreshko 2018-10-24 15:02:15 +03:00 коммит произвёл Max
Родитель 51fa521de5
Коммит 09d764c520
16 изменённых файлов: 84 добавлений и 9 удалений

Просмотреть файл

@ -50,10 +50,12 @@ namespace Microsoft.AppCenter.Unity.Analytics.Internal
public static void Pause()
{
appcenter_unity_analytics_pause();
}
public static void Resume()
{
appcenter_unity_analytics_resume();
}
#region External
@ -76,6 +78,11 @@ namespace Microsoft.AppCenter.Unity.Analytics.Internal
[DllImport("__Internal")]
private static extern IntPtr appcenter_unity_analytics_transmission_target_for_token(string transmissionTargetToken);
[DllImport("__Internal")]
private static extern void appcenter_unity_analytics_pause();
[DllImport("__Internal")]
private static extern void appcenter_unity_analytics_resume();
#endregion
}
}

Просмотреть файл

@ -47,10 +47,12 @@ namespace Microsoft.AppCenter.Unity.Analytics.Internal
public static void Pause(IntPtr transmissionTarget)
{
appcenter_unity_transmission_pause(transmissionTarget);
}
public static void Resume(IntPtr transmissionTarget)
{
appcenter_unity_transmission_resume(transmissionTarget);
}
#region External
@ -73,6 +75,11 @@ namespace Microsoft.AppCenter.Unity.Analytics.Internal
[DllImport("__Internal")]
private static extern IntPtr appcenter_unity_transmission_get_property_configurator(IntPtr transmissionTarget);
[DllImport("__Internal")]
private static extern void appcenter_unity_transmission_pause(IntPtr transmissionTarget);
[DllImport("__Internal")]
private static extern void appcenter_unity_transmission_resume(IntPtr transmissionTarget);
#endregion
}
}

Просмотреть файл

@ -150,6 +150,10 @@ namespace Microsoft.AppCenter.Unity.Internal
}
return array;
}
public static void SetStorageSize(long size, AppCenter.SetMaxStorageSizeCompletionHandler handler)
{
}
}
}
#endif

Просмотреть файл

@ -100,6 +100,10 @@ namespace Microsoft.AppCenter.Unity.Internal
{
return services;
}
public static void SetStorageSize(long size, AppCenter.SetMaxStorageSizeCompletionHandler handler)
{
}
}
}
#endif

Просмотреть файл

@ -7,6 +7,8 @@ using System.Collections;
using System.Reflection;
using Microsoft.AppCenter.Unity.Internal;
using UnityEngine;
using System.Runtime.InteropServices;
namespace Microsoft.AppCenter.Unity
{
@ -177,6 +179,11 @@ namespace Microsoft.AppCenter.Unity
return platformSecret;
}
#if ENABLE_IL2CPP
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
public delegate void SetMaxStorageSizeCompletionHandler(bool result);
private static string GetPlatformIdentifier()
{
#if UNITY_IOS

Просмотреть файл

@ -183,6 +183,10 @@ namespace Microsoft.AppCenter.Unity.Internal
return nativeTypes;
}
public static void SetStorageSize(long size, AppCenter.SetMaxStorageSizeCompletionHandler handler)
{
}
private static void Prepare()
{
lock (_lockObject)

Просмотреть файл

@ -5,6 +5,7 @@
#if UNITY_IOS && !UNITY_EDITOR
using System;
using System.Runtime.InteropServices;
using UnityEngine;
namespace Microsoft.AppCenter.Unity.Internal
{
@ -102,6 +103,10 @@ namespace Microsoft.AppCenter.Unity.Internal
return classPointers;
}
public static void SetStorageSize(long size, AppCenter.SetMaxStorageSizeCompletionHandler handler)
{
appcenter_unity_set_storage_size(size, handler);
}
#region External
[DllImport("__Internal")]
@ -148,6 +153,8 @@ namespace Microsoft.AppCenter.Unity.Internal
string liveUpdateDeploymentKey,
string liveUpdatePackageHash);
[DllImport("__Internal")]
private static extern void appcenter_unity_set_storage_size(long size, AppCenter.SetStorageSizeCompletionHandler handler);
#endregion
}
}

Просмотреть файл

@ -9,3 +9,5 @@ extern "C" void appcenter_unity_analytics_track_event_with_properties(char* even
extern "C" void appcenter_unity_analytics_set_enabled(bool isEnabled);
extern "C" bool appcenter_unity_analytics_is_enabled();
extern "C" MSAnalyticsTransmissionTarget *appcenter_unity_analytics_transmission_target_for_token(char* transmissionTargetToken);
extern "C" void appcenter_unity_analytics_pause();
extern "C" void appcenter_unity_analytics_resume();

Просмотреть файл

@ -38,3 +38,14 @@ bool appcenter_unity_analytics_is_enabled()
MSAnalyticsTransmissionTarget *appcenter_unity_analytics_transmission_target_for_token(char* transmissionTargetToken) {
return [MSAnalytics transmissionTargetForToken: [NSString stringWithUTF8String:transmissionTargetToken]];
}
void appcenter_unity_analytics_pause()
{
[MSAnalytics pause];
}
void appcenter_unity_analytics_resume()
{
[MSAnalytics resume];
}

Просмотреть файл

@ -12,4 +12,8 @@ extern "C" void appcenter_unity_transmission_target_set_enabled(MSAnalyticsTrans
extern "C" BOOL appcenter_unity_transmission_target_is_enabled(MSAnalyticsTransmissionTarget *transmission);
extern "C" void appcenter_unity_transmission_target_track_event_with_props(MSAnalyticsTransmissionTarget *transmission, char* eventName, char** keys, char** values, int count);
extern "C" MSAnalyticsTransmissionTarget *appcenter_unity_transmission_transmission_target_for_token(MSAnalyticsTransmissionTarget *transmissionParent, char* transmissionTargetToken);
extern "C" MSPropertyConfigurator *appcenter_unity_transmission_get_property_configurator(MSAnalyticsTransmissionTarget *transmission);
extern "C" MSPropertyConfigurator *appcenter_unity_transmission_get_property_configurator(MSAnalyticsTransmissionTarget *transmission);
extern "C" void appcenter_unity_transmission_pause(MSAnalyticsTransmissionTarget *transmission);
extern "C" void appcenter_unity_transmission_resume(MSAnalyticsTransmissionTarget *transmission);

Просмотреть файл

@ -7,27 +7,37 @@
#import "AppCenterAnalytics/MSPropertyConfigurator.h"
#import "../Core/Utility/NSStringDictionaryHelper.h"
extern "C" void appcenter_unity_transmission_target_track_event(MSAnalyticsTransmissionTarget *transmission, char* eventName) {
void appcenter_unity_transmission_target_track_event(MSAnalyticsTransmissionTarget *transmission, char* eventName) {
[transmission trackEvent:[NSString stringWithUTF8String:eventName]];
}
extern "C" void appcenter_unity_transmission_target_track_event_with_props(MSAnalyticsTransmissionTarget *transmission, char* eventName, char** keys, char** values, int count) {
void appcenter_unity_transmission_target_track_event_with_props(MSAnalyticsTransmissionTarget *transmission, char* eventName, char** keys, char** values, int count) {
NSDictionary<NSString*, NSString*> *properties = appcenter_unity_create_ns_string_dictionary(keys, values, count); 
[transmission trackEvent:[NSString stringWithUTF8String:eventName] withProperties: properties];
}
extern "C" void appcenter_unity_transmission_target_set_enabled(MSAnalyticsTransmissionTarget *transmission, BOOL enabled) {
void appcenter_unity_transmission_target_set_enabled(MSAnalyticsTransmissionTarget *transmission, BOOL enabled) {
[transmission setEnabled: enabled];
}
extern "C" BOOL appcenter_unity_transmission_target_is_enabled(MSAnalyticsTransmissionTarget *transmission) {
BOOL appcenter_unity_transmission_target_is_enabled(MSAnalyticsTransmissionTarget *transmission) {
return [transmission isEnabled];
}
extern "C" MSAnalyticsTransmissionTarget *appcenter_unity_transmission_transmission_target_for_token(MSAnalyticsTransmissionTarget *transmissionParent, char* transmissionTargetToken) {
MSAnalyticsTransmissionTarget *appcenter_unity_transmission_transmission_target_for_token(MSAnalyticsTransmissionTarget *transmissionParent, char* transmissionTargetToken) {
return [transmissionParent transmissionTargetForToken: [NSString stringWithUTF8String:transmissionTargetToken]];
}
extern "C" MSPropertyConfigurator *appcenter_unity_transmission_get_property_configurator(MSAnalyticsTransmissionTarget *transmission) {
MSPropertyConfigurator *appcenter_unity_transmission_get_property_configurator(MSAnalyticsTransmissionTarget *transmission) {
return [transmission propertyConfigurator];
}
void appcenter_unity_transmission_pause(MSAnalyticsTransmissionTarget *transmission)
{
[transmission pause];
}
void appcenter_unity_transmission_resume(MSAnalyticsTransmissionTarget *transmission)
{
[transmission resume];
}

Просмотреть файл

@ -22,3 +22,4 @@ extern "C" void appcenter_unity_set_wrapper_sdk(const char* wrapperSdkVersion,
const char* liveUpdateReleaseLabel,
const char* liveUpdateDeploymentKey,
const char* liveUpdatePackageHash);
extern "C" void appcenter_unity_set_storage_size(long size, void(* completionHandler)(bool));

Просмотреть файл

@ -92,3 +92,10 @@ void appcenter_unity_set_wrapper_sdk(const char* wrapperSdkVersion,
liveUpdatePackageHash:appcenter_unity_cstr_to_ns_string(liveUpdatePackageHash)];
[MSAppCenter setWrapperSdk:wrapperSdk];
}
void appcenter_unity_set_storage_size(long size, void(* completionHandler)(bool))
{
[MSAppCenter setMaxStorageSize:size completionHandler:^void(bool result){
completionHandler(result);
}];
}

Просмотреть файл

@ -72,4 +72,4 @@ public class PuppetAnalytics : MonoBehaviour
}
return properties.ToDictionary(i => i.Key.text, i => i.Value.text);
}
}
}

0
Assets/Puppet/PuppetScene.unity Normal file → Executable file
Просмотреть файл

Просмотреть файл

@ -6,4 +6,4 @@ App Center SDK for Unity now uses the latest native SDKs:
* App Center SDK for .NET version 1.10.0
**iOS**
* **[Fix]** Add missing network request error logging.
* **[Fix]** Add missing network request error logging.