Skip to content

Commit

Permalink
Merge pull request #121 from adjust/v4122
Browse files Browse the repository at this point in the history
Version 4.12.2
  • Loading branch information
uerceg authored Feb 9, 2018
2 parents b09e83f + a0de967 commit c6beb30
Show file tree
Hide file tree
Showing 8 changed files with 489 additions and 346 deletions.
675 changes: 393 additions & 282 deletions Assets/Adjust/Adjust.cs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Assets/Adjust/Android/AdjustAndroid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace com.adjust.sdk
#if UNITY_ANDROID
public class AdjustAndroid
{
private const string sdkPrefix = "unity4.12.1";
private const string sdkPrefix = "unity4.12.2";

private static bool launchDeferredDeeplink = true;

Expand Down
2 changes: 1 addition & 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.12.1";
private const string sdkPrefix = "unity4.12.2";
private static bool appLaunched = false;

public static void Start(AdjustConfig adjustConfig)
Expand Down
116 changes: 68 additions & 48 deletions Assets/Adjust/iOS/AdjustUnity.mm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ - (id)init {
@end

// Method for converting JSON stirng parameters into NSArray object.
NSArray* ConvertArrayParameters(const char* cStringJsonArrayParameters) {
NSArray* convertArrayParameters(const char* cStringJsonArrayParameters) {
if (cStringJsonArrayParameters == NULL) {
return nil;
}
Expand All @@ -36,6 +36,23 @@ - (id)init {
return arrayParameters;
}

BOOL isStringValid(const char* cString) {
if (cString == NULL) {
return false;
}

NSString *objcString = [NSString stringWithUTF8String:cString];
if (objcString == nil) {
return false;
}

if ([objcString isEqualToString:@"ADJ_INVALID"]) {
return false;
}

return true;
}

extern "C"
{
void addValueOrEmpty(NSMutableDictionary *dictionary, NSString *key, NSObject *value) {
Expand All @@ -46,37 +63,36 @@ void addValueOrEmpty(NSMutableDictionary *dictionary, NSString *key, NSObject *v
}
}

void _AdjustLaunchApp(
const char* appToken,
const char* environment,
const char* sdkPrefix,
int allowSuppressLogLevel,
int logLevel,
int isDeviceKnown,
int eventBuffering,
int sendInBackground,
long secretId,
long info1,
long info2,
long info3,
long info4,
double delayStart,
const char* userAgent,
const char* defaultTracker,
int launchDeferredDeeplink,
const char* sceneName,
int isAttributionCallbackImplemented,
int isEventSuccessCallbackImplemented,
int isEventFailureCallbackImplemented,
int isSessionSuccessCallbackImplemented,
int isSessionFailureCallbackImplemented,
int isDeferredDeeplinkCallbackImplemented) {
NSString *stringSdkPrefix = [NSString stringWithUTF8String:sdkPrefix];
NSString *stringAppToken = [NSString stringWithUTF8String:appToken];
NSString *stringEnvironment = [NSString stringWithUTF8String:environment];
NSString *stringUserAgent = [NSString stringWithUTF8String:userAgent];
NSString *stringDefaultTracker = [NSString stringWithUTF8String:defaultTracker];
NSString *stringSceneName = [NSString stringWithUTF8String:sceneName];
void _AdjustLaunchApp(const char* appToken,
const char* environment,
const char* sdkPrefix,
const char* userAgent,
const char* defaultTracker,
const char* sceneName,
int allowSuppressLogLevel,
int logLevel,
int isDeviceKnown,
int eventBuffering,
int sendInBackground,
long secretId,
long info1,
long info2,
long info3,
long info4,
double delayStart,
int launchDeferredDeeplink,
int isAttributionCallbackImplemented,
int isEventSuccessCallbackImplemented,
int isEventFailureCallbackImplemented,
int isSessionSuccessCallbackImplemented,
int isSessionFailureCallbackImplemented,
int isDeferredDeeplinkCallbackImplemented) {
NSString *stringAppToken = isStringValid(appToken) == true ? [NSString stringWithUTF8String:appToken] : nil;
NSString *stringEnvironment = isStringValid(environment) == true ? [NSString stringWithUTF8String:environment] : nil;
NSString *stringSdkPrefix = isStringValid(sdkPrefix) == true ? [NSString stringWithUTF8String:sdkPrefix] : nil;
NSString *stringUserAgent = isStringValid(userAgent) == true ? [NSString stringWithUTF8String:userAgent] : nil;
NSString *stringDefaultTracker = isStringValid(defaultTracker) == true ? [NSString stringWithUTF8String:defaultTracker] : nil;
NSString *stringSceneName = isStringValid(sceneName) == true ? [NSString stringWithUTF8String:sceneName] : nil;

ADJConfig *adjustConfig;

Expand All @@ -92,9 +108,12 @@ void _AdjustLaunchApp(
[adjustConfig setSdkPrefix:stringSdkPrefix];

// Attribution delegate & other delegates
if (isAttributionCallbackImplemented || isEventSuccessCallbackImplemented ||
isEventFailureCallbackImplemented || isSessionSuccessCallbackImplemented ||
isSessionFailureCallbackImplemented || isDeferredDeeplinkCallbackImplemented) {
if (isAttributionCallbackImplemented
|| isEventSuccessCallbackImplemented
|| isEventFailureCallbackImplemented
|| isSessionSuccessCallbackImplemented
|| isSessionFailureCallbackImplemented
|| isDeferredDeeplinkCallbackImplemented) {
[adjustConfig setDelegate:
[AdjustUnityDelegate getInstanceWithSwizzleOfAttributionCallback:isAttributionCallbackImplemented
eventSucceededCallback:isEventSuccessCallbackImplemented
Expand Down Expand Up @@ -127,16 +146,12 @@ void _AdjustLaunchApp(
[adjustConfig setDelayStart:delayStart];
}

if (stringUserAgent != NULL) {
if ([stringUserAgent length] > 0) {
[adjustConfig setUserAgent:stringUserAgent];
}
if (stringUserAgent != nil) {
[adjustConfig setUserAgent:stringUserAgent];
}

if (stringDefaultTracker != NULL) {
if ([stringDefaultTracker length] > 0) {
[adjustConfig setDefaultTracker:stringDefaultTracker];
}
if (stringDefaultTracker != nil) {
[adjustConfig setDefaultTracker:stringDefaultTracker];
}

if (secretId != -1 && info1 != -1 && info2 != -1 && info3 != -1 && info4 != 1) {
Expand All @@ -145,12 +160,17 @@ void _AdjustLaunchApp(

// Launch adjust instance.
[Adjust appDidLaunch:adjustConfig];

// Since v4.7.0 session is not automatically started after calling appDidLaunch, thus calling trackSubsessionStart.
[Adjust trackSubsessionStart];
}

void _AdjustTrackEvent(const char* eventToken, double revenue, const char* currency, const char* receipt, const char* transactionId, int isReceiptSet, const char* jsonCallbackParameters, const char* jsonPartnerParameters) {
void _AdjustTrackEvent(const char* eventToken,
double revenue,
const char* currency,
const char* receipt,
const char* transactionId,
int isReceiptSet,
const char* jsonCallbackParameters,
const char* jsonPartnerParameters) {
NSString *stringEventToken = [NSString stringWithUTF8String:eventToken];

ADJEvent *event = [ADJEvent eventWithEventToken:stringEventToken];
Expand All @@ -161,7 +181,7 @@ void _AdjustTrackEvent(const char* eventToken, double revenue, const char* curre
[event setRevenue:revenue currency:stringCurrency];
}

NSArray *arrayCallbackParameters = ConvertArrayParameters(jsonCallbackParameters);
NSArray *arrayCallbackParameters = convertArrayParameters(jsonCallbackParameters);

if (arrayCallbackParameters != nil) {
NSUInteger count = [arrayCallbackParameters count];
Expand All @@ -177,7 +197,7 @@ void _AdjustTrackEvent(const char* eventToken, double revenue, const char* curre
}
}

NSArray *arrayPartnerParameters = ConvertArrayParameters(jsonPartnerParameters);
NSArray *arrayPartnerParameters = convertArrayParameters(jsonPartnerParameters);

if (arrayPartnerParameters != nil) {
NSUInteger count = [arrayPartnerParameters count];
Expand Down
22 changes: 11 additions & 11 deletions Assets/Adjust/iOS/AdjustiOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ namespace com.adjust.sdk
#if UNITY_IOS
public class AdjustiOS
{
private const string sdkPrefix = "unity4.12.1";
private const string sdkPrefix = "unity4.12.2";

[DllImport("__Internal")]
private static extern void _AdjustLaunchApp(
string appToken,
string environment,
string sdkPrefix,
string userAgent,
string defaultTracker,
string sceneName,
int allowSuppressLogLevel,
int logLevel,
int isDeviceKnown,
Expand All @@ -27,10 +30,7 @@ private static extern void _AdjustLaunchApp(
long info3,
long info4,
double delayStart,
string userAgent,
string defaultTracker,
int launchDeferredDeeplink,
string sceneName,
int isAttributionCallbackImplemented,
int isEventSuccessCallbackImplemented,
int isEventFailureCallbackImplemented,
Expand Down Expand Up @@ -98,10 +98,10 @@ public AdjustiOS() {}

public static void Start(AdjustConfig adjustConfig)
{
string appToken = adjustConfig.appToken;
string sceneName = adjustConfig.sceneName;
string userAgent = adjustConfig.userAgent != null ? adjustConfig.userAgent : String.Empty;
string defaultTracker = adjustConfig.defaultTracker != null ? adjustConfig.defaultTracker : String.Empty;
string appToken = adjustConfig.appToken != null ? adjustConfig.appToken : "ADJ_INVALID";
string sceneName = adjustConfig.sceneName != null ? adjustConfig.sceneName : "ADJ_INVALID";
string userAgent = adjustConfig.userAgent != null ? adjustConfig.userAgent : "ADJ_INVALID";
string defaultTracker = adjustConfig.defaultTracker != null ? adjustConfig.defaultTracker : "ADJ_INVALID";
string environment = adjustConfig.environment.ToLowercaseString();

long info1 = AdjustUtils.ConvertLong(adjustConfig.info1);
Expand Down Expand Up @@ -130,6 +130,9 @@ public static void Start(AdjustConfig adjustConfig)
appToken,
environment,
sdkPrefix,
userAgent,
defaultTracker,
sceneName,
allowSuppressLogLevel,
logLevel,
isDeviceKnown,
Expand All @@ -141,10 +144,7 @@ public static void Start(AdjustConfig adjustConfig)
info3,
info4,
delayStart,
userAgent,
defaultTracker,
launchDeferredDeeplink,
sceneName,
isAttributionCallbackImplemented,
isEventSuccessCallbackImplemented,
isEventFailureCallbackImplemented,
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
### Version 4.12.2 (9th February 2018)
#### Fixed
- Fixed Adjust SDK behaviour once tried to be run in `Editor` - no errors displayed anymore.
- Fixed random crashes on iOS 10.1.x devices when trying to initialise SDK.

#### Native SDKs
- [[email protected]][ios_sdk_v4.12.1]
- [[email protected]][android_sdk_v4.12.1]
- [[email protected]][windows_sdk_v4.12.0]

---

### Version 4.12.1 (1st February 2018)
#### Native changes
- https://github.com/adjust/android_sdk/blob/master/CHANGELOG.md#version-4121-31st-january-2018
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.12.1
4.12.2
4 changes: 2 additions & 2 deletions doc/migrate.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Migrate your Adjust SDK for Unity3d to 4.12.1 from 3.4.4
## Migrate your Adjust SDK for Unity3d to 4.12.2 from 3.4.4

### Migration procedure

Expand All @@ -9,7 +9,7 @@ keeping in `Assets/Plugins` folder.

For migration purposes, we have prepared the Adjust SDK uninstall script written in Python (`adjust_uninstall.py`).

Migration to version 4.12.1 of our SDK requires the following steps:
Migration to version 4.12.2 of our SDK requires the following steps:

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

0 comments on commit c6beb30

Please sign in to comment.