Skip to content

Commit 04fc468

Browse files
author
Uglješa Erceg
committed
Merge pull request #47 from adjust/unity_sync
Unity sync
2 parents 93085b2 + 7bae2d1 commit 04fc468

15 files changed

+57
-32
lines changed

Assets/Adjust/Adjust.cs

+9-7
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ namespace com.adjust.sdk
77
{
88
public class Adjust : MonoBehaviour
99
{
10-
private const string sdkPrefix = "unity4.0.1";
11-
private const string errorMessage = "adjust: SDK not started. Start it manually using the 'appDidLaunch' method.";
10+
private const string errorMessage = "adjust: SDK not started. Start it manually using the 'start' method.";
1211

1312
private static IAdjust instance = null;
1413
private static Action<AdjustAttribution> attributionChangedDelegate = null;
@@ -39,7 +38,8 @@ void Awake ()
3938
}
4039
}
4140

42-
void OnApplicationPause(bool pauseStatus) {
41+
void OnApplicationPause(bool pauseStatus)
42+
{
4343
if (Adjust.instance == null) {
4444
return;
4545
}
@@ -82,7 +82,6 @@ public static void start (AdjustConfig adjustConfig)
8282
return;
8383
}
8484

85-
adjustConfig.setSdkPrefix(Adjust.sdkPrefix);
8685
Adjust.attributionChangedDelegate = adjustConfig.getAttributionChangedDelegate ();
8786

8887
Adjust.instance.start (adjustConfig);
@@ -103,7 +102,8 @@ public static void trackEvent (AdjustEvent adjustEvent)
103102
Adjust.instance.trackEvent (adjustEvent);
104103
}
105104

