* add methods to start native sdk from .net code

* start from AppCenterBehavior if needed

* support start native sdk's from AppCenterBehavior

* fix undeclared method error

* Fixes for StartFromLibrary

* Fix

* Fix access modifier

* Fix restoring overridden values
This commit is contained in:
Anna Kocheshkova 2018-10-09 19:38:46 +03:00 коммит произвёл Max
Родитель 0b1fc81b5e
Коммит 4fc1061d3e
3 изменённых файлов: 48 добавлений и 3 удалений

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

@ -15,17 +15,38 @@ namespace Microsoft.AppCenter.Unity.Analytics.Internal
{ {
public static void SetAppName(IntPtr propertyConfigurator, string appName) public static void SetAppName(IntPtr propertyConfigurator, string appName)
{ {
appcenter_unity_property_configurator_set_app_name(propertyConfigurator, appName); if (appName == null)
{
appcenter_unity_property_configurator_clear_app_name(propertyConfigurator);
}
else
{
appcenter_unity_property_configurator_set_app_name(propertyConfigurator, appName);
}
} }
public static void SetAppVersion(IntPtr propertyConfigurator, string appVersion) public static void SetAppVersion(IntPtr propertyConfigurator, string appVersion)
{ {
appcenter_unity_property_configurator_set_app_version(propertyConfigurator, appVersion); if (appVersion == null)
{
appcenter_unity_property_configurator_clear_app_version(propertyConfigurator);
}
else
{
appcenter_unity_property_configurator_set_app_version(propertyConfigurator, appVersion);
}
} }
public static void SetAppLocale(IntPtr propertyConfigurator, string appLocale) public static void SetAppLocale(IntPtr propertyConfigurator, string appLocale)
{ {
appcenter_unity_property_configurator_set_app_locale(propertyConfigurator, appLocale); if (appLocale == null)
{
appcenter_unity_property_configurator_clear_app_locale(propertyConfigurator);
}
else
{
appcenter_unity_property_configurator_set_app_locale(propertyConfigurator, appLocale);
}
} }
public static void SetEventProperty(IntPtr propertyConfigurator, string key, string value) public static void SetEventProperty(IntPtr propertyConfigurator, string key, string value)
@ -54,6 +75,15 @@ namespace Microsoft.AppCenter.Unity.Analytics.Internal
[DllImport("__Internal")] [DllImport("__Internal")]
private static extern void appcenter_unity_property_configurator_set_app_locale(IntPtr propertyConfigurator, string appLocale); private static extern void appcenter_unity_property_configurator_set_app_locale(IntPtr propertyConfigurator, string appLocale);
[DllImport("__Internal")]
private static extern void appcenter_unity_property_configurator_clear_app_name(IntPtr propertyConfigurator);
[DllImport("__Internal")]
private static extern void appcenter_unity_property_configurator_clear_app_version(IntPtr propertyConfigurator);
[DllImport("__Internal")]
private static extern void appcenter_unity_property_configurator_clear_app_locale(IntPtr propertyConfigurator);
[DllImport("__Internal")] [DllImport("__Internal")]
private static extern void appcenter_unity_property_configurator_set_event_property(IntPtr propertyConfigurator, string key, string value); private static extern void appcenter_unity_property_configurator_set_event_property(IntPtr propertyConfigurator, string key, string value);

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

@ -7,6 +7,9 @@
extern "C" void appcenter_unity_property_configurator_set_app_name(MSPropertyConfigurator *configurator, char* appName); extern "C" void appcenter_unity_property_configurator_set_app_name(MSPropertyConfigurator *configurator, char* appName);
extern "C" void appcenter_unity_property_configurator_set_app_version(MSPropertyConfigurator *configurator, char* appVersion); extern "C" void appcenter_unity_property_configurator_set_app_version(MSPropertyConfigurator *configurator, char* appVersion);
extern "C" void appcenter_unity_property_configurator_set_app_locale(MSPropertyConfigurator *configurator, char* appLocale); extern "C" void appcenter_unity_property_configurator_set_app_locale(MSPropertyConfigurator *configurator, char* appLocale);
extern "C" void appcenter_unity_property_configurator_clear_app_name(MSPropertyConfigurator *configurator);
extern "C" void appcenter_unity_property_configurator_clear_app_version(MSPropertyConfigurator *configurator);
extern "C" void appcenter_unity_property_configurator_clear_app_locale(MSPropertyConfigurator *configurator);
extern "C" void appcenter_unity_property_configurator_collect_device_id(MSPropertyConfigurator *configurator); extern "C" void appcenter_unity_property_configurator_collect_device_id(MSPropertyConfigurator *configurator);
extern "C" void appcenter_unity_property_configurator_set_event_property(MSPropertyConfigurator *configurator, char* key, char* value); extern "C" void appcenter_unity_property_configurator_set_event_property(MSPropertyConfigurator *configurator, char* key, char* value);
extern "C" void appcenter_unity_property_configurator_remove_event_property(MSPropertyConfigurator *configurator, char* key); extern "C" void appcenter_unity_property_configurator_remove_event_property(MSPropertyConfigurator *configurator, char* key);

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

@ -18,6 +18,18 @@ extern "C" void appcenter_unity_property_configurator_set_app_locale(MSPropertyC
return [configurator setAppLocale: [NSString stringWithUTF8String:appLocale]]; return [configurator setAppLocale: [NSString stringWithUTF8String:appLocale]];
} }
extern "C" void appcenter_unity_property_configurator_clear_app_name(MSPropertyConfigurator *configurator) {
return [configurator setAppName: nil];
}
extern "C" void appcenter_unity_property_configurator_clear_app_version(MSPropertyConfigurator *configurator) {
return [configurator setAppVersion: nil];
}
extern "C" void appcenter_unity_property_configurator_clear_app_locale(MSPropertyConfigurator *configurator) {
return [configurator setAppLocale: nil];
}
extern "C" void appcenter_unity_property_configurator_collect_device_id(MSPropertyConfigurator *configurator) { extern "C" void appcenter_unity_property_configurator_collect_device_id(MSPropertyConfigurator *configurator) {
// [configurator collectDeviceId]; // [configurator collectDeviceId];
// Will be uncommented after the release. // Will be uncommented after the release.