Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
Release AppMetrica Unity Plugin 4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Aliaksei Nestsiarovich committed Dec 6, 2021
1 parent 2108705 commit 34759b4
Show file tree
Hide file tree
Showing 64 changed files with 2,353 additions and 50 deletions.
4 changes: 2 additions & 2 deletions AppMetrica.unitypackage
Git LFS file not shown
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ Documentation could be found at [AppMetrica official site][DOCUMENTATION].

## Changelog

### Version 4.0.0

* Updated native SDKs *(iOS 4.0.0, Android 4.0.0)*
* Remove InstalledAppCollecting from YandexAppMetricaConfig
* Added property RevenueAutoTrackingEnabled to YandexAppMetricaConfig for disable auto tracking revenue
* Added dependency from [Install Referrer Library](https://developer.android.com/google/play/installreferrer/library) v2.2

### Version 3.8.0

* Updated native SDKs *(iOS 3.16.0, Android 3.21.1)*
Expand Down
2 changes: 1 addition & 1 deletion YandexMetricaPluginSample/Assets/AppMetrica/AppMetrica.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

public class AppMetrica : MonoBehaviour
{
public const string VERSION = "3.8.0";
public const string VERSION = "4.0.0";

[SerializeField]
private string ApiKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private void UpdateConfiguration (YandexAppMetricaConfig config)

public abstract void ReportEvent (string message);

public abstract void ReportEvent (string message, Dictionary<string, object> parameters);
public abstract void ReportEvent (string message, IDictionary<string, object> parameters);

public abstract void ReportEvent (string message, string json);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System.IO;
using System.Collections;
#if UNITY_IOS
using UnityEditor.iOS.Xcode.Extensions;
using UnityEditor.iOS.Xcode;
#endif

Expand All @@ -22,6 +23,14 @@

public class PostprocessBuildPlayerAppMetrica
{
private const string FrameworksDir = "Assets/AppMetrica/Plugins/iOS";

private static readonly string[] AppMetricaFrameworks =
{
"YandexMobileMetrica.xcframework",
"YandexMobileMetricaCrashes.xcframework"
};

private static readonly string[] StrongFrameworks = {
#if APP_METRICA_ADD_IAD_FRAMEWORK
"iAd",
Expand Down Expand Up @@ -72,6 +81,16 @@ public static void OnPostprocessBuild (BuildTarget buildTarget, string path)
var target = project.TargetGuidByName ("Unity-iPhone");
#endif

var phaseGUID = project.GetFrameworksBuildPhaseByTarget(target);
foreach (var appMetricaFramework in AppMetricaFrameworks) {
var frameworkPath = FrameworksDir + '/' + appMetricaFramework;
var dstPath = "AppMetricaFrameworks/" + appMetricaFramework;
CopyAndReplaceDirectory (frameworkPath, Path.Combine (path, dstPath));
var fileGuid = project.AddFile (dstPath, "Frameworks/" + appMetricaFramework);
project.AddFileToBuild (target, fileGuid);
project.AddFileToBuildSection (target, phaseGUID, fileGuid);
}

foreach (var frameworkName in StrongFrameworks) {
project.AddFrameworkToProject (target, frameworkName + ".framework", false);
}
Expand All @@ -89,4 +108,22 @@ public static void OnPostprocessBuild (BuildTarget buildTarget, string path)
}
#endif
}

private static void CopyAndReplaceDirectory (string srcPath, string dstPath)
{
if (Directory.Exists (dstPath)) Directory.Delete (dstPath, true);
if (File.Exists (dstPath)) File.Delete (dstPath);

Directory.CreateDirectory (dstPath);

foreach (var file in Directory.GetFiles (srcPath)) {
if (!file.EndsWith (".meta")) {
File.Copy (file, Path.Combine (dstPath, Path.GetFileName (file)));
}
}

foreach (var dir in Directory.GetDirectories(srcPath)) {
CopyAndReplaceDirectory(dir, Path.Combine(dstPath, Path.GetFileName(dir)));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
* https://yandex.com/legal/appmetrica_sdk_agreement/
*/

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;

Expand Down Expand Up @@ -54,13 +52,13 @@ public interface IYandexAppMetrica

/// <summary>
/// <para>Reports the event.</para>
///
///
/// <para>Android: public static void reportEvent(final String eventName, final Map&lt;String, Object&gt; attributes)</para>
/// <para>iOS: +(void)reportEvent:(NSString *)message parameters:(NSDictionary *)params onFailure:(void (^)(NSError *))onFailure</para>
/// </summary>
/// <param name="message">Report message.</param>
/// <param name="parameters">Custom parameters.</param>
void ReportEvent (string message, Dictionary<string, object> parameters);
void ReportEvent (string message, IDictionary<string, object> parameters);

void ReportEvent (string message, string json);

Expand Down
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown

This file was deleted.

Git LFS file not shown
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ typedef void (*YMMRequestTrackingAuthorization)(YMMAction action, const int stat
void ymm_activateWithConfigurationJSON(char *configurationJSON);
bool ymm_isAppMetricaActivated();

void ymm_resumeSession();
void ymm_pauseSession();

void ymm_reportEvent(char *message);
void ymm_reportEventWithParameters(char *message, char *parameters);
void ymm_reportError(char *condition, char *stackTrace);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ BOOL ymm_isDictionaryOrNil(NSDictionary *dictionary)
if (configDictionary[@"AppForKids"] != nil) {
config.appForKids = [configDictionary[@"AppForKids"] boolValue];
}
if (configDictionary[@"UserProfileID"] != nil) {
config.userProfileID = (NSString *)configDictionary[@"UserProfileID"];
}
if (configDictionary[@"RevenueAutoTrackingEnabled"] != nil) {
config.revenueAutoTrackingEnabled = [configDictionary[@"RevenueAutoTrackingEnabled"] boolValue];
}

return config;
}
Expand All @@ -118,6 +124,16 @@ bool ymm_isAppMetricaActivated()
return g_ymm_isAppMetricaActivated;
}

void ymm_resumeSession()
{
[YMMYandexMetrica resumeSession];
}

void ymm_pauseSession()
{
[YMMYandexMetrica pauseSession];
}

void ymm_reportEvent(char *message)
{
NSString *messageString = ymm_stringFromCString(message);
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_armv7</string>
<key>LibraryPath</key>
<string>YandexMobileMetrica.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>armv7</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_i386_x86_64-simulator</string>
<key>LibraryPath</key>
<string>YandexMobileMetrica.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>i386</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (nonatomic, assign, readonly) BOOL logs;

/** Sets the ID of the user profile.
@warning The value can contain up to 200 characters.
*/
@property (nonatomic, copy, nullable, readonly) NSString *userProfileID;

/** Initialize configuration with specified Application key.
@param apiKey Application key that is issued during application registration in AppMetrica.
Expand Down Expand Up @@ -92,6 +98,12 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (nonatomic, assign) BOOL logs;

/** Sets the ID of the user profile.
@warning The value can contain up to 200 characters.
*/
@property (nonatomic, copy, nullable) NSString *userProfileID;

- (instancetype)init NS_UNAVAILABLE;

@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
#ifndef __YMM_VERSION_H__
#define __YMM_VERSION_H__

#define YMM_VERSION_MAJOR 3
#define YMM_VERSION_MINOR 16
#define YMM_VERSION_MAJOR 4
#define YMM_VERSION_MINOR 0
#define YMM_VERSION_PATCH 0

// This line is uncommented in pre-releases.
// #define YMM_VERSION_PRERELEASE_ID "rc.1"

#define YMM_BUILD_NUMBER 19973
#define YMM_BUILD_NUMBER 50832

#endif // __YMM_VERSION_H__
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,30 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (nonatomic, copy, nullable) YMMYandexMetricaPreloadInfo *preloadInfo;

/**
Enables/disables auto tracking of inapp purchases.
By default is enabled.
*/
@property (nonatomic, assign) BOOL revenueAutoTrackingEnabled;

/**
Enables/disables app open auto tracking.
By default is enabled.
Set this flag to YES to track URLs that open the app.
@note Auto tracking will only capture links that open the app. Those that are clicked on while
the app is open will be ignored. If you need to track them as well use manual reporting as described
[here](https://appmetrica.yandex.ru/docs/mobile-sdk-dg/concepts/ios-operations.html#deeplink-tracking).
*/
@property (nonatomic, assign) BOOL appOpenTrackingEnabled;

/** Sets the ID of the user profile.
@warning The value can contain up to 200 characters.
*/
@property (nonatomic, copy, nullable) NSString *userProfileID;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
framework module YandexMobileMetrica {
umbrella header "YandexMobileMetrica-umbrella.h"

export *
module * { export * }
}
Git LFS file not shown
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Version for iOS
* © 2012–2019 YANDEX
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://yandex.com/legal/appmetrica_sdk_agreement/
*/

#ifndef YMMCompletionBlocks_h
#define YMMCompletionBlocks_h

/** Identifiers callback block
@param appMetricaDeviceID Contains retrieved appMetricaDeviceID
Empty appMetricaDeviceID may be returned if server by any reason did not provide identifier.
@param error Error of NSURLErrorDomain. In a case of error appMetricaDeviceID param is nil.
*/
typedef void(^YMMAppMetricaDeviceIDRetrievingBlock)(NSString * _Nullable appMetricaDeviceID, NSError * _Nullable error);

#endif /* YMMCompletionBlocks_h */
Loading

0 comments on commit 34759b4

Please sign in to comment.