Skip to content

Commit

Permalink
Merge pull request #141 from adjust/v4170
Browse files Browse the repository at this point in the history
Version 4.17.0
  • Loading branch information
uerceg authored Dec 12, 2018
2 parents a16ce54 + 17856a5 commit f1b68fe
Show file tree
Hide file tree
Showing 61 changed files with 808 additions and 246 deletions.
16 changes: 16 additions & 0 deletions Assets/Adjust/Adjust.cs
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,22 @@ public static string getIdfa()
#endif
}

public static string getSdkVersion()
{
if (IsEditor()) { return string.Empty; }

#if UNITY_IOS
return AdjustiOS.GetSdkVersion();
#elif UNITY_ANDROID
return AdjustAndroid.GetSdkVersion();
#elif (UNITY_WSA || UNITY_WP8)
return AdjustWindows.GetSdkVersion();
#else
Debug.Log(errorMsgPlatform);
return string.Empty;
#endif
}

[Obsolete("This method is intended for testing purposes only. Do not use it.")]
public static void setReferrer(string referrer)
{
Expand Down
8 changes: 7 additions & 1 deletion Assets/Adjust/Android/AdjustAndroid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace com.adjust.sdk
#if UNITY_ANDROID
public class AdjustAndroid
{
private const string sdkPrefix = "unity4.15.0";
private const string sdkPrefix = "unity4.17.0";
private static bool launchDeferredDeeplink = true;
private static AndroidJavaClass ajcAdjust = new AndroidJavaClass("com.adjust.sdk.Adjust");
private static AndroidJavaObject ajoCurrentActivity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
Expand Down Expand Up @@ -377,6 +377,12 @@ public static string GetAmazonAdId()
return ajcAdjust.CallStatic<string>("getAmazonAdId", ajoCurrentActivity);
}

public static string GetSdkVersion()
{
string nativeSdkVersion = ajcAdjust.CallStatic<string>("getSdkVersion");
return sdkPrefix + "@" + nativeSdkVersion;
}

// Used for testing only.
public static void SetTestOptions(Dictionary<string, string> testOptions)
{
Expand Down
Binary file added Assets/Adjust/Android/Test/adjust-test.jar
Binary file not shown.
29 changes: 29 additions & 0 deletions Assets/Adjust/Android/Test/adjust-test.jar.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed Assets/Adjust/Android/Test/adjust-testing.jar
Binary file not shown.
33 changes: 0 additions & 33 deletions Assets/Adjust/Android/Test/adjust-testing.jar.meta

This file was deleted.

Binary file modified Assets/Adjust/Android/adjust-android.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion Assets/Adjust/Test/CommandListenerAndroid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class CommandListenerAndroid : AndroidJavaProxy
private static CommandExecutor _commandExecutor;
#endif

public CommandListenerAndroid(CommandExecutor commandExecutor) : base("com.adjust.testlibrary.ICommandRawJsonListener")
public CommandListenerAndroid(CommandExecutor commandExecutor) : base("com.adjust.test.ICommandRawJsonListener")
{
#if UNITY_ANDROID
_commandExecutor = commandExecutor;
Expand Down
37 changes: 15 additions & 22 deletions Assets/Adjust/Test/TestApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,61 +10,54 @@ public class TestApp : MonoBehaviour
public static readonly string TAG = "[TestApp]";

#if (UNITY_WSA || UNITY_WP8)
public const string CLIENT_SDK = "[email protected]";
private const string PORT = ":8080";
private const string PROTOCOL = "http://";
private const string BASE_URL = PROTOCOL + "localhost" + PORT; // Windows simulator
private const string BASE_URL = PROTOCOL + "localhost" + PORT;
private const string GDPR_URL = PROTOCOL + "localhost" + PORT;
#elif UNITY_ANDROID
public const string CLIENT_SDK = "[email protected]";
private const string PORT = ":8443";
private const string PROTOCOL = "https://";
private const string BASE_URL = PROTOCOL + "10.0.2.2" + PORT; // Android simulator
private const string BASE_URL = PROTOCOL + "192.168.8.197" + PORT;
private const string GDPR_URL = PROTOCOL + "192.168.8.197" + PORT;
#elif UNITY_IOS
public const string CLIENT_SDK = "[email protected]";
private const string PORT = ":8080";
private const string PROTOCOL = "http://";
private const string BASE_URL = PROTOCOL + "127.0.0.1" + PORT; // iOS simulator
// private const string BASE_URL = PROTOCOL + "192.168.8.141" + PORT; // Over WiFi

private const string BASE_URL = PROTOCOL + "192.168.8.197" + PORT;
private const string GDPR_URL = PROTOCOL + "192.168.8.197" + PORT;
private TestLibraryiOS _testLibraryiOS;
#else
public const string CLIENT_SDK = null;
#endif

void OnGUI()
{
if (GUI.Button(new Rect(0, Screen.height * 0 / 2, Screen.width, Screen.height / 2), "Start test"))
{
StartTestSession ();
StartTestSession();
}
}

private void StartTestSession()
{
ITestLibrary testLibrary = GetPlatformSpecificTestLibrary ();

ITestLibrary testLibrary = GetPlatformSpecificTestLibrary();
#if UNITY_IOS
_testLibraryiOS = testLibrary as TestLibraryiOS;
#endif
// Set specific tests to run.
//testLibrary.AddTest("current/eventBuffering/Test_EventBuffering_sensitive_packets");
//testLibrary.AddTest("current/gdpr/Test_GdprForgetMe_after_install");
//testLibrary.AddTestDirectory ("current/deeplink-deferred");
// testLibrary.AddTest("current/eventBuffering/Test_EventBuffering_sensitive_packets");
// testLibrary.AddTest("current/gdpr/Test_GdprForgetMe_after_install");
// testLibrary.AddTestDirectory ("current/deeplink-deferred");

Log("Starting test session...");
Log("Starting test session.");
testLibrary.StartTestSession();
}

private ITestLibrary GetPlatformSpecificTestLibrary()
{
// gdpr url on sdk_test_server is the same as base url
string gdprUrl = BASE_URL;
#if UNITY_IOS
return new TestLibraryiOS(BASE_URL, gdprUrl);
return new TestLibraryiOS(BASE_URL, GDPR_URL);
#elif UNITY_ANDROID
return new TestLibraryAndroid(BASE_URL, gdprUrl);
return new TestLibraryAndroid(BASE_URL, GDPR_URL);
#elif (UNITY_WSA || UNITY_WP8)
return new TestLibraryWindows(BASE_URL, gdprUrl);
return new TestLibraryWindows(BASE_URL, GDPR_URL);
#else
Debug.Log("Cannot run integration tests (Error in TestApp.GetPlatformSpecificTestLibrary(...)). None of the supported platforms selected.");
return null;
Expand Down
4 changes: 2 additions & 2 deletions Assets/Adjust/Test/TestLibraryAndroid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ public TestLibraryAndroid(string baseUrl, string gdprUrl)
CommandExecutor commandExecutor = new CommandExecutor(this, baseUrl, gdprUrl);
onCommandReceivedListener = new CommandListenerAndroid(commandExecutor);
ajoTestLibrary = new AndroidJavaObject(
"com.adjust.testlibrary.TestLibrary",
"com.adjust.test.TestLibrary",
baseUrl,
onCommandReceivedListener);
}

public void StartTestSession()
{
ajoTestLibrary.Call("startTestSession", TestApp.CLIENT_SDK);
ajoTestLibrary.Call("startTestSession", Adjust.getSdkVersion());
}

public void AddInfoToSend(string key, string paramValue)
Expand Down
2 changes: 1 addition & 1 deletion Assets/Adjust/Test/TestLibraryWindows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public TestLibraryWindows(string baseUrl, string gdprUrl)
public void StartTestSession()
{
TestApp.Log("TestLibrary -> StartTestSession()");
_testLibraryInterface.StartTestSession(TestApp.CLIENT_SDK);
_testLibraryInterface.StartTestSession(Adjust.getSdkVersion());
}

public void AddInfoToSend(string key, string paramValue)
Expand Down
2 changes: 1 addition & 1 deletion Assets/Adjust/Test/TestLibraryiOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public TestLibraryiOS(string baseUrl, string gdprUrl)
public void StartTestSession()
{
TestApp.Log("TestLibrary -> StartTestSession()");
TestLibraryBridgeiOS.StartTestSession(TestApp.CLIENT_SDK);
TestLibraryBridgeiOS.StartTestSession(Adjust.getSdkVersion());
}

public void AddInfoToSend(string key, string paramValue)
Expand Down
7 changes: 6 additions & 1 deletion Assets/Adjust/Windows/AdjustWindows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace com.adjust.sdk
{
public class AdjustWindows
{
private const string sdkPrefix = "unity4.15.0";
private const string sdkPrefix = "unity4.17.0";
private static bool appLaunched = false;

public static void Start(AdjustConfig adjustConfig)
Expand Down Expand Up @@ -230,6 +230,11 @@ public static string GetAdid()
return AdjustWinInterface.GetAdid();
}

public static string GetSdkVersion()
{
return sdkPrefix + "@" + AdjustWinInterface.GetSdkVersion();
}

public static AdjustAttribution GetAttribution()
{
var attributionMap = AdjustWinInterface.GetAttribution();
Expand Down
Binary file modified Assets/Adjust/Windows/Stubs/TestLibraryInterface.dll
Binary file not shown.
Binary file modified Assets/Adjust/Windows/Stubs/Win10Interface.dll
Binary file not shown.
Binary file modified Assets/Adjust/Windows/Stubs/Win81Interface.dll
Binary file not shown.
Binary file modified Assets/Adjust/Windows/Stubs/WinWsInterface.dll
Binary file not shown.
Binary file modified Assets/Adjust/Windows/Test/TestLibrary.dll
Binary file not shown.
Binary file modified Assets/Adjust/Windows/Test/TestLibraryInterface.dll
Binary file not shown.
Binary file modified Assets/Adjust/Windows/W81/AdjustWP81.dll
Binary file not shown.
Binary file modified Assets/Adjust/Windows/W81/Win81Interface.dll
Binary file not shown.
Binary file modified Assets/Adjust/Windows/WS/AdjustWS.dll
Binary file not shown.
Binary file modified Assets/Adjust/Windows/WS/WinWsInterface.dll
Binary file not shown.
Binary file modified Assets/Adjust/Windows/WU10/AdjustUAP10.dll
Binary file not shown.
Binary file modified Assets/Adjust/Windows/WU10/Win10Interface.dll
Binary file not shown.
1 change: 1 addition & 0 deletions Assets/Adjust/iOS/ADJConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* @brief Optional delegate that will get informed about tracking results.
*/
@protocol AdjustDelegate

@optional

/**
Expand Down
11 changes: 10 additions & 1 deletion Assets/Adjust/iOS/Adjust.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Adjust.h
// Adjust
//
// V4.15.0
// V4.17.1
// Created by Christian Wellenbrock (wellle) on 23rd July 2013.
// Copyright © 2012-2017 Adjust GmbH. All rights reserved.
//
Expand Down Expand Up @@ -152,6 +152,13 @@ extern NSString * __nonnull const ADJEnvironmentProduction;
*/
+ (nullable ADJAttribution *)attribution;

/**
* @brief Get current Adjust SDK version string.
*
* @return Adjust SDK version string (iosX.Y.Z).
*/
+ (nullable NSString *)sdkVersion;

/**
* @brief Convert a universal link style URL to a deeplink style URL with the corresponding scheme.
*
Expand Down Expand Up @@ -271,6 +278,8 @@ extern NSString * __nonnull const ADJEnvironmentProduction;

- (nullable NSString *)idfa;

- (nullable NSString *)sdkVersion;

- (nullable ADJAttribution *)attribution;

- (nullable NSURL *)convertUniversalLink:(nonnull NSURL *)url scheme:(nonnull NSString *)scheme;
Expand Down
Binary file modified Assets/Adjust/iOS/AdjustSdk.a
Binary file not shown.
15 changes: 15 additions & 0 deletions Assets/Adjust/iOS/AdjustUnity.mm
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,21 @@ void _AdjustAppWillOpenUrl(const char* url) {
return adidCStringCopy;
}

char* _AdjustGetSdkVersion() {
NSString *sdkVersion = [Adjust sdkVersion];
if (nil == sdkVersion) {
return NULL;
}

const char* sdkVersionCString = [sdkVersion UTF8String];
if (NULL == sdkVersionCString) {
return NULL;
}

char* sdkVersionCStringCopy = strdup(sdkVersionCString);
return sdkVersionCStringCopy;
}

char* _AdjustGetAttribution() {
ADJAttribution *attribution = [Adjust attribution];
if (nil == attribution) {
Expand Down
10 changes: 9 additions & 1 deletion Assets/Adjust/iOS/AdjustiOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace com.adjust.sdk
#if UNITY_IOS
public class AdjustiOS
{
private const string sdkPrefix = "unity4.15.0";
private const string sdkPrefix = "unity4.17.0";

[DllImport("__Internal")]
private static extern void _AdjustLaunchApp(
Expand Down Expand Up @@ -70,6 +70,9 @@ private static extern void _AdjustTrackEvent(
[DllImport("__Internal")]
private static extern string _AdjustGetAdid();

[DllImport("__Internal")]
private static extern string _AdjustGetSdkVersion();

[DllImport("__Internal")]
private static extern void _AdjustGdprForgetMe();

Expand Down Expand Up @@ -259,6 +262,11 @@ public static string GetAdid()
return _AdjustGetAdid();
}

public static string GetSdkVersion()
{
return sdkPrefix + "@" + _AdjustGetSdkVersion();
}

public static void GdprForgetMe()
{
_AdjustGdprForgetMe();
Expand Down
Binary file modified Assets/Adjust/iOS/Test/AdjustTestLibrary.a
Binary file not shown.
8 changes: 8 additions & 0 deletions Assets/AdjustImei.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/AdjustImei/Android.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions Assets/AdjustImei/Android/AdjustImeiAndroid.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Runtime.InteropServices;
using UnityEngine;

namespace com.adjust.sdk.imei
{
#if UNITY_ANDROID
public class AdjustImeiAndroid
{
private static AndroidJavaClass ajcAdjustImei = new AndroidJavaClass("com.adjust.sdk.imei.AdjustImei");

public static void ReadImei()
{
if (ajcAdjustImei == null)
{
ajcAdjustImei = new AndroidJavaClass("com.adjust.sdk.Adjust");
}
ajcAdjustImei.CallStatic("readImei");
}

public static void DoNotReadImei()
{
if (ajcAdjustImei == null)
{
ajcAdjustImei = new AndroidJavaClass("com.adjust.sdk.Adjust");
}
ajcAdjustImei.CallStatic("doNotReadImei");
}
}
#endif
}
Loading

0 comments on commit f1b68fe

Please sign in to comment.