Skip to content

Commit e1259fe

Browse files
authored
Merge pull request #35 from adjust/v4140
Version 4.14.0
2 parents f1afab5 + 17cc7e0 commit e1259fe

File tree

119 files changed

+12609
-599
lines changed

Some content is hidden

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

119 files changed

+12609
-599
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,6 @@ package-lock.json
9999

100100
ios/Build/
101101
ios/Index/
102+
103+
# Just in case
104+
temp/

.gitmodules

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
[submodule "ext/Android/sdk"]
2-
path = ext/Android/sdk
1+
[submodule "ext/android/sdk"]
2+
path = ext/android/sdk
33
url = [email protected]:adjust/android_sdk.git
44
branch = master
5-
[submodule "ext/iOS/sdk"]
6-
path = ext/iOS/sdk
5+
[submodule "ext/ios/sdk"]
6+
path = ext/ios/sdk
77
url = [email protected]:adjust/ios_sdk.git
88
branch = master

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ node_modules
1414
ext/
1515
scripts/
1616
example/
17+
test/

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
### Version 4.14.0 (4th July 2018)
2+
#### Added
3+
- Added deep link caching in case `appWillOpenUrl` method is called before SDK is initialised.
4+
5+
#### Changed
6+
- Imposed type checks when calling methods for adding callback and partner parameters - both key and value now **must** be strings.
7+
- Updated the way how iOS native bridge handles push tokens from React Native interface - they are now being passed directly as strings to native iOS SDK.
8+
9+
#### Native SDKs
10+
- [[email protected]][ios_sdk_v4.14.1]
11+
- [[email protected]][android_sdk_v4.14.0]
12+
13+
---
14+
115
### Version 4.13.0 (22nd May 2018)
216
#### Added
317
- Added `gdprForgetMe` method to `Adjust` interface to enable possibility for user to be forgotten in accordance with GDPR law.
@@ -214,6 +228,7 @@
214228
[ios_sdk_v4.12.1]: https://github.com/adjust/ios_sdk/tree/v4.12.1
215229
[ios_sdk_v4.12.3]: https://github.com/adjust/ios_sdk/tree/v4.12.3
216230
[ios_sdk_v4.13.0]: https://github.com/adjust/ios_sdk/tree/v4.13.0
231+
[ios_sdk_v4.14.1]: https://github.com/adjust/ios_sdk/tree/v4.14.1
217232

218233
[android_sdk_v4.10.4]: https://github.com/adjust/android_sdk/tree/v4.10.4
219234
[android_sdk_v4.11.0]: https://github.com/adjust/android_sdk/tree/v4.11.0
@@ -226,3 +241,4 @@
226241
[android_sdk_v4.12.3]: https://github.com/adjust/android_sdk/tree/v4.12.3
227242
[android_sdk_v4.12.4]: https://github.com/adjust/android_sdk/tree/v4.12.4
228243
[android_sdk_v4.13.0]: https://github.com/adjust/android_sdk/tree/v4.13.0
244+
[android_sdk_v4.14.0]: https://github.com/adjust/android_sdk/tree/v4.14.0

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
The adjust SDK is licensed under the MIT License.
1+
The Adjust SDK is licensed under the MIT License.
22

3-
Copyright (c) 2012-2017 adjust GmbH, http://www.adjust.com
3+
Copyright (c) 2012-2018 Adjust GmbH, http://www.adjust.com
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,8 @@ It should be mentioned that we support a variety of placeholders like `{idfa}` f
363363
You can read more about using URL callbacks, including a full list of available values, in our
364364
[callbacks guide][callbacks-guide].
365365

366+
**Note**: **Both** parameters in this method must be **strings**. If either of the passed parameters is not a string, the key-value pair will not be added to the parameters list.
367+
366368
### <a id="partner-parameters"></a>Partner parameters
367369

368370
Similarly to the callback parameters mentioned above, you can also add parameters that Adjust will transmit to the network partners of your choice. You can activate these networks in your Adjust dashboard.
@@ -380,6 +382,8 @@ Adjust.trackEvent(adjustEvent);
380382

381383
You can read more about special partners and networks in our [guide to special partners][special-partners].
382384

385+
**Note**: **Both** parameters in this method must be **strings**. If either of the passed parameters is not a string, the key-value pair will not be added to the parameters list.
386+
383387
### <a id="session-parameters"></a>Session parameters
384388

