Skip to content

Commit 89fdc36

Browse files
committed
Merge pull request #15 from adjust/development
New response data fields
2 parents e8fc3d9 + fc0d529 commit 89fdc36

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+212
-106
lines changed

Adjust_v3.2.3.unitypackage

-2.31 MB
Binary file not shown.

Adjust_v3.3.0.unitypackage

2.32 MB
Binary file not shown.

Assets/Adjust.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ public class Adjust : MonoBehaviour {
1010
private static Action<ResponseData> responseDelegate = null;
1111

1212
public string appToken = "{Your App Token}";
13-
public Util.LogLevel logLevel = Util.LogLevel.Info;
14-
public Util.Environment environment = Util.Environment.Sandbox;
13+
public AdjustUtil.LogLevel logLevel = AdjustUtil.LogLevel.Info;
14+
public AdjustUtil.AdjustEnvironment environment = AdjustUtil.AdjustEnvironment.Sandbox;
1515
public bool eventBuffering = false;
1616
public bool startManually = false;
17-
public const string sdkPrefix = "unity3.2.3";
17+
public const string sdkPrefix = "unity3.3.0";
1818

1919
void Awake() {
2020
if (!this.startManually) {
@@ -34,7 +34,7 @@ void OnApplicationPause(bool pauseStatus) {
3434
}
3535
}
3636

37-
public static void appDidLaunch(string appToken, Util.Environment environment, Util.LogLevel logLevel, bool eventBuffering) {
37+
public static void appDidLaunch(string appToken, AdjustUtil.AdjustEnvironment environment, AdjustUtil.LogLevel logLevel, bool eventBuffering) {
3838
if (Adjust.instance != null) {
3939
Debug.Log("adjust: warning, SDK already started. Restarting");
4040
}

Assets/Editor/AdjustEditor.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ static int RunPostBuildScript (bool preBuild, string pathToBuiltProject = "") {
8282

8383
#if UNITY_ANDROID
8484
pathToScript = "/Editor/AdjustPostBuildAndroid";
85-
arguments = Application.dataPath;
85+
arguments = "\"" + Application.dataPath + "\"";
8686
if (preBuild)
8787
arguments = "--pre-build " + arguments;
8888
#elif UNITY_IOS
8989
pathToScript = "/Editor/AdjustPostBuildiOS";
9090
if (AdjustEditor.iOSBuildPath == "") {
91-
arguments = pathToBuiltProject;
91+
arguments = "\"" + pathToBuiltProject + "\"";
9292
} else {
93-
arguments = AdjustEditor.iOSBuildPath;
93+
arguments = "\"" + AdjustEditor.iOSBuildPath + "\"";
9494
}
9595
#else
9696
return -1;
@@ -121,7 +121,7 @@ static string GenerateErrorScriptMessage(int exitCode) {
121121
#if UNITY_ANDROID
122122
logFile = projectPath + "/AdjustPostBuildAndroidLog.txt";
123123
#elif UNITY_IOS
124-
logFile = projectPath + "/AdjustPostBuiliOSLog.txt";
124+
logFile = projectPath + "/AdjustPostBuildiOSLog.txt";
125125
#else
126126
return null;
127127
#endif

Assets/Editor/AdjustPostBuildiOS

+16-11
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ def main():
1818
# path of the Xcode SDK on the system
1919
xcode_sdk_path = get_xcode_sdk_path(LogFunc)
2020

21-
# path for unity iOS Xcode project and adFramework on the system
22-
unity_xcode_project_path, adFramework_path = get_paths(LogFunc, parser, xcode_sdk_path)
21+
# path for unity iOS Xcode project and framework on the system
22+
unity_xcode_project_path, framework_path = get_paths(LogFunc, parser, xcode_sdk_path)
2323

2424
# edit the Xcode project using mod_pbxproj
25-
# add the adFramework library
25+
# add the adSupport framework library
26+
# add the iAd framework library
2627
# change the compilation flags of the adjust project files to support non-ARC
27-
edit_unity_xcode_project(LogFunc, unity_xcode_project_path, adFramework_path)
28+
edit_unity_xcode_project(LogFunc, unity_xcode_project_path, framework_path)
2829

2930
# change the Xcode project directly
3031
# allow objective-c exceptions
@@ -43,20 +44,24 @@ def get_paths(Log, parser, xcode_sdk_path):
4344

4445
unity_xcode_project_path = ios_project_path + "/Unity-iPhone.xcodeproj/project.pbxproj"
4546
Log("Unity3d Xcode project path: {0}", unity_xcode_project_path)
46-
47-
adFramework_path = xcode_sdk_path + "/System/Library/Frameworks/AdSupport.framework"
48-
Log("adFramework path: {0}", adFramework_path)
4947

50-
return unity_xcode_project_path, adFramework_path
48+
framework_path = xcode_sdk_path + "/System/Library/Frameworks/"
49+
Log("framework path: {0}", framework_path)
50+
51+
return unity_xcode_project_path, framework_path
5152

52-
def edit_unity_xcode_project(Log, unity_xcode_project_path, adFramework_path):
53+
def edit_unity_xcode_project(Log, unity_xcode_project_path, framework_path):
5354
# load unity iOS pbxproj project file
5455
unity_XcodeProject = XcodeProject.Load(unity_xcode_project_path)
5556

56-
# add adFramework to unity
57-
unity_XcodeProject.add_file_if_doesnt_exist(adFramework_path, tree="SDKROOT", create_build_files=True,weak=True)
57+
# add adSupport framework to unity
58+
unity_XcodeProject.add_file_if_doesnt_exist(framework_path + "AdSupport.framework", tree="SDKROOT", create_build_files=True,weak=True)
5859
Log("added adSupport framework")
5960

61+
# add iAd framework to unity
62+
unity_XcodeProject.add_file_if_doesnt_exist(framework_path + "iAd.framework", tree="SDKROOT", create_build_files=True,weak=True)
63+
Log("added iAd framework")
64+
6065
# regex for adjust sdk files
6166
re_adjust_files = re.compile(r"AI.*\.m|.*\+AI.*\.m|Adjust\.m|AdjustUnity\.mm")
6267

Assets/ExampleGUI/ExampleGUI.cs

+22-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class ExampleGUI : MonoBehaviour {
1111
void OnGUI () {
1212
if (GUI.Button (new Rect (0, Screen.height * 0 / nr_buttons, Screen.width, Screen.height / nr_buttons),
1313
"manual launch")) {
14-
Adjust.appDidLaunch("querty123456", Util.Environment.Sandbox, Util.LogLevel.Verbose, false);
14+
Adjust.appDidLaunch("querty123456", AdjustUtil.AdjustEnvironment.Sandbox, AdjustUtil.LogLevel.Verbose, false);
1515
isEnabled = true;
1616
}
1717

@@ -52,9 +52,27 @@ void OnGUI () {
5252

5353
public void responseDelegate (ResponseData responseData)
5454
{
55-
Debug.Log ("activitykind " + responseData.activityKind.ToString ());
56-
Debug.Log ("trackerName " + responseData.trackerName);
57-
Debug.Log ("error " + responseData.error);
55+
56+
Debug.Log ("Was success? " + responseData.success);
57+
Debug.Log ("Will retry? " + responseData.willRetry);
58+
59+
if (!string.IsNullOrEmpty (responseData.activityKindString))
60+
Debug.Log ("activityKind " + responseData.activityKindString);
61+
if (responseData.trackerName != null)
62+
Debug.Log ("trackerName " + responseData.trackerName);
63+
if (responseData.trackerToken != null)
64+
Debug.Log ("trackerToken " + responseData.trackerToken);
65+
if (responseData.network != null)
66+
Debug.Log ("network " + responseData.network);
67+
if (responseData.campaign != null)
68+
Debug.Log ("campaign " + responseData.campaign);
69+
if (responseData.adgroup != null)
70+
Debug.Log ("adgroup " + responseData.adgroup);
71+
if (responseData.creative != null)
72+
Debug.Log ("creative " + responseData.creative);
73+
if (responseData.error != null)
74+
Debug.Log ("error " + responseData.error);
75+
5876
}
5977

6078
}

Assets/Plugins/Util.cs renamed to Assets/Plugins/AdjustUtil.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
namespace com.adjust.sdk {
2-
public class Util {
2+
public class AdjustUtil {
33
public enum LogLevel {
44
Verbose = 1,
55
Debug,
@@ -9,7 +9,7 @@ public enum LogLevel {
99
Assert
1010
}
1111

12-
public enum Environment {
12+
public enum AdjustEnvironment {
1313
Sandbox,
1414
Production
1515
}
File renamed without changes.

Assets/Plugins/Android/AdjustAndroid.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public AdjustAndroid() {
1818
ajoCurrentActivity = ajcUnityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
1919
}
2020

21-
public void appDidLaunch(string appToken, Util.Environment environment, string sdkPrefix, Util.LogLevel logLevel, bool eventBuffering) {
21+
public void appDidLaunch(string appToken, AdjustUtil.AdjustEnvironment environment, string sdkPrefix, AdjustUtil.LogLevel logLevel, bool eventBuffering) {
2222

2323
string sEnvironment = environment.ToString ().ToLower ();
2424
string sLogLevel = logLevel.ToString ().ToLower ();

Assets/Plugins/Android/adjust.jar

2.23 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Manifest-Version: 1.0
2-
Created-By: 1.6.0_65 (Apple Inc.)
3-
1+
Manifest-Version: 1.0
2+
Created-By: 1.6.0_65 (Apple Inc.)
3+
Binary file not shown.

Assets/Plugins/IAdjust.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace com.adjust.sdk
55
{
66
public interface IAdjust
77
{
8-
void appDidLaunch (string appToken, Util.Environment environment, string sdkPrefix, Util.LogLevel logLevel, bool eventBuffering);
8+
void appDidLaunch (string appToken, AdjustUtil.AdjustEnvironment environment, string sdkPrefix, AdjustUtil.LogLevel logLevel, bool eventBuffering);
99
void trackEvent (string eventToken, Dictionary<string,string> parameters = null);
1010
void trackRevenue (double cents, string eventToken = null, Dictionary<string,string> parameters = null);
1111
void onPause ();

Assets/Plugins/Metro/AdjustMetro.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace com.adjust.sdk {
77

88
public class AdjustMetro : IAdjust {
99

10-
public void appDidLaunch (string appToken, Util.Environment environment, string sdkPrefix, Util.LogLevel logLevel, bool eventBuffering)
10+
public void appDidLaunch (string appToken, AdjustUtil.AdjustEnvironment environment, string sdkPrefix, AdjustUtil.LogLevel logLevel, bool eventBuffering)
1111
{
1212
string sEnvironment = environment.ToString ().ToLower ();
1313
string sLogLevel = logLevel.ToString ().ToLower ();

Assets/Plugins/ResponseData.cs

+53-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using SimpleJSON;
3+
using UnityEngine;
34

45
namespace com.adjust.sdk
56
{
@@ -9,24 +10,67 @@ public enum ActivityKind {
910
UNKNOWN, SESSION, EVENT, REVENUE, REATTRIBUTION
1011
}
1112

12-
public ActivityKind activityKind { get; private set; }
13+
public ActivityKind? activityKind { get; private set; }
1314
public string activityKindString { get; private set; }
14-
public bool success { get; private set; }
15-
public bool willRetry { get; private set; }
15+
public bool? success { get; private set; }
16+
public bool? willRetry { get; private set; }
1617
public string error { get; private set; }
1718
public string trackerToken { get; private set; }
1819
public string trackerName { get; private set; }
20+
public string network { get; private set; }
21+
public string campaign { get; private set; }
22+
public string adgroup { get; private set; }
23+
public string creative { get; private set; }
1924

2025
public ResponseData(string jsonString) {
2126
var jsonNode = JSON.Parse (jsonString);
2227

23-
activityKind = ParseActivityKind(jsonNode["activityKind"].Value);
28+
if (jsonNode == null) {
29+
return;
30+
}
31+
32+
activityKind = ParseActivityKind(getJsonString (jsonNode, "activityKind"));
2433
activityKindString = activityKind.ToString ().ToLower ();
25-
success = jsonNode ["success"].AsBool;
26-
willRetry = jsonNode ["willRetry"].AsBool;
27-
error = jsonNode ["error"].Value;
28-
trackerName = jsonNode ["trackerName"].Value;
29-
trackerToken = jsonNode ["trackerToken"].Value;
34+
35+
success = getJsonBool(jsonNode, "success");
36+
willRetry = getJsonBool(jsonNode, "willRetry");
37+
38+
error = getJsonString(jsonNode, "error");
39+
trackerName = getJsonString(jsonNode, "trackerName");
40+
trackerToken = getJsonString(jsonNode, "trackerToken");
41+
network = getJsonString(jsonNode, "network");
42+
campaign = getJsonString(jsonNode, "campaign");
43+
adgroup = getJsonString(jsonNode, "adgroup");
44+
creative = getJsonString(jsonNode, "creative");
45+
}
46+
47+
private String getJsonString(JSONNode node, string key) {
48+
var jsonValue = getJsonValue (node, key);
49+
50+
if (jsonValue == null)
51+
return null;
52+
53+
return jsonValue.Value;
54+
}
55+
56+
private bool? getJsonBool(JSONNode node, string key) {
57+
var jsonValue = getJsonValue (node, key);
58+
59+
if (jsonValue == null)
60+
return null;
61+
62+
return jsonValue.AsBool;
63+
}
64+
65+
private JSONNode getJsonValue(JSONNode node, string key) {
66+
if (node == null)
67+
return null;
68+
69+
var nodeValue = node [key];
70+
if (nodeValue.GetType() == typeof(JSONLazyCreator))
71+
return null;
72+
73+
return nodeValue;
3074
}
3175

3276
private ActivityKind ParseActivityKind(string sActivityKind)

Assets/Plugins/WP8/AdjustWP8.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace com.adjust.sdk {
77
public class AdjustWP8 : IAdjust {
88

9-
public void appDidLaunch (string appToken, Util.Environment environment, string sdkPrefix, Util.LogLevel logLevel, bool eventBuffering)
9+
public void appDidLaunch (string appToken, AdjustUtil.AdjustEnvironment environment, string sdkPrefix, AdjustUtil.LogLevel logLevel, bool eventBuffering)
1010
{
1111
string sEnvironment = environment.ToString ().ToLower ();
1212
string sLogLevel = logLevel.ToString ().ToLower ();

Assets/Plugins/iOS/AIActivityHandler.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Adjust
44
//
55
// Created by Christian Wellenbrock on 2013-07-01.
6-
// Copyright (c) 2013 adeven. All rights reserved.
6+
// Copyright (c) 2013 adjust GmbH. All rights reserved.
77
//
88

99
#import "Adjust.h"

Assets/Plugins/iOS/AIActivityHandler.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Adjust
44
//
55
// Created by Christian Wellenbrock on 2013-07-01.
6-
// Copyright (c) 2013 adeven. All rights reserved.
6+
// Copyright (c) 2013 adjust GmbH. All rights reserved.
77
//
88

99
#import "AIActivityPackage.h"

Assets/Plugins/iOS/AIActivityKind.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Adjust
44
//
55
// Created by Christian Wellenbrock on 11.02.14.
6-
// Copyright (c) 2014 adeven. All rights reserved.
6+
// Copyright (c) 2014 adjust GmbH. All rights reserved.
77
//
88

99
#import <Foundation/Foundation.h>

Assets/Plugins/iOS/AIActivityKind.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Adjust
44
//
55
// Created by Christian Wellenbrock on 11.02.14.
6-
// Copyright (c) 2014 adeven. All rights reserved.
6+
// Copyright (c) 2014 adjust GmbH. All rights reserved.
77
//
88

99
#import "AIActivityKind.h"

Assets/Plugins/iOS/AIActivityPackage.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Adjust
44
//
55
// Created by Christian Wellenbrock on 2013-07-03.
6-
// Copyright (c) 2013 adeven. All rights reserved.
6+
// Copyright (c) 2013 adjust GmbH. All rights reserved.
77
//
88

99
#import "AIActivityKind.h"

Assets/Plugins/iOS/AIActivityPackage.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Adjust
44
//
55
// Created by Christian Wellenbrock on 2013-07-03.
6-
// Copyright (c) 2013 adeven. All rights reserved.
6+
// Copyright (c) 2013 adjust GmbH. All rights reserved.
77
//
88

99
#import "AIActivityPackage.h"

Assets/Plugins/iOS/AIActivityState.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Adjust
44
//
55
// Created by Christian Wellenbrock on 2013-07-02.
6-
// Copyright (c) 2013 adeven. All rights reserved.
6+
// Copyright (c) 2013 adjust GmbH. All rights reserved.
77
//
88
#import <Foundation/Foundation.h>
99

Assets/Plugins/iOS/AIActivityState.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Adjust
44
//
55
// Created by Christian Wellenbrock on 2013-07-02.
6-
// Copyright (c) 2013 adeven. All rights reserved.
6+
// Copyright (c) 2013 adjust GmbH. All rights reserved.
77
//
88

99
#import "AIActivityState.h"

Assets/Plugins/iOS/AIAdjustFactory.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Adjust
44
//
55
// Created by Pedro Filipe on 07/02/14.
6-
// Copyright (c) 2014 adeven. All rights reserved.
6+
// Copyright (c) 2014 adjust GmbH. All rights reserved.
77
//
88
#import <Foundation/Foundation.h>
99

Assets/Plugins/iOS/AIAdjustFactory.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Adjust
44
//
55
// Created by Pedro Filipe on 07/02/14.
6-
// Copyright (c) 2014 adeven. All rights reserved.
6+
// Copyright (c) 2014 adjust GmbH. All rights reserved.
77
//
88

99
#import "AIAdjustFactory.h"

Assets/Plugins/iOS/AILogger.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Adjust
44
//
55
// Created by Christian Wellenbrock on 2012-11-15.
6-
// Copyright (c) 2012-2013 adeven. All rights reserved.
6+
// Copyright (c) 2012-2014 adjust GmbH. All rights reserved.
77
//
88
#import <Foundation/Foundation.h>
99

Assets/Plugins/iOS/AILogger.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Adjust
44
//
55
// Created by Christian Wellenbrock on 2012-11-15.
6-
// Copyright (c) 2012-2013 adeven. All rights reserved.
6+
// Copyright (c) 2012-2014 adjust GmbH. All rights reserved.
77
//
88

99
#import "AILogger.h"

0 commit comments

Comments
 (0)