106-
public static void setEnabled(bool enabled) {
105+
public static void setEnabled(bool enabled)
106+
{
107107
if (Adjust.instance == null) {
108108
Debug.Log(Adjust.errorMessage);
109109
return;
@@ -112,7 +112,8 @@ public static void setEnabled(bool enabled) {
112112
Adjust.instance.setEnabled(enabled);
113113
}
114114

115-
public static bool isEnabled() {
115+
public static bool isEnabled()
116+
{
116117
if (Adjust.instance == null) {
117118
Debug.Log(Adjust.errorMessage);
118119
return false;
@@ -121,7 +122,8 @@ public static bool isEnabled() {
121122
return Adjust.instance.isEnabled();
122123
}
123124

124-
public static void setOfflineMode(bool enabled) {
125+
public static void setOfflineMode(bool enabled)
126+
{
125127
if (Adjust.instance == null) {
126128
Debug.Log(Adjust.errorMessage);
127129
return;

Assets/Adjust/Android/AdjustAndroid.cs

+9-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ namespace com.adjust.sdk
1010
#if UNITY_ANDROID
1111
public class AdjustAndroid : IAdjust
1212
{
13+
private const string sdkPrefix = "unity4.0.2";
1314
private AndroidJavaClass ajcAdjust;
1415
private AndroidJavaObject ajoCurrentActivity;
1516
private AttributionChangeListener onAttributionChangedListener;
@@ -80,9 +81,13 @@ public void start (AdjustConfig adjustConfig)
8081
ajoAdjustConfig.Call ("setOnAttributionChangedListener", onAttributionChangedListener);
8182
}
8283

83-
ajoAdjustConfig.Call ("setSdkPrefix", adjustConfig.sdkPrefix);
84+
ajoAdjustConfig.Call ("setSdkPrefix", sdkPrefix);
8485

8586
ajcAdjust.CallStatic ("onCreate", ajoAdjustConfig);
87+
88+
if (adjustConfig.startAutomatically == true) {
89+
ajcAdjust.CallStatic ("onResume");
90+
}
8691
}
8792

8893
public void trackEvent (AdjustEvent adjustEvent)
@@ -119,11 +124,12 @@ public bool isEnabled ()
119124
return ajcAdjust.CallStatic<bool> ("isEnabled");
120125
}
121126

122-
public void setEnabled(bool enabled) {
127+
public void setEnabled (bool enabled)
128+
{
123129
ajcAdjust.CallStatic ("setEnabled", enabled);
124130
}
125131

126-
public void setOfflineMode(bool enabled)
132+
public void setOfflineMode (bool enabled)
127133
{
128134
ajcAdjust.CallStatic ("setOfflineMode", enabled);
129135
}
1.61 KB
Binary file not shown.

Assets/Adjust/Android/adjust-android.jar.meta

+14-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Adjust/ExampleGUI/ExampleGUI.cs

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ void OnGUI ()
2626
if (GUI.Button (new Rect (0, Screen.height * 0 / nr_buttons, Screen.width, Screen.height / nr_buttons), txtManualLaunch)) {
2727
if (!string.Equals(txtManualLaunch, "SDK Launched", StringComparison.OrdinalIgnoreCase)) {
2828
AdjustConfig adjustConfig = new AdjustConfig ("{YourAppToken}", AdjustEnvironment.Sandbox);
29+
adjustConfig.setStartAutomatically(true);
2930
adjustConfig.setLogLevel (AdjustLogLevel.Verbose);
3031
adjustConfig.setAttributionChangedDelegate (this.attributionChangedDelegate);
3132

Assets/Adjust/Unity/AdjustConfig.cs

+8-5
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ public class AdjustConfig
66
{
77
internal string appToken;
88
internal string sceneName;
9-
internal string sdkPrefix;
109
internal string defaultTracker;
10+
11+
internal bool? startAutomatically;
1112
internal bool? eventBufferingEnabled;
13+
1214
internal AdjustLogLevel? logLevel;
1315
internal AdjustEnvironment environment;
1416
internal Action<AdjustAttribution> attributionChangedDelegate;
@@ -18,16 +20,17 @@ public AdjustConfig (string appToken, AdjustEnvironment environment)
1820
this.sceneName = "";
1921
this.appToken = appToken;
2022
this.environment = environment;
23+
this.startAutomatically = false;
2124
}
2225

23-
public void setSdkPrefix (string sdkPrefix)
26+
public void setLogLevel (AdjustLogLevel logLevel)
2427
{
25-
this.sdkPrefix = sdkPrefix;
28+
this.logLevel = logLevel;
2629
}
2730

28-
public void setLogLevel (AdjustLogLevel logLevel)
31+
public void setStartAutomatically (bool shouldStartAutomatically)
2932
{
30-
this.logLevel = logLevel;
33+
this.startAutomatically = shouldStartAutomatically;
3134
}
3235

3336
public void setDefaultTracker (string defaultTracker)

Assets/Adjust/iOS/Adjust.a

117 KB
Binary file not shown.

Assets/Adjust/iOS/AdjustiOS.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ namespace com.adjust.sdk
1010
#if UNITY_IOS
1111
public class AdjustiOS : IAdjust
1212
{
13+
private const string sdkPrefix = "unity4.0.2";
14+
1315
#region External methods
1416

1517
[DllImport ("__Internal")]
@@ -27,18 +29,17 @@ public class AdjustiOS : IAdjust
2729
[DllImport ("__Internal")]
2830
private static extern void _AdjustSetOfflineMode (int enabled);
2931

32+
#endregion
33+
3034
public AdjustiOS ()
3135
{
3236
}
3337

34-
#endregion
35-
3638
#region Public methods
3739

3840
public void start (AdjustConfig adjustConfig)
3941
{
4042
string appToken = adjustConfig .appToken;
41-
string sdkPrefix = adjustConfig.sdkPrefix;
4243
string sceneName = adjustConfig.sceneName;
4344
string environment = adjustConfig.environment.ToString ().ToLower ();
4445

Assets/Editor/PostprocessBuildPlayer_AdjustPostBuildiOS

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def edit_unity_xcode_project(Log, unity_xcode_project_path, framework_path):
8989
# build_file.add_compiler_flag('-fobjc-arc')
9090
# Log("added ARC flag to file {0}", name)
9191

92-
unity_XcodeProject.add_other_ldflags('-all_load')
92+
unity_XcodeProject.add_other_ldflags('-ObjC')
9393

9494
# save changes
9595
unity_XcodeProject.saveFormat3_2()

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0.1
1+
4.0.2

doc/migrate.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
## Migrate your adjust SDK for Unity3d to 4.0.1 from 3.4.4
1+
## Migrate your adjust SDK for Unity3d to 4.0.2 from 3.4.4
22

3-
N.B. At the moment, SDK 4.0.1 for Unity supports Android and iOS, but not Windows. If you are planning to release your Unity app on Windows, please migrate to 4.0.1 only when we add full support for Windows.
3+
N.B. At the moment, SDK 4.0.2 for Unity supports Android and iOS, but not Windows. If you are planning to release your Unity app on Windows, please migrate to 4.0.2 only when we add full support for Windows.
44

55
### Migration procedure
66

7-
Starting from version 4.0.1, the structure of this repository is adjusted to Unity 5. All files which are part of the
7+
Starting from version 4.0.2, the structure of this repository is adjusted to Unity 5. All files which are part of the
88
adjust SDK are now moved to the `Assets/Adjust` folder, since Unity 5 allows that native files can now be placed
99
outside of `Assets/Plugins` folder. This is done so that adjust files are no longer mixed with files you may be
1010
keeping in `Assets/Plugins` folder.
1111

1212
For migration purposes, we have prepared two Unity packages:
1313

14-
* `Adjust_v4.0.1_Unity_4.unitypackage` (for Unity 4 users)
15-
* `Adjust_v4.0.1_Unity_5.unitypackage` (for Unity 5 users)
14+
* `Adjust_v4.0.2_Unity_4.unitypackage` (for Unity 4 users)
15+
* `Adjust_v4.0.2_Unity_5.unitypackage` (for Unity 5 users)
1616

1717
and the adjust SDK uninstall script written in Python (`adjust_uninstall.py`).
1818

19-
Migration to version 4.0.1 of our SDK requires the following steps:
19+
Migration to version 4.0.2 of our SDK requires the following steps:
2020

2121
1. Copy the `adjust_uninstall.py` script to your root Unity project directory and run it. This script should
2222
delete all adjust source files from the previous SDK version you had.

ext/Android/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MVNDIR = ./sdk/Adjust
22
JARINDIR = ./sdk/Adjust/target
3-
JAROUTDIR = ../../Assets/Plugins/Android
3+
JAROUTDIR = ../../Assets/Adjust/Android
44

55
default: copy
66

ext/Android/sdk

Submodule sdk updated 37 files

ext/iOS/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
SRCDIR = ./sdk
2-
LIBOUTDIR = ../../Assets/Plugins/iOS
2+
LIBOUTDIR = ../../Assets/Adjust/iOS
33

44
default: copy
55

ext/iOS/sdk

Submodule sdk updated 64 files

0 commit comments

Comments
 (0)