385389
Some parameters are saved to be sent in every event and session of the Adjust SDK. Once you have added any of these parameters, you don't need to add them every time, since they will be saved locally. If you add the same parameter twice, there will be no effect.
@@ -398,6 +402,8 @@ Adjust.addSessionCallbackParameter("foo", "bar");
398402

399403
The session callback parameters will be merged with the callback parameters and added to an event. The callback parameters added to an event have precedence over the session callback parameters. Meaning that, when adding a callback parameter to an event with the same key to one added from the session, the value that prevails is the callback parameter added to the event.
400404

405+
**Note**: **Both** parameters in this method must be **strings**. If either of the passed parameters is not a string, the key-value pair will not be added to the parameters list.
406+
401407
It's possible to remove a specific session callback parameter by passing the desiring key to the method `removeSessionCallbackParameter` of the `Adjust` instance:
402408

403409
```js
@@ -424,6 +430,8 @@ Adjust.addSessionPartnerParameter("foo", "bar");
424430

425431
The session partner parameters will be merged with the partner parameters and added to an event. The partner parameters added to an event have precedence over the session partner parameters. Meaning that, when adding a partner parameter to an event with the same key to one added from the session, the value that prevails is the partner parameter added to the event.
426432

433+
**Note**: **Both** parameters in this method must be **strings**. If either of the passed parameters is not a string, the key-value pair will not be added to the parameters list.
434+
427435
It's possible to remove a specific session partner parameter by passing the desiring key to the method `removeSessionPartnerParameter` of the `Adjust` instance:
428436

429437
```js

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.13.0
1+
4.14.0

android/libs/adjust-android.jar

1.01 KB
Binary file not shown.

android/src/main/java/com/adjust/sdk/Adjust.java

Lines changed: 129 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
// Adjust.java
33
// Adjust SDK
44
//
5-
// Created by Abdullah Obaied (@obaied) on 19th Octover 2016.
6-
// Copyright (c) 2016-2018 Adjust GmbH. All rights reserved.
5+
// Created by Abdullah Obaied on 2016-10-19.
6+
// Copyright (c) 2018 adjust GmbH. All rights reserved.
7+
// See the file MIT-LICENSE for copying permission.
78
//
89

910
package com.adjust.nativemodule;
1011

12+
import android.util.Log;
1113
import java.util.Map;
1214
import java.util.HashMap;
1315
import java.util.Map.Entry;
@@ -34,6 +36,7 @@ public class Adjust extends ReactContextBaseJavaModule implements LifecycleEvent
3436
private boolean sessionTrackingFailedCallback;
3537
private boolean deferredDeeplinkCallback;
3638
private boolean shouldLaunchDeeplink = true;
39+
private static String TAG = "AdjustBridge";
3740

3841
public Adjust(ReactApplicationContext reactContext) {
3942
super(reactContext);
@@ -95,37 +98,36 @@ public boolean launchReceivedDeeplink(Uri uri) {
9598

9699
@ReactMethod
97100
public void create(ReadableMap mapConfig) {
98-
String environment = null;
99-
String appToken = null;
100-
String defaultTracker = null;
101-
String processName = null;
102-
String sdkPrefix = null;
103-
String logLevel = null;
104-
boolean eventBufferingEnabled = false;
105-
String userAgent = null;
106-
long secretId = 0L;
107-
long info1 = 0L;
108-
long info2 = 0L;
109-
long info3 = 0L;
110-
long info4 = 0L;
111-
boolean sendInBackground = false;
112-
boolean shouldLaunchDeeplink = false;
113-
double delayStart = 0.0;
114-
boolean isLogLevelSuppress = false;
115-
boolean isDeviceKnown = false;
101+
String appToken = null;
102+
String environment = null;
103+
String logLevel = null;
104+
String sdkPrefix = null;
105+
String userAgent = null;
106+
String processName = null;
107+
String defaultTracker = null;
108+
long secretId = 0L;
109+
long info1 = 0L;
110+
long info2 = 0L;
111+
long info3 = 0L;
112+
long info4 = 0L;
113+
double delayStart = 0.0;
114+
boolean isDeviceKnown = false;
115+
boolean sendInBackground = false;
116+
boolean isLogLevelSuppress = false;
117+
boolean shouldLaunchDeeplink = false;
118+
boolean eventBufferingEnabled = false;
116119
boolean readMobileEquipmentIdentity = false;
117120

118121
// Suppress log level
119122
if (!mapConfig.isNull("logLevel")) {
120123
logLevel = mapConfig.getString("logLevel");
121-
122124
if (logLevel.equals("SUPPRESS")) {
123125
isLogLevelSuppress = true;
124126
}
125127
}
126128

127129
// App token and environment.
128-
appToken = mapConfig.getString("appToken");
130+
appToken = mapConfig.getString("appToken");
129131
environment = mapConfig.getString("environment");
130132

131133
final AdjustConfig adjustConfig = new AdjustConfig(getReactApplicationContext(), appToken, environment, isLogLevelSuppress);
@@ -137,7 +139,6 @@ public void create(ReadableMap mapConfig) {
137139
// Log level
138140
if (!mapConfig.isNull("logLevel")) {
139141
logLevel = mapConfig.getString("logLevel");
140-
141142
if (logLevel.equals("VERBOSE")) {
142143
adjustConfig.setLogLevel(LogLevel.VERBOSE);
143144
} else if (logLevel.equals("DEBUG")) {
@@ -158,7 +159,7 @@ public void create(ReadableMap mapConfig) {
158159
}
159160

160161
// Event buffering
161-
if(!mapConfig.isNull("eventBufferingEnabled")) {
162+
if (!mapConfig.isNull("eventBufferingEnabled")) {
162163
eventBufferingEnabled = mapConfig.getBoolean("eventBufferingEnabled");
163164
adjustConfig.setEventBufferingEnabled(eventBufferingEnabled);
164165
}
@@ -272,28 +273,31 @@ public void trackEvent(ReadableMap mapEvent) {
272273
final String eventToken = mapEvent.getString("eventToken");
273274
final String currency = mapEvent.getString("currency");
274275
final String transactionId = mapEvent.getString("transactionId");
275-
final Map<String, Object> callbackParameters = AdjustUtil.toMap(mapEvent.getMap("callbackParameters"));
276-
final Map<String, Object> partnerParameters = AdjustUtil.toMap(mapEvent.getMap("partnerParameters"));
276+
final Map<String, Object> callbackParameters = AdjustUtil.toMap(mapEvent.getMap("callbackParameters"));
277+
final Map<String, Object> partnerParameters = AdjustUtil.toMap(mapEvent.getMap("partnerParameters"));
277278

278279
AdjustEvent event = new AdjustEvent(eventToken);
279-
280280
if (event.isValid()) {
281+
// Revenue
281282
if (!mapEvent.isNull("revenue")) {
282283
event.setRevenue(mapEvent.getDouble("revenue"), currency);
283284
}
284285

286+
// Callback parameters
285287
if (null != callbackParameters) {
286288
for (Map.Entry<String, Object> entry : callbackParameters.entrySet()) {
287289
event.addCallbackParameter(entry.getKey(), entry.getValue().toString());
288290
}
289291
}
290292

293+
// Partner parameters
291294
if (null != partnerParameters) {
292295
for (Map.Entry<String, Object> entry : partnerParameters.entrySet()) {
293296
event.addPartnerParameter(entry.getKey(), entry.getValue().toString());
294297
}
295298
}
296299

300+
// Revenue deduplication
297301
if (null != transactionId) {
298302
event.setOrderId(transactionId);
299303
}
@@ -330,7 +334,7 @@ public void setPushToken(String token) {
330334
@ReactMethod
331335
public void appWillOpenUrl(String strUri) {
332336
final Uri uri = Uri.parse(strUri);
333-
com.adjust.sdk.Adjust.appWillOpenUrl(uri);
337+
com.adjust.sdk.Adjust.appWillOpenUrl(uri, getReactApplicationContext());
334338
}
335339

336340
@ReactMethod
@@ -433,6 +437,103 @@ public void setDeferredDeeplinkCallbackListener() {
433437
this.deferredDeeplinkCallback = true;
434438
}
435439

440+
@ReactMethod
441+
public void teardown() {
442+
this.attributionCallback = false;
443+
this.eventTrackingSucceededCallback = false;
444+
this.eventTrackingFailedCallback = false;
445+
this.sessionTrackingSucceededCallback = false;
446+
this.sessionTrackingFailedCallback = false;
447+
this.deferredDeeplinkCallback = false;
448+
}
449+
450+
@ReactMethod
451+
public void setTestOptions(ReadableMap map) {
452+
final AdjustTestOptions testOptions = new AdjustTestOptions();
453+
if (!map.isNull("hasContext")) {
454+
boolean value = map.getBoolean("hasContext");
455+
if (value) {
456+
testOptions.context = getReactApplicationContext();
457+
}
458+
}
459+
if (!map.isNull("baseUrl")) {
460+
String value = map.getString("baseUrl");
461+
testOptions.baseUrl = value;
462+
}
463+
if (!map.isNull("gdprUrl")) {
464+
String value = map.getString("gdprUrl");
465+
testOptions.gdprUrl = value;
466+
}
467+
if (!map.isNull("basePath")) {
468+
String value = map.getString("basePath");
469+
testOptions.basePath = value;
470+
}
471+
if (!map.isNull("gdprPath")) {
472+
String value = map.getString("gdprPath");
473+
testOptions.gdprPath = value;
474+
}
475+
if (!map.isNull("useTestConnectionOptions")) {
476+
boolean value = map.getBoolean("useTestConnectionOptions");
477+
testOptions.useTestConnectionOptions = value;
478+
}
479+
if (!map.isNull("timerIntervalInMilliseconds")) {
480+
try {
481+
Long value = Long.parseLong(map.getString("timerIntervalInMilliseconds"));
482+
testOptions.timerIntervalInMilliseconds = value;
483+
} catch (NumberFormatException ex) {
484+
ex.printStackTrace();
485+
Log.d(TAG, "Can't format number");
486+
}
487+
}
488+
if (!map.isNull("timerStartInMilliseconds")) {
489+
try {
490+
Long value = Long.parseLong(map.getString("timerStartInMilliseconds"));
491+
testOptions.timerStartInMilliseconds = value;
492+
} catch (NumberFormatException ex) {
493+
ex.printStackTrace();
494+
Log.d(TAG, "Can't format number");
495+
}
496+
}
497+
if (!map.isNull("sessionIntervalInMilliseconds")) {
498+
try {
499+
Long value = Long.parseLong(map.getString("sessionIntervalInMilliseconds"));
500+
testOptions.sessionIntervalInMilliseconds = value;
501+
} catch (NumberFormatException ex) {
502+
ex.printStackTrace();
503+
Log.d(TAG, "Can't format number");
504+
}
505+
}
506+
if (!map.isNull("subsessionIntervalInMilliseconds")) {
507+
try {
508+
Long value = Long.parseLong(map.getString("subsessionIntervalInMilliseconds"));
509+
testOptions.subsessionIntervalInMilliseconds = value;
510+
} catch (NumberFormatException ex) {
511+
ex.printStackTrace();
512+
Log.d(TAG, "Can't format number");
513+
}
514+
}
515+
if (!map.isNull("noBackoffWait")) {
516+
boolean value = map.getBoolean("noBackoffWait");
517+
testOptions.noBackoffWait = value;
518+
}
519+
if (!map.isNull("teardown")) {
520+
boolean value = map.getBoolean("teardown");
521+
testOptions.teardown = value;
522+
}
523+
524+
com.adjust.sdk.Adjust.setTestOptions(testOptions);
525+
}
526+
527+
@ReactMethod
528+
public void onResume() {
529+
com.adjust.sdk.Adjust.onResume();
530+
}
531+
532+
@ReactMethod
533+
public void onPause() {
534+
com.adjust.sdk.Adjust.onPause();
535+
}
536+
436537
private void sendEvent(ReactContext reactContext, String eventName, @Nullable WritableMap params) {
437538
reactContext
438539
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)

android/src/main/java/com/adjust/sdk/AdjustPackage.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
// AdjustPackage.java
33
// Adjust SDK
44
//
5-
// Created by Abdullah Obaied (@obaied) on 19th Octover 2016.
6-
// Copyright (c) 2016-2018 Adjust GmbH. All rights reserved.
5+
// Created by Abdullah Obaied on 2016-10-19.
6+
// Copyright (c) 2018 adjust GmbH. All rights reserved.
7+
// See the file MIT-LICENSE for copying permission.
78
//
89

910
package com.adjust.nativemodule;

android/src/main/java/com/adjust/sdk/AdjustUtil.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
//
22
// AdjustUtil.java
3-
// Adjust SDK
3+
// Adjust
44
//
5-
// Created by Abdullah Obaied (@obaied) on 19th Octover 2016.
6-
// Copyright (c) 2016-2018 Adjust GmbH. All rights reserved.
5+
// Created by Abdullah Obaied on 2016-10-19.
6+
// Copyright (c) 2018 adjust GmbH. All rights reserved.
7+
// See the file MIT-LICENSE for copying permission.
78
//
89

910
package com.adjust.nativemodule;

0 commit comments

Comments
 (0)