diff --git a/CHANGELOG.md b/CHANGELOG.md
index 612bb843..baf3f575 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,24 @@
+### Version 4.29.0 (14th September 2021)
+#### Added
+- Added possibility to get cost data information in attribution callback.
+- Added `setNeedsCost` method to `AdjustConfig2dx` to indicate if cost data is needed in attribution callback (by default cost data will not be part of attribution callback if not enabled with this setter method).
+- Added `setPreinstallTrackingEnabled` method to `AdjustConfig2dx` to allow enabling of preinstall tracking (this feature is OFF by default).
+- Added support for Apple Search Ads attribution with usage of `AdServices.framework`.
+- Added `setAllowAdServicesInfoReading` method to `AdjustConfig2dx` to allow option for users to prevent SDK from performing any tasks related to Apple Search Ads attribution with usage of `AdServices.framework`.
+- Added `setAllowiAdInfoReading` method to `AdjustConfig2dx` to allow option for users to prevent SDK from performing any tasks related to Apple Search Ads attribution with usage of `iAd.framework`.
+- Added wrapper method `updateConversionValue` method to `Adjust2dx` to allow updating SKAdNetwork conversion value via SDK API.
+- Added `getAppTrackingAuthorizationStatus` getter to `Adjust2dx` instance to be able to get current iOS app tracking status.
+- Added improved measurement consent management and third party sharing mechanism.
+- Added data residency feature. You can choose this setting by calling `setUrlStrategy` method of `AdjustConfig2dx` instance with `AdjustDataResidencyEU` (for EU data residency region), `AdjustDataResidencyTR` (for TR data residency region) or `AdjustDataResidencyUS` value (for US data residency region).
+- Added `setConversionValueUpdatedCallback` method to `AdjustConfig2dx` which can be used to set a callback which will get information when Adjust SDK updates conversion value for the user.
+- Added preinstall tracking with usage of system installer receiver on Android platform (`setPreinstallFilePath` method of the `AdjustConfig2dx`).
+
+#### Native SDKs
+- [iOS@v4.29.6][ios_sdk_v4.29.6]
+- [Android@v4.28.4][android_sdk_v4.28.4]
+
+---
+
### Version 4.28.0 (3rd April 2021)
#### Changed
- Removed native iOS legacy code.
@@ -348,6 +369,8 @@
[ios_sdk_v4.22.1]: https://github.com/adjust/ios_sdk/tree/v4.22.1
[ios_sdk_v4.23.0]: https://github.com/adjust/ios_sdk/tree/v4.23.0
[ios_sdk_v4.23.2]: https://github.com/adjust/ios_sdk/tree/v4.23.2
+[ios_sdk_v4.28.0]: https://github.com/adjust/ios_sdk/tree/v4.28.0
+[ios_sdk_v4.29.6]: https://github.com/adjust/ios_sdk/tree/v4.29.6
[android_sdk_v4.0.8]: https://github.com/adjust/android_sdk/tree/v4.0.8
[android_sdk_v4.1.0]: https://github.com/adjust/android_sdk/tree/v4.1.0
@@ -368,5 +391,7 @@
[android_sdk_v4.22.0]: https://github.com/adjust/android_sdk/tree/v4.22.0
[android_sdk_v4.24.0]: https://github.com/adjust/android_sdk/tree/v4.24.0
[android_sdk_v4.24.1]: https://github.com/adjust/android_sdk/tree/v4.24.1
+[android_sdk_v4.27.0]: https://github.com/adjust/android_sdk/tree/v4.27.0
+[android_sdk_v4.28.4]: https://github.com/adjust/android_sdk/tree/v4.28.4
[windows_sdk_v4.0.3]: https://github.com/adjust/windows_sdk/tree/v4.0.3
diff --git a/README.md b/README.md
index b4d33261..e19dd802 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,10 @@ This is the Cocos2d-x SDK of Adjust™. You can read more about Adjust™ at [Ad
* [Additional features](#additional-features)
* [AppTrackingTransparency framework](#att-framework)
* [App-tracking authorisation wrapper](#ata-wrapper)
+ * [Get current authorisation status](#ata-getter)
* [SKAdNetwork framework](#skadn-framework)
+ * [Update SKAdNetwork conversion value](#skadn-update-conversion-value)
+ * [Conversion value updated callback](#skadn-cv-updated-callback)
* [Event tracking](#event-tracking)
* [Revenue tracking](#revenue-tracking)
* [Revenue deduplication](#revenue-deduplication)
@@ -51,6 +54,7 @@ This is the Cocos2d-x SDK of Adjust™. You can read more about Adjust™ at [Ad
* [Google Play Services advertising identifier](#di-gps-adid)
* [Amazon advertising identifier](#di-fire-adid)
* [Adjust device identifier](#di-adid)
+ * [Set external device ID](#set-external-device-id)
* [User attribution](#user-attribution)
* [Push token](#push-token)
* [Pre-installed trackers](#pre-installed-trackers)
@@ -59,6 +63,7 @@ This is the Cocos2d-x SDK of Adjust™. You can read more about Adjust™ at [Ad
* [Deferred deep linking](#deeplinking-deferred)
* [Deep link handling for iOS apps](#deeplinking-ios)
* [Deep link handling for Android apps](#deeplinking-android)
+ * [Data residency](#data-residency)
* [License](#license)
## Basic integration
@@ -86,7 +91,8 @@ $(LOCAL_PATH)/../../../Classes/Adjust/AdjustEventSuccess2dx.cpp \
$(LOCAL_PATH)/../../../Classes/Adjust/AdjustSessionFailure2dx.cpp \
$(LOCAL_PATH)/../../../Classes/Adjust/AdjustSessionSuccess2dx.cpp \
$(LOCAL_PATH)/../../../Classes/Adjust/AdjustAppStoreSubscription2dx.cpp \
-$(LOCAL_PATH)/../../../Classes/Adjust/AdjustPlayStoreSubscription2dx.cpp
+$(LOCAL_PATH)/../../../Classes/Adjust/AdjustPlayStoreSubscription2dx.cpp \
+$(LOCAL_PATH)/../../../Classes/Adjust/AdjustThirdPartySharing2dx.cpp
```
### Adjust project settings
@@ -146,7 +152,7 @@ After this, open the `AndroidManifest.xml` file of your Android project and add
If you are using Proguard, add these lines to your Proguard file:
```
--keep public class com.adjust.sdk.** { *; }
+-keep class com.adjust.sdk.** { *; }
-keep class com.google.android.gms.common.ConnectionResult {
int SUCCESS;
}
@@ -171,7 +177,7 @@ In order to correctly attribute an install of your Android app to its source, Ad
In order to support this in your app, please make sure to add following dependency to your `build.gradle` file:
```
-implementation 'com.android.installreferrer:installreferrer:1.0'
+implementation 'com.android.installreferrer:installreferrer:2.2'
```
Also, make sure that you have paid attention to the [Proguard settings](#android-proguard) chapter and that you have added all the rules mentioned in it, especially the one needed for this feature:
@@ -210,16 +216,13 @@ As of v4.22.0, the Adjust SDK supports install tracking on Huawei devices with H
### [iOS] Frameworks
-You need to add following frameworks to your app's Xcode project:
+Select your project in the Project Navigator. In the left hand side of the main view, select your target. In the tab `Build Phases`, expand the group `Link Binary with Libraries`. On the bottom of that section click on the `+` button. Select below mentined frameworks and make sure to change the `Status` of frameworks to `Optional`. Adjust SDK uses these frameworks with following purpose:
-* `iAd.framework` - in case you are running iAd campaigns
-* `AdSupport.framework` - for reading iOS Advertising Id (IDFA)
-* `CoreTelephony.framework` - for reading MCC and MNC information
-* `StoreKit.framework` - for communication with SKAdNetwork framework
+* `iAd.framework` - to support Apple Search Ads campaigns
+* `AdServices.framework` - to support Apple Search Ads campaigns
+* `AdSupport.framework` - to read iOS Advertising Id (IDFA) value
+* `StoreKit.framework` - to communicate with `SKAdNetwork` framework
* `AppTrackingTransparency.framework` - to ask for user's consent to be tracked and obtain status of that consent
-* `AdjustSdk.framework` - our native iOS SDK framework
-
-If you are not running any iAd campaigns, you can feel free to remove the `iAd.framework` dependency. If you don't use SKAdNetwork framework, feel free to remove `StoreKit.framework` dependency (unless you need it for something else).
### [iOS] Additional linker flags
@@ -376,6 +379,18 @@ static void authorizationStatusCallback(int status) {
Adjust2dx::requestTrackingAuthorizationWithCompletionHandler(authorizationStatusCallback);
```
+### Get current authorisation status
+
+**Note**: This feature exists only in iOS platform.
+
+To get the current app tracking authorization status you can call `getAppTrackingAuthorizationStatus` method of `Adjust2dx` class that will return one of the following possibilities:
+
+* `0`: The user hasn't been asked yet
+* `1`: The user device is restricted
+* `2`: The user denied access to IDFA
+* `3`: The user authorized access to IDFA
+* `-1`: The status is not available
+
### SKAdNetwork framework
**Note**: This feature exists only in iOS platform.
@@ -388,6 +403,47 @@ In case you don't want the Adjust SDK to automatically communicate with SKAdNetw
adjustConfig.deactivateSKAdNetworkHandling();
```
+### Update SKAdNetwork conversion value
+
+**Note**: This feature exists only in iOS platform.
+
+You can use Adjust SDK wrapper method `updateConversionValue` to update SKAdNetwork conversion value for your user:
+
+```js
+Adjust2dx::updateConversionValue(6);
+```
+
+### Conversion value updated callback
+
+**Note**: This feature exists only in iOS platform.
+
+You can register callback to get notified each time when Adjust SDK updates conversion value for the user.
+
+```cpp
+#include "Adjust/Adjust2dx.h"
+
+// ...
+
+static void conversionValueUpdatedCallbackMethod(int conversionValue) {
+ CCLOG("\nConversion value updated!");
+ CCLOG("\nConversion value: %d", conversionValue);
+}
+
+// ...
+
+bool AppDelegate::applicationDidFinishLaunching() {
+ std::string appToken = "{YourAppToken}";
+ std::string environment = AdjustEnvironmentSandbox2dx;
+
+ AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment);
+ adjustConfig.setLogLevel(AdjustLogLevel2dxVerbose);
+ adjustConfig.setConversionValueUpdatedCallback(conversionValueUpdatedCallbackMethod);
+ Adjust2dx::start(adjustConfig);
+
+ // ...
+}
+```
+
### Event tracking
With Adjust, you can track any event that you want.
@@ -668,6 +724,9 @@ The callback function will be called when the SDK receives the final attribution
- `std::string creative` the creative grouping level of the current attribution.
- `std::string clickLabel` the click label of the current attribution.
- `std::string adid` the Adjust device identifier.
+- `std::string costType` the cost type.
+- `double costAmount` the cost amount.
+- `std::string costCurrency` the cost currency.
```cpp
#include "Adjust/Adjust2dx.h"
@@ -685,6 +744,9 @@ static void attributionCallbackMethod(AdjustAttribution2dx attribution) {
CCLOG("\nCreative: %s", attribution.getCreative().c_str());
CCLOG("\nClick label: %s", attribution.getClickLabel().c_str());
CCLOG("\nAdid: %s", attribution.getAdid().c_str());
+ CCLOG("\nCost type: %s", attribution.getCostType().c_str());
+ CCLOG("\nCost amount: %f", attribution.getCostAmount());
+ CCLOG("\nCost currency: %s", attribution.getCostCurrency().c_str());
CCLOG("\n");
}
@@ -705,6 +767,8 @@ bool AppDelegate::applicationDidFinishLaunching() {
Please make sure to consider the [applicable attribution data policies][attribution-data].
+**Note**: The cost data - `costType`, `costAmount` & `costCurrency` are only available when configured in `AdjustConfig2dx` by calling `setNeedsCost` method. If not configured or configured, but not being part of the attribution, string fields will have value `null` and double field will be 0. This feature is available in SDK v4.29.0 and above.
+
### Session and event callbacks
You can register a callback to be notified of successfully tracked, as well as failed, events and/or sessions.
@@ -1005,6 +1069,32 @@ std::string adid = Adjust2dx::getAdid();
**Note**: Information about the **adid** is only available after the Adjust backed has tracked your app's installation. From that moment on, the Adjust SDK has information about the device **adid** and you can access it with this method. So, **it is not possible** to access the **adid** before the SDK has been initialized and the installation of your app has been tracked successfully.
+### Set external device ID
+
+> **Note** If you want to use external device IDs, please contact your Adjust representative. They will talk you through the best approach for your use case.
+
+An external device identifier is a custom value that you can assign to a device or user. They can help you to recognize users across sessions and platforms. They can also help you to deduplicate installs by user so that a user isn't counted as multiple new installs.
+
+You can also use an external device ID as a custom identifier for a device. This can be useful if you use these identifiers elsewhere and want to keep continuity.
+
+Check out our [external device identifiers article](https://help.adjust.com/en/article/external-device-identifiers) for more information.
+
+> **Note** This setting requires Adjust SDK v4.22.0 or later.
+
+To set an external device ID, assign the identifier to the `externalDeviceId` property of your config instance. Do this before you initialize the Adjust SDK.
+
+```cpp
+AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment);
+adjustConfig.setExternalDeviceId("{Your-External-Device-Id}");
+Adjust2dx::adjustConfig(config);
+```
+
+> **Important**: You need to make sure this ID is **unique to the user or device** depending on your use-case. Using the same ID across different users or devices could lead to duplicated data. Talk to your Adjust representative for more information.
+
+If you want to use the external device ID in your business analytics, you can pass it as a session callback parameter. See the section on [session callback parameters](#session-callback-parameters) for more information.
+
+You can import existing external device IDs into Adjust. This ensures that the backend matches future data to your existing device records. If you want to do this, please contact your Adjust representative.
+
### User attribution
Attribution callbacks are triggered via the method described in the [attribution callback section](#attribution-callback). They provide you with information about any changes to your users’ attribution values. If you wish to access information about a user's current attribution value at any other time, you can make a call to the following method of the `Adjust2dx` instance:
@@ -1110,6 +1200,16 @@ To set up your iOS app to handle deep linking at a native level, please follow o
To set up your Android app to handle deep linking at a native level, please follow our [guide][android-deeplinking] in the official Android SDK README.
+### Data residency
+
+In order to enable data residency feature, make sure to call `setUrlStrategy` method of the `AdjustConfig2dx` instance with one of the following constants:
+
+```js
+adjustConfig.setUrlStrategy(AdjustDataResidencyEU); // for EU data residency region
+adjustConfig.setUrlStrategy(AdjustDataResidencyTR); // for Turkey data residency region
+adjustConfig.setUrlStrategy(AdjustDataResidencyUS); // for US data residency region
+```
+
[adjust]: http://adjust.com
[dashboard]: http://adjust.com
@@ -1138,7 +1238,7 @@ To set up your Android app to handle deep linking at a native level, please foll
The Adjust SDK is licensed under the MIT License.
-Copyright (c) 2012-2019 Adjust GmbH, http://www.adjust.com
+Copyright (c) 2012-2021 Adjust GmbH, http://www.adjust.com
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
diff --git a/VERSION b/VERSION
index ad94be36..e052d560 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.28.0
+4.29.0
diff --git a/dist/ADJAdjust2dx.h b/dist/ADJAdjust2dx.h
index e7b861ab..8c53ddab 100755
--- a/dist/ADJAdjust2dx.h
+++ b/dist/ADJAdjust2dx.h
@@ -14,6 +14,7 @@
#include "ADJEvent2dx.h"
#include "ADJConfig2dx.h"
#include "ADJAppStoreSubscription2dx.h"
+#include "ADJThirdPartySharing2dx.h"
#include "AdjustAttribution2dx.h"
extern const std::string ADJEnvironmentSandbox2dx;
@@ -46,6 +47,10 @@ class ADJAdjust2dx {
static std::string getSdkVersion();
static AdjustAttribution2dx getAttribution();
static void requestTrackingAuthorizationWithCompletionHandler(void (*trackingStatusCallback)(int status));
+ static int getAppTrackingAuthorizationStatus();
+ static void trackThirdPartySharing(ADJThirdPartySharing2dx thirdPartySharing);
+ static void trackMeasurementConsent(bool measurementConsent);
+ static void updateConversionValue(int conversionValue);
// For testing purposes only.
static void setTestOptions(std::map testOptionsMap);
static void teardown();
diff --git a/dist/ADJAdjust2dx.mm b/dist/ADJAdjust2dx.mm
index 790377ce..a6ae7b92 100755
--- a/dist/ADJAdjust2dx.mm
+++ b/dist/ADJAdjust2dx.mm
@@ -20,25 +20,29 @@
BOOL isSessionSuccessCallbackImplemented = NULL != adjustConfig.getSessionSuccessCallback() ? YES : NO;
BOOL isSessionFailureCallbackImplemented = NULL != adjustConfig.getSessionFailureCallback() ? YES : NO;
BOOL isDeferredDeeplinkCallbackImplemented = NULL != adjustConfig.getDeferredDeeplinkCallback() ? YES : NO;
+ BOOL isConversionValueUpdatedListenerImplemented = NULL != adjustConfig.getConversionValueUpdatedCallback() ? YES : NO;
if (isAttributionCallbackImplemented
|| isEventSuccessCallbackImplemented
|| isEventFailureCallbackImplemented
|| isSessionSuccessCallbackImplemented
|| isSessionFailureCallbackImplemented
- || isDeferredDeeplinkCallbackImplemented) {
+ || isDeferredDeeplinkCallbackImplemented
+ || isConversionValueUpdatedListenerImplemented) {
((ADJConfig *)adjustConfig.getConfig()).delegate = [ADJDelegate2dx getInstanceWithSwizzleOfAttributionCallback:isAttributionCallbackImplemented
swizzleOfEventSuccessCallback:isEventSuccessCallbackImplemented
swizzleOfEventFailureCallback:isEventFailureCallbackImplemented
swizzleOfSessionSuccessCallback:isSessionSuccessCallbackImplemented
swizzleOfSessionFailureCallback:isSessionFailureCallbackImplemented
swizzleOfDeferredDeeplinkCallback:isDeferredDeeplinkCallbackImplemented
+ swizzleOfConversionValueUpdatedCallback:isConversionValueUpdatedListenerImplemented
andAttributionCallbackId:adjustConfig.getAttributionCallback()
eventSuccessCallbackId:adjustConfig.getEventSuccessCallback()
eventFailureCallbackId:adjustConfig.getEventFailureCallback()
sessionSuccessCallbackId:adjustConfig.getSessionSuccessCallback()
sessionFailureCallbackId:adjustConfig.getSessionFailureCallback()
- deferredDeeplinkCallbackId:adjustConfig.getDeferredDeeplinkCallback()];
+ deferredDeeplinkCallbackId:adjustConfig.getDeferredDeeplinkCallback()
+ conversionValueUpdatedCallbackId:adjustConfig.getConversionValueUpdatedCallback()];
}
[Adjust appDidLaunch:(ADJConfig *)adjustConfig.getConfig()];
@@ -160,6 +164,9 @@
std::string creative;
std::string clickLabel;
std::string adid;
+ std::string costType;
+ double costAmount;
+ std::string costCurrency;
if (nil != attribution) {
if (attribution.trackerToken != NULL) {
@@ -186,9 +193,29 @@
if (attribution.adid != NULL) {
adid = std::string([attribution.adid UTF8String]);
}
+ if (attribution.costType != NULL) {
+ costType = std::string([attribution.costType UTF8String]);
+ }
+ if (attribution.costType != NULL) {
+ costAmount = [attribution.costAmount doubleValue];
+ }
+ if (attribution.costCurrency != NULL) {
+ costCurrency = std::string([attribution.costCurrency UTF8String]);
+ }
}
- AdjustAttribution2dx attribution2dx = AdjustAttribution2dx(trackerToken, trackerName, network, campaign, adgroup, creative, clickLabel, adid);
+ AdjustAttribution2dx attribution2dx = AdjustAttribution2dx(
+ trackerToken,
+ trackerName,
+ network,
+ campaign,
+ adgroup,
+ creative,
+ clickLabel,
+ adid,
+ costType,
+ costAmount,
+ costCurrency);
return attribution2dx;
}
@@ -198,6 +225,22 @@
}];
}
+int ADJAdjust2dx::getAppTrackingAuthorizationStatus() {
+ return [Adjust appTrackingAuthorizationStatus];
+}
+
+void ADJAdjust2dx::updateConversionValue(int conversionValue) {
+ [Adjust updateConversionValue:conversionValue];
+}
+
+void ADJAdjust2dx::trackThirdPartySharing(ADJThirdPartySharing2dx thirdPartySharing) {
+ [Adjust trackThirdPartySharing:(ADJThirdPartySharing *)thirdPartySharing.getThirdPartySharing()];
+}
+
+void ADJAdjust2dx::trackMeasurementConsent(bool measurementConsent) {
+ [Adjust trackMeasurementConsent:measurementConsent];
+}
+
void ADJAdjust2dx::setTestOptions(std::map testOptionsMap) {
AdjustTestOptions *testOptions = [[AdjustTestOptions alloc] init];
testOptions.baseUrl = [NSString stringWithUTF8String:testOptionsMap["baseUrl"].c_str()];
@@ -251,6 +294,13 @@
testOptions.iAdFrameworkEnabled = YES;
}
}
+ testOptions.adServicesFrameworkEnabled = NO;
+ if (testOptionsMap.find("adServicesFrameworkEnabled") != testOptionsMap.end()) {
+ NSString *adServicesFrameworkEnabled = [NSString stringWithUTF8String:testOptionsMap["adServicesFrameworkEnabled"].c_str()];
+ if ([adServicesFrameworkEnabled isEqualToString:@"true"]) {
+ testOptions.adServicesFrameworkEnabled = YES;
+ }
+ }
[Adjust setTestOptions:testOptions];
}
diff --git a/dist/ADJConfig2dx.h b/dist/ADJConfig2dx.h
index 959aed4f..7f93981f 100755
--- a/dist/ADJConfig2dx.h
+++ b/dist/ADJConfig2dx.h
@@ -23,7 +23,8 @@ enum ADJLogLevel2dx {
ADJLogLevel2dxWarn = 4,
ADJLogLevel2dxError = 5,
ADJLogLevel2dxAssert = 6,
- ADJLogLevel2dxSuppress = 7 };
+ ADJLogLevel2dxSuppress = 7
+};
class ADJConfig2dx {
private:
@@ -34,6 +35,7 @@ class ADJConfig2dx {
void (*sessionSuccessCallback)(AdjustSessionSuccess2dx sessionSuccess) = NULL;
void (*sessionFailureCallback)(AdjustSessionFailure2dx sessionFailure) = NULL;
bool (*deferredDeeplinkCallback)(std::string deeplink) = NULL;
+ void (*conversionValueUpdatedCallback)(int conversionValue) = NULL;
void initConfig(std::string appToken, std::string environment, bool allowSuppressLogLevel, std::string sdkPrefix);
public:
@@ -51,19 +53,22 @@ class ADJConfig2dx {
void setEventBufferingEnabled(bool isEnabled);
void setAllowIdfaReading(bool isAllowed);
void setAllowiAdInfoReading(bool isAllowed);
+ void setAllowAdServicesInfoReading(bool isAllowed);
+ void setNeedsCost(bool needsCost);
void setUserAgent(std::string userAgent);
void setDefaultTracker(std::string defaultTracker);
void setExternalDeviceId(std::string externalDeviceId);
void setAppSecret(long secretId, long info1, long info2, long info3, long info4);
void setIsDeviceKnown(bool isDeviceKnown);
void setUrlStrategy(std::string urlStrategy);
- void deactivateSKAdNetworkHandling();
+ void deactivateSkAdNetworkHandling();
void setAttributionCallback(void(*callbackMethod)(AdjustAttribution2dx attribution));
void setEventSuccessCallback(void(*callbackMethod)(AdjustEventSuccess2dx eventSuccess));
void setEventFailureCallback(void(*callbackMethod)(AdjustEventFailure2dx eventFailure));
void setSessionSuccessCallback(void(*callbackMethod)(AdjustSessionSuccess2dx sessionSuccess));
void setSessionFailureCallback(void(*callbackMethod)(AdjustSessionFailure2dx sessionFailure));
void setDeferredDeeplinkCallback(bool(*callbackMethod)(std::string deeplink));
+ void setConversionValueUpdatedCallback(void(*callbackMethod)(int conversionValue));
void* getConfig();
void(*getAttributionCallback())(AdjustAttribution2dx);
void(*getEventSuccessCallback())(AdjustEventSuccess2dx);
@@ -71,6 +76,7 @@ class ADJConfig2dx {
void(*getSessionSuccessCallback())(AdjustSessionSuccess2dx);
void(*getSessionFailureCallback())(AdjustSessionFailure2dx);
bool(*getDeferredDeeplinkCallback())(std::string);
+ void(*getConversionValueUpdatedCallback())(int);
};
#endif /* _ADJUST_ADJCONFIG2DX_H_ */
diff --git a/dist/ADJConfig2dx.mm b/dist/ADJConfig2dx.mm
index 14b2fda5..5c5fd13d 100755
--- a/dist/ADJConfig2dx.mm
+++ b/dist/ADJConfig2dx.mm
@@ -41,6 +41,14 @@
((ADJConfig *)config).allowiAdInfoReading = isAllowed;
}
+void ADJConfig2dx::setAllowAdServicesInfoReading(bool isAllowed) {
+ ((ADJConfig *)config).allowAdServicesInfoReading = isAllowed;
+}
+
+void ADJConfig2dx::setNeedsCost(bool needsCost) {
+ ((ADJConfig *)config).needsCost = needsCost;
+}
+
void ADJConfig2dx::setUserAgent(std::string userAgent) {
((ADJConfig *)config).userAgent = [NSString stringWithUTF8String:userAgent.c_str()];
}
@@ -59,10 +67,16 @@
((ADJConfig *)config).urlStrategy = ADJUrlStrategyChina;
} else if ([strUrlStrategy isEqualToString:@"india"]) {
((ADJConfig *)config).urlStrategy = ADJUrlStrategyIndia;
+ } else if ([strUrlStrategy isEqualToString:@"data-residency-eu"]) {
+ ((ADJConfig *)config).urlStrategy = ADJDataResidencyEU;
+ } else if ([strUrlStrategy isEqualToString:@"data-residency-tr"]) {
+ ((ADJConfig *)config).urlStrategy = ADJDataResidencyTR;
+ } else if ([strUrlStrategy isEqualToString:@"data-residency-us"]) {
+ ((ADJConfig *)config).urlStrategy = ADJDataResidencyUS;
}
}
-void ADJConfig2dx::deactivateSKAdNetworkHandling() {
+void ADJConfig2dx::deactivateSkAdNetworkHandling() {
[((ADJConfig *)config) deactivateSKAdNetworkHandling];
}
@@ -90,6 +104,10 @@
deferredDeeplinkCallback = callbackMethod;
}
+void ADJConfig2dx::setConversionValueUpdatedCallback(void(*callbackMethod)(int conversionValue)) {
+ conversionValueUpdatedCallback = callbackMethod;
+}
+
void* ADJConfig2dx::getConfig() {
return config;
}
@@ -125,3 +143,7 @@
bool(*ADJConfig2dx::getDeferredDeeplinkCallback())(std::string) {
return deferredDeeplinkCallback;
}
+
+void(*ADJConfig2dx::getConversionValueUpdatedCallback())(int) {
+ return conversionValueUpdatedCallback;
+}
diff --git a/dist/ADJDelegate2dx.h b/dist/ADJDelegate2dx.h
index 8033e2bc..3f931108 100644
--- a/dist/ADJDelegate2dx.h
+++ b/dist/ADJDelegate2dx.h
@@ -16,6 +16,7 @@
@property (nonatomic) void (*sessionSuccessCallbackMethod)(AdjustSessionSuccess2dx sessionSuccess);
@property (nonatomic) void (*sessionFailureCallbackMethod)(AdjustSessionFailure2dx sessionFailure);
@property (nonatomic) bool (*deferredDeeplinkCallbackMethod)(std::string deeplink);
+@property (nonatomic) void (*conversionValueUpdatedCallbackMethod)(int conversionValue);
+ (id)getInstanceWithSwizzleOfAttributionCallback:(BOOL)swizzleAttributionCallback
swizzleOfEventSuccessCallback:(BOOL)swizzleEventSuccessCallback
@@ -23,12 +24,14 @@
swizzleOfSessionSuccessCallback:(BOOL)swizzleSessionSuccessCallback
swizzleOfSessionFailureCallback:(BOOL)swizzleSessionFailureCallback
swizzleOfDeferredDeeplinkCallback:(BOOL)swizzleDeferredDeeplinkCallback
- andAttributionCallbackId:(void (*)(AdjustAttribution2dx attribution))attributionCallbackId
+ swizzleOfConversionValueUpdatedCallback:(BOOL)swizzleConversionValueUpdatedCallback
+ andAttributionCallbackId:(void (*)(AdjustAttribution2dx attribution))attributionCallbackId
eventSuccessCallbackId:(void (*)(AdjustEventSuccess2dx eventSuccess))eventSuccessCallbackId
eventFailureCallbackId:(void (*)(AdjustEventFailure2dx eventFailure))eventFailureCallbackId
sessionSuccessCallbackId:(void (*)(AdjustSessionSuccess2dx sessionSuccess))sessionSuccessCallbackId
sessionFailureCallbackId:(void (*)(AdjustSessionFailure2dx sessionFailure))sessionFailureCallbackId
- deferredDeeplinkCallbackId:(bool (*)(std::string deeplink))deferredDeeplinkCallbackId;
+ deferredDeeplinkCallbackId:(bool (*)(std::string deeplink))deferredDeeplinkCallbackId
+ conversionValueUpdatedCallbackId:(void (*)(int conversionValue))conversionValueUpdatedCallbackId;
+ (void)teardown;
@end
diff --git a/dist/ADJDelegate2dx.mm b/dist/ADJDelegate2dx.mm
index 572b6497..a8e77bff 100644
--- a/dist/ADJDelegate2dx.mm
+++ b/dist/ADJDelegate2dx.mm
@@ -21,12 +21,14 @@ + (id)getInstanceWithSwizzleOfAttributionCallback:(BOOL)swizzleAttributionCallba
swizzleOfSessionSuccessCallback:(BOOL)swizzleSessionSuccessCallback
swizzleOfSessionFailureCallback:(BOOL)swizzleSessionFailureCallback
swizzleOfDeferredDeeplinkCallback:(BOOL)swizzleDeferredDeeplinkCallback
+ swizzleOfConversionValueUpdatedCallback:(BOOL)swizzleConversionValueUpdatedCallback
andAttributionCallbackId:(void (*)(AdjustAttribution2dx attribution))attributionCallbackId
eventSuccessCallbackId:(void (*)(AdjustEventSuccess2dx eventSuccess))eventSuccessCallbackId
eventFailureCallbackId:(void (*)(AdjustEventFailure2dx eventFailure))eventFailureCallbackId
sessionSuccessCallbackId:(void (*)(AdjustSessionSuccess2dx sessionSuccess))sessionSuccessCallbackId
sessionFailureCallbackId:(void (*)(AdjustSessionFailure2dx sessionFailure))sessionFailureCallbackId
- deferredDeeplinkCallbackId:(bool (*)(std::string deeplink))deferredDeeplinkCallbackId {
+ deferredDeeplinkCallbackId:(bool (*)(std::string deeplink))deferredDeeplinkCallbackId
+ conversionValueUpdatedCallbackId:(void (*)(int conversionValue))conversionValueUpdatedCallbackId {
dispatch_once(&onceToken, ^{
defaultInstance = [[ADJDelegate2dx alloc] init];
@@ -55,6 +57,10 @@ + (id)getInstanceWithSwizzleOfAttributionCallback:(BOOL)swizzleAttributionCallba
[defaultInstance swizzleCallbackMethod:@selector(adjustDeeplinkResponse:)
swizzledSelector:@selector(adjustDeeplinkResponseWannabe:)];
}
+ if (swizzleConversionValueUpdatedCallback) {
+ [defaultInstance swizzleCallbackMethod:@selector(adjustConversionValueUpdated:)
+ swizzledSelector:@selector(adjustConversionValueUpdatedWannabe:)];
+ }
[defaultInstance setAttributionCallbackMethod:attributionCallbackId];
[defaultInstance setEventSuccessCallbackMethod:eventSuccessCallbackId];
@@ -62,6 +68,7 @@ + (id)getInstanceWithSwizzleOfAttributionCallback:(BOOL)swizzleAttributionCallba
[defaultInstance setSessionSuccessCallbackMethod:sessionSuccessCallbackId];
[defaultInstance setSessionFailureCallbackMethod:sessionFailureCallbackId];
[defaultInstance setDeferredDeeplinkCallbackMethod:deferredDeeplinkCallbackId];
+ [defaultInstance setConversionValueUpdatedCallbackMethod:conversionValueUpdatedCallbackId];
});
return defaultInstance;
@@ -97,6 +104,9 @@ - (void)adjustAttributionChangedWannabe:(ADJAttribution *)attribution {
[self addValueOrEmpty:dictionary key:@"adgroup" value:attribution.adgroup];
[self addValueOrEmpty:dictionary key:@"clickLabel" value:attribution.clickLabel];
[self addValueOrEmpty:dictionary key:@"adid" value:attribution.adid];
+ [self addValueOrEmpty:dictionary key:@"costType" value:attribution.costType];
+ [self addValueOrEmpty:dictionary key:@"costAmount" value:attribution.costAmount];
+ [self addValueOrEmpty:dictionary key:@"costCurrency" value:attribution.costCurrency];
std::string trackerToken = std::string([[dictionary objectForKey:@"trackerToken"] UTF8String]);
std::string trackerName = std::string([[dictionary objectForKey:@"trackerName"] UTF8String]);
@@ -106,8 +116,22 @@ - (void)adjustAttributionChangedWannabe:(ADJAttribution *)attribution {
std::string adgroup = std::string([[dictionary objectForKey:@"adgroup"] UTF8String]);
std::string clickLabel = std::string([[dictionary objectForKey:@"clickLabel"] UTF8String]);
std::string adid = std::string([[dictionary objectForKey:@"adid"] UTF8String]);
+ std::string costType = std::string([[dictionary objectForKey:@"costType"] UTF8String]);
+ double costAmount = [dictionary objectForKey:@"costAmount"] != nil ? [[dictionary objectForKey:@"costAmount"] doubleValue] : 0;
+ std::string costCurrency = std::string([[dictionary objectForKey:@"costCurrency"] UTF8String]);
- AdjustAttribution2dx attribution2dx = AdjustAttribution2dx(trackerToken, trackerName, network, campaign, adgroup, creative, clickLabel, adid);
+ AdjustAttribution2dx attribution2dx = AdjustAttribution2dx(
+ trackerToken,
+ trackerName,
+ network,
+ campaign,
+ adgroup,
+ creative,
+ clickLabel,
+ adid,
+ costType,
+ costAmount,
+ costCurrency);
_attributionCallbackMethod(attribution2dx);
}
@@ -233,6 +257,13 @@ - (BOOL)adjustDeeplinkResponseWannabe:(NSURL *)deeplink {
return _deferredDeeplinkCallbackMethod(strDeeplink);
}
+- (void)adjustConversionValueUpdatedWannabe:(NSNumber *)conversionValue {
+ if (conversionValue == nil) {
+ return;
+ }
+ _conversionValueUpdatedCallbackMethod([conversionValue intValue]);
+}
+
- (void)swizzleCallbackMethod:(SEL)originalSelector
swizzledSelector:(SEL)swizzledSelector {
Class cls = [self class];
@@ -256,7 +287,13 @@ - (void)addValueOrEmpty:(NSMutableDictionary *)dictionary
key:(NSString *)key
value:(NSObject *)value {
if (nil != value) {
- [dictionary setObject:[NSString stringWithFormat:@"%@", value] forKey:key];
+ if ([value isKindOfClass:[NSString class]]) {
+ [dictionary setObject:[NSString stringWithFormat:@"%@", value] forKey:key];
+ } else if ([value isKindOfClass:[NSNumber class]]) {
+ [dictionary setObject:[NSString stringWithFormat:@"%@", [((NSNumber *)value) stringValue]] forKey:key];
+ } else {
+ [dictionary setObject:@"" forKey:key];
+ }
} else {
[dictionary setObject:@"" forKey:key];
}
diff --git a/dist/ADJThirdPartySharing2dx.h b/dist/ADJThirdPartySharing2dx.h
new file mode 100755
index 00000000..60f01422
--- /dev/null
+++ b/dist/ADJThirdPartySharing2dx.h
@@ -0,0 +1,32 @@
+//
+// ADJThirdPartySharing2dx.h
+// Adjust SDK
+//
+// Created by Uglješa Erceg (@uerceg) on 10th September 2021.
+// Copyright © 2021 Adjust GmbH. All rights reserved.
+//
+
+#ifndef _ADJUST_ADJTHIRDPARTYSHARING2DX_H_
+#define _ADJUST_ADJTHIRDPARTYSHARING2DX_H_
+
+#include
+
+class ADJThirdPartySharing2dx {
+private:
+ void* thirdPartySharing;
+ void initThirdPartySharing();
+ void initThirdPartySharing(bool isEnabled);
+
+public:
+ ADJThirdPartySharing2dx() {
+ initThirdPartySharing();
+ }
+ ADJThirdPartySharing2dx(bool isEnabled) {
+ initThirdPartySharing(isEnabled);
+ }
+
+ void addGranularOption(std::string partnerName, std::string key, std::string value);
+ void* getThirdPartySharing();
+};
+
+#endif /* _ADJUST_ADJTHIRDPARTYSHARING2DX_H_ */
diff --git a/dist/ADJThirdPartySharing2dx.mm b/dist/ADJThirdPartySharing2dx.mm
new file mode 100755
index 00000000..692d5a0c
--- /dev/null
+++ b/dist/ADJThirdPartySharing2dx.mm
@@ -0,0 +1,28 @@
+//
+// ADJThirdPartySharing2dx.mm
+// Adjust SDK
+//
+// Created by Uglješa Erceg (@uerceg) on 10th September 2015.
+// Copyright © 2021 Adjust GmbH. All rights reserved.
+//
+
+#include "ADJThirdPartySharing2dx.h"
+#include
+
+void ADJThirdPartySharing2dx::initThirdPartySharing() {
+ thirdPartySharing = [[ADJThirdPartySharing alloc] initWithIsEnabledNumberBool:nil];
+}
+
+void ADJThirdPartySharing2dx::initThirdPartySharing(bool isEnabled) {
+ thirdPartySharing = [[ADJThirdPartySharing alloc] initWithIsEnabledNumberBool:[NSNumber numberWithBool:isEnabled]];
+}
+
+void ADJThirdPartySharing2dx::addGranularOption(std::string partnerName, std::string key, std::string value) {
+ [((ADJThirdPartySharing *)thirdPartySharing) addGranularOption:[NSString stringWithUTF8String:partnerName.c_str()]
+ key:[NSString stringWithUTF8String:key.c_str()]
+ value:[NSString stringWithUTF8String:value.c_str()]];
+}
+
+void* ADJThirdPartySharing2dx::getThirdPartySharing() {
+ return thirdPartySharing;
+}
diff --git a/dist/Adjust2dx.cpp b/dist/Adjust2dx.cpp
index 6f508292..c5561218 100755
--- a/dist/Adjust2dx.cpp
+++ b/dist/Adjust2dx.cpp
@@ -309,6 +309,30 @@ void Adjust2dx::disableThirdPartySharing() {
#endif
}
+void Adjust2dx::trackThirdPartySharing(AdjustThirdPartySharing2dx thirdPartySharing) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ cocos2d::JniMethodInfo jmiTrackThirdPartySharing;
+ if (!cocos2d::JniHelper::getStaticMethodInfo(jmiTrackThirdPartySharing, "com/adjust/sdk/Adjust", "trackThirdPartySharing", "(Lcom/adjust/sdk/AdjustThirdPartySharing;)V")) {
+ return;
+ }
+ jmiTrackThirdPartySharing.env->CallStaticVoidMethod(jmiTrackThirdPartySharing.classID, jmiTrackThirdPartySharing.methodID, thirdPartySharing.getThirdPartySharing());
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ ADJAdjust2dx::trackThirdPartySharing(thirdPartySharing.getThirdPartySharing());
+#endif
+}
+
+void Adjust2dx::trackMeasurementConsent(bool measurementConsent) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ cocos2d::JniMethodInfo jmiTrackMeasurementConsent;
+ if (!cocos2d::JniHelper::getStaticMethodInfo(jmiTrackMeasurementConsent, "com/adjust/sdk/Adjust", "trackMeasurementConsent", "(Z)V")) {
+ return;
+ }
+ jmiTrackMeasurementConsent.env->CallStaticVoidMethod(jmiTrackMeasurementConsent.classID, jmiTrackMeasurementConsent.methodID, measurementConsent);
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ ADJAdjust2dx::trackMeasurementConsent(measurementConsent);
+#endif
+}
+
std::string Adjust2dx::getAdid() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return ADJAdjust2dx::getAdid();
@@ -363,10 +387,24 @@ AdjustAttribution2dx Adjust2dx::getAttribution() {
std::string creative;
std::string clickLabel;
std::string adid;
+ std::string costType;
+ double costAmount;
+ std::string costCurrency;
cocos2d::JniMethodInfo jmiGetAttribution;
if (!cocos2d::JniHelper::getStaticMethodInfo(jmiGetAttribution, "com/adjust/sdk/Adjust", "getAttribution", "()Lcom/adjust/sdk/AdjustAttribution;")) {
- AdjustAttribution2dx attribution2dx = AdjustAttribution2dx(trackerToken, trackerName, network, campaign, adgroup, creative, clickLabel, adid);
+ AdjustAttribution2dx attribution2dx = AdjustAttribution2dx(
+ trackerToken,
+ trackerName,
+ network,
+ campaign,
+ adgroup,
+ creative,
+ clickLabel,
+ adid,
+ costType,
+ costAmount,
+ costCurrency);
return attribution2dx;
}
@@ -381,6 +419,9 @@ AdjustAttribution2dx Adjust2dx::getAttribution() {
jfieldID jfidCreative = jmiGetAttribution.env->GetFieldID(clsAdjustAttribution, "creative", "Ljava/lang/String;");
jfieldID jfidClickLabel = jmiGetAttribution.env->GetFieldID(clsAdjustAttribution, "clickLabel", "Ljava/lang/String;");
jfieldID jfidAdid = jmiGetAttribution.env->GetFieldID(clsAdjustAttribution, "adid", "Ljava/lang/String;");
+ jfieldID jfidCostType = jmiGetAttribution.env->GetFieldID(clsAdjustAttribution, "costType", "Ljava/lang/String;");
+ jfieldID jfidCostAmount = jmiGetAttribution.env->GetFieldID(clsAdjustAttribution, "costAmount", "Ljava/lang/Double;");
+ jfieldID jfidCostCurrency = jmiGetAttribution.env->GetFieldID(clsAdjustAttribution, "costCurrency", "Ljava/lang/String;");
jstring jTrackerToken = (jstring)jmiGetAttribution.env->GetObjectField(jAttribution, jfidTrackerToken);
jstring jTrackerName = (jstring)jmiGetAttribution.env->GetObjectField(jAttribution, jfidTrackerName);
jstring jNetwork = (jstring)jmiGetAttribution.env->GetObjectField(jAttribution, jfidNetwork);
@@ -389,6 +430,9 @@ AdjustAttribution2dx Adjust2dx::getAttribution() {
jstring jCreative = (jstring)jmiGetAttribution.env->GetObjectField(jAttribution, jfidCreative);
jstring jClickLabel = (jstring)jmiGetAttribution.env->GetObjectField(jAttribution, jfidClickLabel);
jstring jAdid = (jstring)jmiGetAttribution.env->GetObjectField(jAttribution, jfidAdid);
+ jstring jCostType = (jstring)jmiGetAttribution.env->GetObjectField(jAttribution, jfidCostType);
+ jobject jCostAmount = jmiGetAttribution.env->GetObjectField(jAttribution, jfidCostAmount);
+ jstring jCostCurrency = (jstring)jmiGetAttribution.env->GetObjectField(jAttribution, jfidCostCurrency);
if (NULL != jTrackerToken) {
const char *trackerTokenCStr = jmiGetAttribution.env->GetStringUTFChars(jTrackerToken, NULL);
@@ -461,9 +505,46 @@ AdjustAttribution2dx Adjust2dx::getAttribution() {
} else {
adid = "";
}
+
+ if (NULL != jCostType) {
+ const char *costTypeCStr = jmiGetAttribution.env->GetStringUTFChars(jCostType, NULL);
+ costType = std::string(costTypeCStr);
+ jmiGetAttribution.env->ReleaseStringUTFChars(jCostType, costTypeCStr);
+ jmiGetAttribution.env->DeleteLocalRef(jCostType);
+ } else {
+ costType = "";
+ }
+
+ if (NULL != jCostAmount) {
+ jclass jcDouble = jmiGetAttribution.env->FindClass("java/lang/Double");
+ jmethodID jmidDoubleValue = jmiGetAttribution.env->GetMethodID(jcDouble, "doubleValue", "()D" );
+ costAmount = jmiGetAttribution.env->CallDoubleMethod(jCostAmount, jmidDoubleValue);
+ } else {
+ costAmount = 0;
+ }
+
+ if (NULL != jCostCurrency) {
+ const char *costCurrencyCStr = jmiGetAttribution.env->GetStringUTFChars(jCostCurrency, NULL);
+ costCurrency = std::string(costCurrencyCStr);
+ jmiGetAttribution.env->ReleaseStringUTFChars(jCostCurrency, costCurrencyCStr);
+ jmiGetAttribution.env->DeleteLocalRef(jCostCurrency);
+ } else {
+ costCurrency = "";
+ }
}
- AdjustAttribution2dx attribution2dx = AdjustAttribution2dx(trackerToken, trackerName, network, campaign, adgroup, creative, clickLabel, adid);
+ AdjustAttribution2dx attribution2dx = AdjustAttribution2dx(
+ trackerToken,
+ trackerName,
+ network,
+ campaign,
+ adgroup,
+ creative,
+ clickLabel,
+ adid,
+ costType,
+ costAmount,
+ costCurrency);
return attribution2dx;
#endif
}
@@ -579,6 +660,12 @@ void Adjust2dx::requestTrackingAuthorizationWithCompletionHandler(void (*trackin
#endif
}
+void Adjust2dx::updateConversionValue(int conversionValue) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ ADJAdjust2dx::updateConversionValue(conversionValue);
+#endif
+}
+
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
jobject getTestOptions(std::map testOptions) {
cocos2d::JniMethodInfo jmiInit;
diff --git a/dist/Adjust2dx.h b/dist/Adjust2dx.h
index 6900addd..7236c7dd 100755
--- a/dist/Adjust2dx.h
+++ b/dist/Adjust2dx.h
@@ -16,6 +16,7 @@
#include "AdjustAttribution2dx.h"
#include "AdjustAppStoreSubscription2dx.h"
#include "AdjustPlayStoreSubscription2dx.h"
+#include "AdjustThirdPartySharing2dx.h"
extern const std::string AdjustEnvironmentSandbox2dx;
extern const std::string AdjustEnvironmentProduction2dx;
@@ -39,6 +40,8 @@ class Adjust2dx {
static void resetSessionPartnerParameters();
static void trackAdRevenue(std::string source, std::string payload);
static void disableThirdPartySharing();
+ static void trackThirdPartySharing(AdjustThirdPartySharing2dx thirdPartySharing);
+ static void trackMeasurementConsent(bool measurementConsent);
static std::string getAdid();
static std::string getSdkVersion();
static AdjustAttribution2dx getAttribution();
@@ -53,6 +56,8 @@ class Adjust2dx {
static std::string getIdfa();
static void trackAppStoreSubscription(AdjustAppStoreSubscription2dx subscription);
static void requestTrackingAuthorizationWithCompletionHandler(void (*trackingStatusCallback)(int status));
+ static int getAppTrackingAuthorizationStatus();
+ static void updateConversionValue(int conversionValue);
// For testing purposes only.
static void setTestOptions(std::map testOptions);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
diff --git a/dist/AdjustAttribution2dx.cpp b/dist/AdjustAttribution2dx.cpp
index 0d32948a..7b8ce6d6 100755
--- a/dist/AdjustAttribution2dx.cpp
+++ b/dist/AdjustAttribution2dx.cpp
@@ -39,3 +39,15 @@ std::string AdjustAttribution2dx::getClickLabel() {
std::string AdjustAttribution2dx::getAdid() {
return this->adid;
}
+
+std::string AdjustAttribution2dx::getCostType() {
+ return this->costType;
+}
+
+double AdjustAttribution2dx::getCostAmount() {
+ return this->costAmount;
+}
+
+std::string AdjustAttribution2dx::getCostCurrency() {
+ return this->costCurrency;
+}
diff --git a/dist/AdjustAttribution2dx.h b/dist/AdjustAttribution2dx.h
index 8af98cc0..557a2cd1 100755
--- a/dist/AdjustAttribution2dx.h
+++ b/dist/AdjustAttribution2dx.h
@@ -21,6 +21,9 @@ class AdjustAttribution2dx {
std::string creative;
std::string clickLabel;
std::string adid;
+ std::string costType;
+ double costAmount;
+ std::string costCurrency;
public:
AdjustAttribution2dx() {}
AdjustAttribution2dx(
@@ -31,7 +34,10 @@ class AdjustAttribution2dx {
std::string adgroup,
std::string creative,
std::string clickLabel,
- std::string adid) {
+ std::string adid,
+ std::string costType,
+ double costAmount,
+ std::string costCurrency) {
this->trackerToken = trackerToken;
this->trackerName = trackerName;
this->network = network;
@@ -40,6 +46,9 @@ class AdjustAttribution2dx {
this->creative = creative;
this->clickLabel = clickLabel;
this->adid = adid;
+ this->costType = costType;
+ this->costAmount = costAmount;
+ this->costCurrency = costCurrency;
}
std::string getTrackerToken();
@@ -50,6 +59,9 @@ class AdjustAttribution2dx {
std::string getCreative();
std::string getClickLabel();
std::string getAdid();
+ std::string getCostType();
+ double getCostAmount();
+ std::string getCostCurrency();
};
#endif /* ADJUST_ADJUSTATTRIBUTION2DX_H_ */
diff --git a/dist/AdjustConfig2dx.cpp b/dist/AdjustConfig2dx.cpp
index 364115f5..b3ee7fb1 100755
--- a/dist/AdjustConfig2dx.cpp
+++ b/dist/AdjustConfig2dx.cpp
@@ -15,9 +15,12 @@
#include "AdjustConfig2dx.h"
USING_NS_CC;
-const std::string AdjustSdkPrefix2dx = "cocos2d-x4.28.0";
+const std::string AdjustSdkPrefix2dx = "cocos2d-x4.29.0";
const std::string AdjustUrlStrategyChina = "china";
const std::string AdjustUrlStrategyIndia = "india";
+const std::string AdjustDataResidencyEU = "data-residency-eu";
+const std::string AdjustDataResidencyTR = "data-residency-tr";
+const std::string AdjustDataResidencyUS = "data-residency-us";
void AdjustConfig2dx::initConfig(std::string appToken, std::string environment, bool allowSuppressLogLevel) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
@@ -168,6 +171,27 @@ void AdjustConfig2dx::setEventBufferingEnabled(bool isEnabled) {
#endif
}
+void AdjustConfig2dx::setNeedsCost(bool needsCost) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ if (config == NULL) {
+ return;
+ }
+ cocos2d::JniMethodInfo jmiSetNeedsCost;
+ if (!cocos2d::JniHelper::getMethodInfo(jmiSetNeedsCost, "com/adjust/sdk/AdjustConfig", "setNeedsCost", "(Ljava/lang/Boolean;)V")) {
+ return;
+ }
+
+ jclass jclsBoolean = jmiSetNeedsCost.env->FindClass("java/lang/Boolean");
+ jmethodID jmidValueOf = jmiSetNeedsCost.env->GetStaticMethodID(jclsBoolean, "valueOf", "(Z)Ljava/lang/Boolean;");
+ jobject jNeedsCost = jmiSetNeedsCost.env->CallStaticObjectMethod(jclsBoolean, jmidValueOf, needsCost);
+ jmiSetNeedsCost.env->CallVoidMethod(config, jmiSetNeedsCost.methodID, jNeedsCost);
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ if (isConfigSet) {
+ config.setNeedsCost(needsCost);
+ }
+#endif
+}
+
void AdjustConfig2dx::setAllowIdfaReading(bool isAllowed) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
@@ -186,6 +210,15 @@ void AdjustConfig2dx::setAllowiAdInfoReading(bool isAllowed) {
#endif
}
+void AdjustConfig2dx::setAllowAdServicesInfoReading(bool isAllowed) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ if (isConfigSet) {
+ config.setAllowAdServicesInfoReading(isAllowed);
+ }
+#endif
+}
+
void AdjustConfig2dx::setUserAgent(std::string userAgent) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
cocos2d::JniMethodInfo jmiSetUserAgent;
@@ -265,6 +298,24 @@ void AdjustConfig2dx::setUrlStrategy(std::string urlStrategy) {
jstring jUrlStrategyIndia = (jstring)jmiSetUrlStrategy.env->GetStaticObjectField(jclsAdjustConfig, jfidUrlStrategyIndia);
jmiSetUrlStrategy.env->CallVoidMethod(config, jmiSetUrlStrategy.methodID, jUrlStrategyIndia);
jmiSetUrlStrategy.env->DeleteLocalRef(jUrlStrategyIndia);
+ } else if (urlStrategy.compare(AdjustDataResidencyEU) == 0) {
+ jclass jclsAdjustConfig = jmiSetUrlStrategy.env->FindClass("com/adjust/sdk/AdjustConfig");
+ jfieldID jfidDataResidencyEU = jmiSetUrlStrategy.env->GetStaticFieldID(jclsAdjustConfig, "DATA_RESIDENCY_EU", "Ljava/lang/String;");
+ jstring jDataResidencyEU = (jstring)jmiSetUrlStrategy.env->GetStaticObjectField(jclsAdjustConfig, jfidDataResidencyEU);
+ jmiSetUrlStrategy.env->CallVoidMethod(config, jmiSetUrlStrategy.methodID, jDataResidencyEU);
+ jmiSetUrlStrategy.env->DeleteLocalRef(jDataResidencyEU);
+ } else if (urlStrategy.compare(AdjustDataResidencyTR) == 0) {
+ jclass jclsAdjustConfig = jmiSetUrlStrategy.env->FindClass("com/adjust/sdk/AdjustConfig");
+ jfieldID jfidDataResidencyTR = jmiSetUrlStrategy.env->GetStaticFieldID(jclsAdjustConfig, "DATA_RESIDENCY_TR", "Ljava/lang/String;");
+ jstring jDataResidencyTR = (jstring)jmiSetUrlStrategy.env->GetStaticObjectField(jclsAdjustConfig, jfidDataResidencyTR);
+ jmiSetUrlStrategy.env->CallVoidMethod(config, jmiSetUrlStrategy.methodID, jDataResidencyTR);
+ jmiSetUrlStrategy.env->DeleteLocalRef(jDataResidencyTR);
+ } else if (urlStrategy.compare(AdjustDataResidencyUS) == 0) {
+ jclass jclsAdjustConfig = jmiSetUrlStrategy.env->FindClass("com/adjust/sdk/AdjustConfig");
+ jfieldID jfidDataResidencyUS = jmiSetUrlStrategy.env->GetStaticFieldID(jclsAdjustConfig, "DATA_RESIDENCY_US", "Ljava/lang/String;");
+ jstring jDataResidencyUS = (jstring)jmiSetUrlStrategy.env->GetStaticObjectField(jclsAdjustConfig, jfidDataResidencyUS);
+ jmiSetUrlStrategy.env->CallVoidMethod(config, jmiSetUrlStrategy.methodID, jDataResidencyUS);
+ jmiSetUrlStrategy.env->DeleteLocalRef(jDataResidencyUS);
}
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
if (isConfigSet) {
@@ -273,6 +324,44 @@ void AdjustConfig2dx::setUrlStrategy(std::string urlStrategy) {
#endif
}
+void AdjustConfig2dx::setPreinstallTrackingEnabled(bool isEnabled) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ if (config == NULL) {
+ return;
+ }
+ cocos2d::JniMethodInfo jmiSetPreinstallTrackingEnabled;
+ if (!cocos2d::JniHelper::getMethodInfo(jmiSetPreinstallTrackingEnabled, "com/adjust/sdk/AdjustConfig", "jmiSetPreinstallTrackingEnabled", "(Ljava/lang/Boolean;)V")) {
+ return;
+ }
+
+ jclass jclsBoolean = jmiSetPreinstallTrackingEnabled.env->FindClass("java/lang/Boolean");
+ jmethodID jmidValueOf = jmiSetPreinstallTrackingEnabled.env->GetStaticMethodID(jclsBoolean, "valueOf", "(Z)Ljava/lang/Boolean;");
+ jobject jIsEnabled = jmiSetPreinstallTrackingEnabled.env->CallStaticObjectMethod(jclsBoolean, jmidValueOf, isEnabled);
+ jmiSetPreinstallTrackingEnabled.env->CallVoidMethod(config, jmiSetPreinstallTrackingEnabled.methodID, jIsEnabled);
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+#endif
+}
+
+void AdjustConfig2dx::setPreinstallFilePath(std::string externalDeviceId) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ if (config == NULL) {
+ return;
+ }
+ cocos2d::JniMethodInfo jmiSetExternalDeviceId;
+ if (!cocos2d::JniHelper::getMethodInfo(jmiSetExternalDeviceId, "com/adjust/sdk/AdjustConfig", "setExternalDeviceId", "(Ljava/lang/String;)V")) {
+ return;
+ }
+
+ jstring jExternalDeviceId = jmiSetExternalDeviceId.env->NewStringUTF(externalDeviceId.c_str());
+ jmiSetExternalDeviceId.env->CallVoidMethod(config, jmiSetExternalDeviceId.methodID, jExternalDeviceId);
+ jmiSetExternalDeviceId.env->DeleteLocalRef(jExternalDeviceId);
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ if (isConfigSet) {
+ config.setExternalDeviceId(externalDeviceId);
+ }
+#endif
+}
+
void AdjustConfig2dx::setAppSecret(unsigned long long secretId, unsigned long long info1, unsigned long long info2, unsigned long long info3, unsigned long long info4) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
if (config == NULL) {
@@ -307,10 +396,10 @@ void AdjustConfig2dx::setDeviceKnown(bool isDeviceKnown) {
#endif
}
-void AdjustConfig2dx::deactivateSKAdNetworkHandling() {
+void AdjustConfig2dx::deactivateSkAdNetworkHandling() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
if (isConfigSet) {
- config.deactivateSKAdNetworkHandling();
+ config.deactivateSkAdNetworkHandling();
}
#endif
}
@@ -512,6 +601,15 @@ void AdjustConfig2dx::setDeferredDeeplinkCallback(bool(*deferredDeeplinkCallback
#endif
}
+void AdjustConfig2dx::setConversionValueUpdatedCallback(void(*conversionValueUpdatedCallback)(int conversionValue)) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ if (isConfigSet) {
+ config.setConversionValueUpdatedCallback(conversionValueUpdatedCallback);
+ }
+#endif
+}
+
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
jobject AdjustConfig2dx::getConfig() {
return config;
diff --git a/dist/AdjustConfig2dx.h b/dist/AdjustConfig2dx.h
index 81b353fd..b0dc355e 100755
--- a/dist/AdjustConfig2dx.h
+++ b/dist/AdjustConfig2dx.h
@@ -25,6 +25,9 @@
extern const std::string AdjustSdkPrefix2dx;
extern const std::string AdjustUrlStrategyChina;
extern const std::string AdjustUrlStrategyIndia;
+extern const std::string AdjustDataResidencyEU;
+extern const std::string AdjustDataResidencyTR;
+extern const std::string AdjustDataResidencyUS;
enum AdjustLogLevel2dx {
AdjustLogLevel2dxVerbose = 1,
@@ -70,9 +73,7 @@ class AdjustConfig2dx {
void setDeviceKnown(bool isDeviceKnown);
void setSendInBackground(bool isEnabled);
void setEventBufferingEnabled(bool isEnabled);
- void setAllowIdfaReading(bool isAllowed);
- void setAllowiAdInfoReading(bool isAllowed);
- void setReadMobileEquipmentIdentity(bool readMobileEquipmentIdentity);
+ void setNeedsCost(bool needsCost);
void setUserAgent(std::string userAgent);
void setProcessName(std::string processName);
void setDefaultTracker(std::string defaultTracker);
@@ -81,13 +82,22 @@ class AdjustConfig2dx {
void setDelayStart(double delayStart);
void setLogLevel(AdjustLogLevel2dx logLevel, void(*logCallback)(const char* log) = NULL);
void setAppSecret(unsigned long long secretId, unsigned long long info1, unsigned long long info2, unsigned long long info3, unsigned long long info4);
- void deactivateSKAdNetworkHandling();
void setAttributionCallback(void(*attributionCallback)(AdjustAttribution2dx attribution));
void setEventSuccessCallback(void(*eventSuccessCallback)(AdjustEventSuccess2dx eventSuccess));
void setEventFailureCallback(void(*eventFailureCallback)(AdjustEventFailure2dx eventFailure));
void setSessionSuccessCallback(void(*sessionSuccessCallback)(AdjustSessionSuccess2dx sessionSuccess));
void setSessionFailureCallback(void(*sessionFailureCallback)(AdjustSessionFailure2dx sessionFailure));
void setDeferredDeeplinkCallback(bool(*deferredDeeplinkCallback)(std::string deeplink));
+ // iOS only
+ void deactivateSkAdNetworkHandling();
+ void setAllowIdfaReading(bool isAllowed);
+ void setAllowiAdInfoReading(bool isAllowed);
+ void setAllowAdServicesInfoReading(bool isAllowed);
+ void setConversionValueUpdatedCallback(void(*conversionValueUpdatedCallback)(int conversionValue));
+ // Android only
+ void setReadMobileEquipmentIdentity(bool readMobileEquipmentIdentity);
+ void setPreinstallTrackingEnabled(bool isEnabled);
+ void setPreinstallFilePath(std::string filePath);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
jobject getConfig();
diff --git a/dist/AdjustProxy2dx.cpp b/dist/AdjustProxy2dx.cpp
index a662459b..8b2594a9 100755
--- a/dist/AdjustProxy2dx.cpp
+++ b/dist/AdjustProxy2dx.cpp
@@ -43,6 +43,9 @@ JNIEXPORT void JNICALL Java_com_adjust_sdk_Adjust2dxAttributionCallback_attribut
std::string creative;
std::string clickLabel;
std::string adid;
+ std::string costType;
+ double costAmount;
+ std::string costCurrency;
jclass jclsAdjustAttribution = env->FindClass("com/adjust/sdk/AdjustAttribution");
jfieldID jfidTrackerToken = env->GetFieldID(jclsAdjustAttribution, "trackerToken", "Ljava/lang/String;");
@@ -53,6 +56,9 @@ JNIEXPORT void JNICALL Java_com_adjust_sdk_Adjust2dxAttributionCallback_attribut
jfieldID jfidCreative = env->GetFieldID(jclsAdjustAttribution, "creative", "Ljava/lang/String;");
jfieldID jfidClickLabel = env->GetFieldID(jclsAdjustAttribution, "clickLabel", "Ljava/lang/String;");
jfieldID jfidAdid = env->GetFieldID(jclsAdjustAttribution, "adid", "Ljava/lang/String;");
+ jfieldID jfidCostType = env->GetFieldID(jclsAdjustAttribution, "costType", "Ljava/lang/String;");
+ jfieldID jfidCostAmount = env->GetFieldID(jclsAdjustAttribution, "costAmount", "Ljava/lang/Double;");
+ jfieldID jfidCostCurrency = env->GetFieldID(jclsAdjustAttribution, "costCurrency", "Ljava/lang/String;");
jstring jTrackerToken = (jstring)env->GetObjectField(attributionObject, jfidTrackerToken);
jstring jTrackerName = (jstring)env->GetObjectField(attributionObject, jfidTrackerName);
jstring jNetwork = (jstring)env->GetObjectField(attributionObject, jfidNetwork);
@@ -61,6 +67,9 @@ JNIEXPORT void JNICALL Java_com_adjust_sdk_Adjust2dxAttributionCallback_attribut
jstring jCreative = (jstring)env->GetObjectField(attributionObject, jfidCreative);
jstring jClickLabel = (jstring)env->GetObjectField(attributionObject, jfidClickLabel);
jstring jAdid = (jstring)env->GetObjectField(attributionObject, jfidAdid);
+ jstring jCostType = (jstring)env->GetObjectField(attributionObject, jfidCostType);
+ jobject jCostAmount = env->GetObjectField(attributionObject, jfidCostAmount);
+ jstring jCostCurrency = (jstring)env->GetObjectField(attributionObject, jfidCostCurrency);
if (NULL != jTrackerToken) {
const char *trackerTokenCStr = env->GetStringUTFChars(jTrackerToken, NULL);
@@ -134,7 +143,44 @@ JNIEXPORT void JNICALL Java_com_adjust_sdk_Adjust2dxAttributionCallback_attribut
adid = "";
}
- AdjustAttribution2dx attribution = AdjustAttribution2dx(trackerToken, trackerName, network, campaign, adgroup, creative, clickLabel, adid);
+ if (NULL != jCostType) {
+ const char *costTypeCStr = env->GetStringUTFChars(jCostType, NULL);
+ costType = std::string(costTypeCStr);
+ env->ReleaseStringUTFChars(jCostType, costTypeCStr);
+ env->DeleteLocalRef(jCostType);
+ } else {
+ costType = "";
+ }
+
+ if (NULL != jCostAmount) {
+ jclass jcDouble = env->FindClass("java/lang/Double");
+ jmethodID jmidDoubleValue = env->GetMethodID(jcDouble, "doubleValue", "()D" );
+ costAmount = env->CallDoubleMethod(jCostAmount, jmidDoubleValue);
+ } else {
+ costAmount = 0;
+ }
+
+ if (NULL != jCostCurrency) {
+ const char *costCurrencyCStr = env->GetStringUTFChars(jCostCurrency, NULL);
+ costCurrency = std::string(costCurrencyCStr);
+ env->ReleaseStringUTFChars(jCostCurrency, costCurrencyCStr);
+ env->DeleteLocalRef(jCostCurrency);
+ } else {
+ costCurrency = "";
+ }
+
+ AdjustAttribution2dx attribution = AdjustAttribution2dx(
+ trackerToken,
+ trackerName,
+ network,
+ campaign,
+ adgroup,
+ creative,
+ clickLabel,
+ adid,
+ costType,
+ costAmount,
+ costCurrency);
attributionCallbackMethod(attribution);
}
diff --git a/dist/AdjustThirdPartySharing2dx.cpp b/dist/AdjustThirdPartySharing2dx.cpp
new file mode 100755
index 00000000..3c684375
--- /dev/null
+++ b/dist/AdjustThirdPartySharing2dx.cpp
@@ -0,0 +1,88 @@
+//
+// AdjustThirdPartySharing2dx.cpp
+// Adjust SDK
+//
+// Created by Uglješa Erceg (@uerceg) on 10th September 2021.
+// Copyright © 2021 Adjust GmbH. All rights reserved.
+//
+
+#include "AdjustThirdPartySharing2dx.h"
+
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+#include
+#include "platform/android/jni/JniHelper.h"
+#endif
+
+void AdjustThirdPartySharing2dx::initThirdPartySharing() {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ cocos2d::JniMethodInfo jmiInit;
+ if (!cocos2d::JniHelper::getMethodInfo(jmiInit, "com/adjust/sdk/AdjustThirdPartySharing", "", "(Ljava/lang/Boolean;)V")) {
+ return;
+ }
+
+ jclass jclsAdjustThirdPartySharing = jmiInit.env->FindClass("com/adjust/sdk/AdjustThirdPartySharing");
+ jmethodID jmidInit = jmiInit.env->GetMethodID(jclsAdjustThirdPartySharing, "", "(Ljava/lang/Boolean;)V");
+ // jclass jclsBoolean = jmiInit.env->FindClass("java/lang/Boolean");
+ // jmethodID jmidValueOf = jmiInit.env->GetStaticMethodID(jclsBoolean, "valueOf", "(Z)Ljava/lang/Boolean;");
+ // jobject jIsEnabled = jmiInit.env->CallStaticObjectMethod(jclsBoolean, jmidValueOf, isEnabled);
+ thirdPartySharing = jmiInit.env->NewObject(jclsAdjustThirdPartySharing, jmidInit, nullptr);
+ // jmiInit.env->DeleteLocalRef(jIsEnabled);
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ thirdPartySharing = ADJThirdPartySharing2dx();
+ isThirdPartySharingSet = true;
+#endif
+}
+
+void AdjustThirdPartySharing2dx::initThirdPartySharing(bool isEnabled) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ cocos2d::JniMethodInfo jmiInit;
+ if (!cocos2d::JniHelper::getMethodInfo(jmiInit, "com/adjust/sdk/AdjustThirdPartySharing", "", "(Ljava/lang/Boolean;)V")) {
+ return;
+ }
+
+ jclass jclsAdjustThirdPartySharing = jmiInit.env->FindClass("com/adjust/sdk/AdjustThirdPartySharing");
+ jmethodID jmidInit = jmiInit.env->GetMethodID(jclsAdjustThirdPartySharing, "", "(Ljava/lang/Boolean;)V");
+ jclass jclsBoolean = jmiInit.env->FindClass("java/lang/Boolean");
+ jmethodID jmidValueOf = jmiInit.env->GetStaticMethodID(jclsBoolean, "valueOf", "(Z)Ljava/lang/Boolean;");
+ jobject jIsEnabled = jmiInit.env->CallStaticObjectMethod(jclsBoolean, jmidValueOf, isEnabled);
+ thirdPartySharing = jmiInit.env->NewObject(jclsAdjustThirdPartySharing, jmidInit, jIsEnabled);
+ jmiInit.env->DeleteLocalRef(jIsEnabled);
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ thirdPartySharing = ADJThirdPartySharing2dx(isEnabled);
+ isThirdPartySharingSet = true;
+#endif
+}
+
+void AdjustThirdPartySharing2dx::addGranularOption(std::string partnerName, std::string key, std::string value) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ if (thirdPartySharing == NULL) {
+ return;
+ }
+ cocos2d::JniMethodInfo jmiAddGranularOption;
+ if (!cocos2d::JniHelper::getMethodInfo(jmiAddGranularOption, "com/adjust/sdk/AdjustThirdPartySharing", "addGranularOption", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V")) {
+ return;
+ }
+
+ jstring jPartnerName = jmiAddGranularOption.env->NewStringUTF(partnerName.c_str());
+ jstring jKey = jmiAddGranularOption.env->NewStringUTF(key.c_str());
+ jstring jValue = jmiAddGranularOption.env->NewStringUTF(value.c_str());
+ jmiAddGranularOption.env->CallVoidMethod(thirdPartySharing, jmiAddGranularOption.methodID, jPartnerName, jKey, jValue);
+ jmiAddGranularOption.env->DeleteLocalRef(jPartnerName);
+ jmiAddGranularOption.env->DeleteLocalRef(jKey);
+ jmiAddGranularOption.env->DeleteLocalRef(jValue);
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ if (isThirdPartySharingSet) {
+ thirdPartySharing.addGranularOption(partnerName, key, value);
+ }
+#endif
+}
+
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+jobject AdjustThirdPartySharing2dx::getThirdPartySharing() {
+ return thirdPartySharing;
+}
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ADJThirdPartySharing2dx AdjustThirdPartySharing2dx::getThirdPartySharing() {
+ return thirdPartySharing;
+}
+#endif
diff --git a/dist/AdjustThirdPartySharing2dx.h b/dist/AdjustThirdPartySharing2dx.h
new file mode 100755
index 00000000..57780997
--- /dev/null
+++ b/dist/AdjustThirdPartySharing2dx.h
@@ -0,0 +1,61 @@
+//
+// AdjustThirdPartySharing2dx.h
+// Adjust SDK
+//
+// Created by Uglješa Erceg (@uerceg) on 10th September 2021.
+// Copyright © 2021 Adjust GmbH. All rights reserved.
+//
+
+#ifndef ADJUST_ADJUSTTHIRDPARTYSHARING_H_
+#define ADJUST_ADJUSTTHIRDPARTYSHARING_H_
+
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+#include
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+#include "ADJThirdPartySharing2dx.h"
+#endif
+
+#include
+
+class AdjustThirdPartySharing2dx {
+private:
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ jobject thirdPartySharing;
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ bool isThirdPartySharingSet;
+ ADJThirdPartySharing2dx thirdPartySharing;
+#endif
+ void initThirdPartySharing();
+ void initThirdPartySharing(bool isEnabled);
+
+public:
+ // nullable workaround
+ // consider more meaningful API for v5
+ AdjustThirdPartySharing2dx() {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ initThirdPartySharing();
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ isThirdPartySharingSet = false;
+ initThirdPartySharing();
+#endif
+ }
+
+ AdjustThirdPartySharing2dx(bool isEnabled) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ initThirdPartySharing(isEnabled);
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ isThirdPartySharingSet = false;
+ initThirdPartySharing(isEnabled);
+#endif
+ }
+
+ void addGranularOption(std::string partnerName, std::string key, std::string value);
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ jobject getThirdPartySharing();
+};
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ ADJThirdPartySharing2dx getThirdPartySharing();
+};
+#endif
+
+#endif /* ADJUST_ADJUSTTHIRDPARTYSHARING_H_ */
diff --git a/doc/migrate.md b/doc/migrate.md
index 8216005c..29bcbd29 100644
--- a/doc/migrate.md
+++ b/doc/migrate.md
@@ -1,4 +1,4 @@
-## Migrate your Adjust SDK for Cocos2d-x to 4.28.0 from 4.0.x
+## Migrate your Adjust SDK for Cocos2d-x to 4.29.0 from 4.0.x
### SDK initialization
diff --git a/ext/android/proxy/adjust-android.jar b/ext/android/proxy/adjust-android.jar
index 32e9005d..3dfe74f0 100644
Binary files a/ext/android/proxy/adjust-android.jar and b/ext/android/proxy/adjust-android.jar differ
diff --git a/ext/android/proxy/adjust-test.jar b/ext/android/proxy/adjust-test-library.jar
similarity index 85%
rename from ext/android/proxy/adjust-test.jar
rename to ext/android/proxy/adjust-test-library.jar
index 0fad79c7..aa0f6346 100644
Binary files a/ext/android/proxy/adjust-test.jar and b/ext/android/proxy/adjust-test-library.jar differ
diff --git a/ext/android/proxy/inject_cpp_bridge.sh b/ext/android/proxy/inject_cpp_bridge.sh
index a0664c42..b83fad3b 100755
--- a/ext/android/proxy/inject_cpp_bridge.sh
+++ b/ext/android/proxy/inject_cpp_bridge.sh
@@ -24,8 +24,8 @@ echo -e "${CYAN}* [ADJUST-SDK-BUILD][CPP-BRIDGE]:${GREEN} Done! ${NC}"
# ======================================== #
if [ $# -eq 1 ] && [ $1 == --with-test-lib ]; then
- echo -e "${CYAN}* [ADJUST-SDK-BUILD][CPP-BRIDGE]:${GREEN} Unpacking adjust-test.jar file ... ${NC}"
- $JAVAC -cp "adjust-test.jar:$ANDROID_JAR" com/adjust/test/*.java
+ echo -e "${CYAN}* [ADJUST-SDK-BUILD][CPP-BRIDGE]:${GREEN} Unpacking adjust-test-library.jar file ... ${NC}"
+ $JAVAC -cp "adjust-test-library.jar:$ANDROID_JAR" com/adjust/test/*.java
echo -e "${CYAN}* [ADJUST-SDK-BUILD][CPP-BRIDGE]:${GREEN} Done! ${NC}"
fi
@@ -38,7 +38,7 @@ echo -e "${CYAN}* [ADJUST-SDK-BUILD][CPP-BRIDGE]:${GREEN} Done! ${NC}"
# ======================================== #
if [ $# -eq 1 ] && [ $1 == --with-test-lib ]; then
- echo -e "${CYAN}* [ADJUST-SDK-BUILD][CPP-BRIDGE]:${GREEN} Injecting C++ bridge Java classes to adjust-test.jar ... ${NC}"
- $JAR uf adjust-test.jar com/adjust/test/*.class
+ echo -e "${CYAN}* [ADJUST-SDK-BUILD][CPP-BRIDGE]:${GREEN} Injecting C++ bridge Java classes to adjust-test-library.jar ... ${NC}"
+ $JAR uf adjust-test-library.jar com/adjust/test/*.class
echo -e "${CYAN}* [ADJUST-SDK-BUILD][CPP-BRIDGE]:${GREEN} Done! ${NC}"
fi
\ No newline at end of file
diff --git a/ext/android/sdk b/ext/android/sdk
index 4d69036b..b45e397e 160000
--- a/ext/android/sdk
+++ b/ext/android/sdk
@@ -1 +1 @@
-Subproject commit 4d69036bf44285c03dff4d3ed94ef7839bc17a59
+Subproject commit b45e397e69e9e98ecec0f470b39647e4d1552985
diff --git a/ext/ios/sdk b/ext/ios/sdk
index 8790a530..43c5bb5e 160000
--- a/ext/ios/sdk
+++ b/ext/ios/sdk
@@ -1 +1 @@
-Subproject commit 8790a5300d00a11b8f51c7cc66c94165ac656f8c
+Subproject commit 43c5bb5eb8f77c72da856637dac5c46087c27848
diff --git a/libs/android/adjust-android.jar b/libs/android/adjust-android.jar
index 32e9005d..3dfe74f0 100644
Binary files a/libs/android/adjust-android.jar and b/libs/android/adjust-android.jar differ
diff --git a/libs/ios/AdjustSdk.framework/Versions/A/AdjustSdk b/libs/ios/AdjustSdk.framework/Versions/A/AdjustSdk
index 9c94430d..f3f7b085 100644
Binary files a/libs/ios/AdjustSdk.framework/Versions/A/AdjustSdk and b/libs/ios/AdjustSdk.framework/Versions/A/AdjustSdk differ
diff --git a/libs/ios/AdjustSdk.framework/Versions/A/Headers/ADJAdRevenue.h b/libs/ios/AdjustSdk.framework/Versions/A/Headers/ADJAdRevenue.h
new file mode 100644
index 00000000..4b167ad2
--- /dev/null
+++ b/libs/ios/AdjustSdk.framework/Versions/A/Headers/ADJAdRevenue.h
@@ -0,0 +1,80 @@
+//
+// ADJAdRevenue.h
+// Adjust SDK
+//
+// Created by Uglješa Erceg (@uerceg) on 13th April 2021
+// Copyright (c) 2021 Adjust GmbH. All rights reserved.
+//
+
+#import
+
+/**
+ * @brief Adjust ad revenue class.
+ */
+@interface ADJAdRevenue : NSObject
+
+/**
+ * @brief Ad revenue source value.
+ */
+@property (nonatomic, copy, readonly, nonnull) NSString *source;
+
+/**
+ * @brief Revenue value.
+ */
+@property (nonatomic, copy, readonly, nonnull) NSNumber *revenue;
+
+/**
+ * @brief Currency value.
+ */
+@property (nonatomic, copy, readonly, nonnull) NSString *currency;
+
+/**
+ * @brief Ad impressions count.
+ */
+@property (nonatomic, copy, readonly, nonnull) NSNumber *adImpressionsCount;
+
+/**
+ * @brief Ad revenue network.
+ */
+@property (nonatomic, copy, readonly, nonnull) NSString *adRevenueNetwork;
+
+/**
+ * @brief Ad revenue unit.
+ */
+@property (nonatomic, copy, readonly, nonnull) NSString *adRevenueUnit;
+
+/**
+ * @brief Ad revenue placement.
+ */
+@property (nonatomic, copy, readonly, nonnull) NSString *adRevenuePlacement;
+
+/**
+ * @brief List of partner parameters.
+ */
+@property (nonatomic, copy, readonly, nonnull) NSDictionary *partnerParameters;
+
+/**
+ * @brief List of callback parameters.
+ */
+@property (nonatomic, copy, readonly, nonnull) NSDictionary *callbackParameters;
+
+
+- (nullable id)initWithSource:(nonnull NSString *)source;
+
+- (void)setRevenue:(double)amount currency:(nonnull NSString *)currency;
+
+- (void)setAdImpressionsCount:(int)adImpressionsCount;
+
+- (void)setAdRevenueNetwork:(nonnull NSString *)adRevenueNetwork;
+
+- (void)setAdRevenueUnit:(nonnull NSString *)adRevenueUnit;
+
+- (void)setAdRevenuePlacement:(nonnull NSString *)adRevenuePlacement;
+
+- (void)addCallbackParameter:(nonnull NSString *)key value:(nonnull NSString *)value;
+
+- (void)addPartnerParameter:(nonnull NSString *)key value:(nonnull NSString *)value;
+
+- (BOOL)isValid;
+
+@end
diff --git a/libs/ios/AdjustSdk.framework/Versions/A/Headers/ADJConfig.h b/libs/ios/AdjustSdk.framework/Versions/A/Headers/ADJConfig.h
index b062cf98..bd7858c5 100644
--- a/libs/ios/AdjustSdk.framework/Versions/A/Headers/ADJConfig.h
+++ b/libs/ios/AdjustSdk.framework/Versions/A/Headers/ADJConfig.h
@@ -76,6 +76,13 @@
*/
- (BOOL)adjustDeeplinkResponse:(nullable NSURL *)deeplink;
+/**
+ * @brief Optional delegate method that gets called when Adjust SDK sets conversion value for the user.
+ *
+ * @param conversionValue Conversion value used by Adjust SDK to invoke updateConversionValue: API.
+ */
+- (void)adjustConversionValueUpdated:(nullable NSNumber *)conversionValue;
+
@end
/**
diff --git a/libs/ios/AdjustSdk.framework/Versions/A/Headers/ADJLinkResolution.h b/libs/ios/AdjustSdk.framework/Versions/A/Headers/ADJLinkResolution.h
new file mode 100644
index 00000000..469b2581
--- /dev/null
+++ b/libs/ios/AdjustSdk.framework/Versions/A/Headers/ADJLinkResolution.h
@@ -0,0 +1,17 @@
+//
+// ADJLinkResolution.h
+// Adjust
+//
+// Created by Pedro S. on 26.04.21.
+// Copyright © 2021 adjust GmbH. All rights reserved.
+//
+
+#import
+
+@interface ADJLinkResolution : NSObject
+
++ (void)resolveLinkWithUrl:(nonnull NSURL *)url
+ resolveUrlSuffixArray:(nullable NSArray *)resolveUrlSuffixArray
+ callback:(nonnull void (^)(NSURL *_Nullable resolvedLink))callback;
+
+@end
diff --git a/libs/ios/AdjustSdk.framework/Versions/A/Headers/Adjust.h b/libs/ios/AdjustSdk.framework/Versions/A/Headers/Adjust.h
index efe4dee1..90102401 100644
--- a/libs/ios/AdjustSdk.framework/Versions/A/Headers/Adjust.h
+++ b/libs/ios/AdjustSdk.framework/Versions/A/Headers/Adjust.h
@@ -1,10 +1,10 @@
//
// Adjust.h
-// Adjust
+// Adjust SDK
//
-// V4.28.0
-// Created by Christian Wellenbrock (wellle) on 23rd July 2013.
-// Copyright © 2012-2017 Adjust GmbH. All rights reserved.
+// V4.29.6
+// Created by Christian Wellenbrock (@wellle) on 23rd July 2013.
+// Copyright (c) 2012-2021 Adjust GmbH. All rights reserved.
//
#import "ADJEvent.h"
@@ -12,6 +12,8 @@
#import "ADJAttribution.h"
#import "ADJSubscription.h"
#import "ADJThirdPartySharing.h"
+#import "ADJAdRevenue.h"
+#import "ADJLinkResolution.h"
@interface AdjustTestOptions : NSObject
@@ -34,7 +36,7 @@
@end
/**
- * Constants for our supported tracking environments
+ * Constants for our supported tracking environments.
*/
extern NSString * __nonnull const ADJEnvironmentSandbox;
extern NSString * __nonnull const ADJEnvironmentProduction;
@@ -42,32 +44,20 @@ extern NSString * __nonnull const ADJEnvironmentProduction;
/**
* Constants for supported ad revenue sources.
*/
+extern NSString * __nonnull const ADJAdRevenueSourceAppLovinMAX;
extern NSString * __nonnull const ADJAdRevenueSourceMopub;
-extern NSString * __nonnull const ADJAdRevenueSourceAdmob;
-extern NSString * __nonnull const ADJAdRevenueSourceFbNativeAd;
-extern NSString * __nonnull const ADJAdRevenueSourceFbAudienceNetwork;
-extern NSString * __nonnull const ADJAdRevenueSourceIronsource;
-extern NSString * __nonnull const ADJAdRevenueSourceFyber;
-extern NSString * __nonnull const ADJAdRevenueSourceAerserv;
-extern NSString * __nonnull const ADJAdRevenueSourceAppodeal;
-extern NSString * __nonnull const ADJAdRevenueSourceAdincube;
-extern NSString * __nonnull const ADJAdRevenueSourceFusePowered;
-extern NSString * __nonnull const ADJAdRevenueSourceAddaptr;
-extern NSString * __nonnull const ADJAdRevenueSourceMillennialMeditation;
-extern NSString * __nonnull const ADJAdRevenueSourceFlurry;
-extern NSString * __nonnull const ADJAdRevenueSourceAdmost;
-extern NSString * __nonnull const ADJAdRevenueSourceDeltadna;
-extern NSString * __nonnull const ADJAdRevenueSourceUpsight;
-extern NSString * __nonnull const ADJAdRevenueSourceUnityads;
-extern NSString * __nonnull const ADJAdRevenueSourceAdtoapp;
-extern NSString * __nonnull const ADJAdRevenueSourceTapdaq;
-
-/**
- * Constants for country apps url strategies.
+extern NSString * __nonnull const ADJAdRevenueSourceAdMob;
+extern NSString * __nonnull const ADJAdRevenueSourceIronSource;
+extern NSString * __nonnull const ADJAdRevenueSourceAdMost;
+
+/**
+ * Constants for country app's URL strategies.
*/
extern NSString * __nonnull const ADJUrlStrategyIndia;
extern NSString * __nonnull const ADJUrlStrategyChina;
extern NSString * __nonnull const ADJDataResidencyEU;
+extern NSString * __nonnull const ADJDataResidencyTR;
+extern NSString * __nonnull const ADJDataResidencyUS;
/**
* @brief The main interface to Adjust.
@@ -277,10 +267,27 @@ extern NSString * __nonnull const ADJDataResidencyEU;
*/
+ (void)disableThirdPartySharing;
+/**
+ * @brief Track third paty sharing with possibility to allow or disallow it.
+ *
+ * @param thirdPartySharing Third party sharing choice.
+ */
+ (void)trackThirdPartySharing:(nonnull ADJThirdPartySharing *)thirdPartySharing;
+/**
+ * @brief Track measurement consent.
+ *
+ * @param enabled Value of the consent.
+ */
+ (void)trackMeasurementConsent:(BOOL)enabled;
+/**
+ * @brief Track ad revenue.
+ *
+ * @param adRevenue Ad revenue object instance containing all the relevant ad revenue tracking data.
+ */
++ (void)trackAdRevenue:(nonnull ADJAdRevenue *)adRevenue;
+
/**
* @brief Track subscription.
*
@@ -288,19 +295,37 @@ extern NSString * __nonnull const ADJDataResidencyEU;
*/
+ (void)trackSubscription:(nonnull ADJSubscription *)subscription;
+/**
+ * @brief Adjust wrapper for requestTrackingAuthorizationWithCompletionHandler: method.
+ *
+ * @param completion Block which value of tracking authorization status will be delivered to.
+ */
+ (void)requestTrackingAuthorizationWithCompletionHandler:(void (^_Nullable)(NSUInteger status))completion;
+/**
+ * @brief Getter for app tracking authorization status.
+ *
+ * return Value of app tracking authorization status.
+ */
+ (int)appTrackingAuthorizationStatus;
+/**
+ * @brief Adjust wrapper for updateConversionValue: method.
+ *
+ * @param conversionValue Conversion value you would like SDK to set for given user.
+ */
+ (void)updateConversionValue:(NSInteger)conversionValue;
/**
- * Obtain singleton Adjust object.
+ * @brief Method used for internal testing only. Don't use it in production.
*/
-+ (nullable id)getInstance;
-
+ (void)setTestOptions:(nullable AdjustTestOptions *)testOptions;
+/**
+ * Obtain singleton Adjust object.
+ */
++ (nullable instancetype)getInstance;
+
- (void)appDidLaunch:(nullable ADJConfig *)adjustConfig;
- (void)trackEvent:(nullable ADJEvent *)event;
@@ -359,4 +384,10 @@ extern NSString * __nonnull const ADJDataResidencyEU;
- (void)updateConversionValue:(NSInteger)conversionValue;
+- (void)trackThirdPartySharing:(nonnull ADJThirdPartySharing *)thirdPartySharing;
+
+- (void)trackMeasurementConsent:(BOOL)enabled;
+
+- (void)trackAdRevenue:(nonnull ADJAdRevenue *)adRevenue;
+
@end
diff --git a/scripts/build_sdk_android.py b/scripts/build_sdk_android.py
index 55e42881..3b9f489c 100644
--- a/scripts/build_sdk_android.py
+++ b/scripts/build_sdk_android.py
@@ -61,7 +61,7 @@ def build_test(root_dir, android_submodule_dir, configuration, app_path):
debug_green('Copying Adjust SDK and test JAR files to Cocos2d-x test app at {0} ...'.format(app_path))
create_dir_if_not_exist('{0}/proj.android/app/libs'.format(app_path))
copy_file('{0}/adjust-android.jar'.format(android_libs_dir), '{0}/proj.android/app/libs/adjust-android.jar'.format(app_path))
- copy_file('{0}/adjust-test.jar'.format(android_test_libs_dir), '{0}/proj.android/app/libs/adjust-test.jar'.format(app_path))
+ copy_file('{0}/adjust-test-library.jar'.format(android_test_libs_dir), '{0}/proj.android/app/libs/adjust-test-library.jar'.format(app_path))
copy_file('{0}/gson-2.8.6.jar'.format(android_test_libs_dir), '{0}/proj.android/app/libs/gson-2.8.6.jar'.format(app_path))
copy_file('{0}/Java-WebSocket-1.4.0.jar'.format(android_test_libs_dir), '{0}/proj.android/app/libs/Java-WebSocket-1.4.0.jar'.format(app_path))
copy_file('{0}/slf4j-api-1.7.30.jar'.format(android_test_libs_dir), '{0}/proj.android/app/libs/slf4j-api-1.7.30.jar'.format(app_path))
@@ -119,7 +119,7 @@ def _build_sdk(root_dir, android_submodule_dir, configuration, with_test_lib=Fal
# ------------------------------------------------------------------
# Copying Testing JAR from ${TESTLIB_JAR_IN_DIR} to ${PROXY_DIR}.
debug_green('Copying Testing JAR from {0} to {1} ...'.format(test_libs_in_dir, proxy_dir))
- copy_file('{0}/test-library-debug.jar'.format(test_libs_in_dir), '{0}/adjust-test.jar'.format(proxy_dir))
+ copy_file('{0}/test-library-debug.jar'.format(test_libs_in_dir), '{0}/adjust-test-library.jar'.format(proxy_dir))
# ------------------------------------------------------------------
# Injecting C++ bridge changes.
@@ -139,7 +139,7 @@ def _build_sdk(root_dir, android_submodule_dir, configuration, with_test_lib=Fal
copy_file('{0}/adjust-android.jar'.format(proxy_dir), '{0}/adjust-android.jar'.format(libs_out_dir))
# ------------------------------------------------------------------
- # Copying resulting adjust-test.jar into test libs out dir.
+ # Copying resulting adjust-test-library.jar into test libs out dir.
if with_test_lib:
- debug_green('Copying resulting adjust-test.jar into {0} ...'.format(test_libs_out_dir))
- copy_file('{0}/adjust-test.jar'.format(proxy_dir), '{0}/adjust-test.jar'.format(test_libs_out_dir))
+ debug_green('Copying resulting adjust-test-library.jar into {0} ...'.format(test_libs_out_dir))
+ copy_file('{0}/adjust-test-library.jar'.format(proxy_dir), '{0}/adjust-test-library.jar'.format(test_libs_out_dir))
diff --git a/src/ADJAdjust2dx.h b/src/ADJAdjust2dx.h
index e7b861ab..8c53ddab 100755
--- a/src/ADJAdjust2dx.h
+++ b/src/ADJAdjust2dx.h
@@ -14,6 +14,7 @@
#include "ADJEvent2dx.h"
#include "ADJConfig2dx.h"
#include "ADJAppStoreSubscription2dx.h"
+#include "ADJThirdPartySharing2dx.h"
#include "AdjustAttribution2dx.h"
extern const std::string ADJEnvironmentSandbox2dx;
@@ -46,6 +47,10 @@ class ADJAdjust2dx {
static std::string getSdkVersion();
static AdjustAttribution2dx getAttribution();
static void requestTrackingAuthorizationWithCompletionHandler(void (*trackingStatusCallback)(int status));
+ static int getAppTrackingAuthorizationStatus();
+ static void trackThirdPartySharing(ADJThirdPartySharing2dx thirdPartySharing);
+ static void trackMeasurementConsent(bool measurementConsent);
+ static void updateConversionValue(int conversionValue);
// For testing purposes only.
static void setTestOptions(std::map testOptionsMap);
static void teardown();
diff --git a/src/ADJAdjust2dx.mm b/src/ADJAdjust2dx.mm
index 790377ce..a6ae7b92 100755
--- a/src/ADJAdjust2dx.mm
+++ b/src/ADJAdjust2dx.mm
@@ -20,25 +20,29 @@
BOOL isSessionSuccessCallbackImplemented = NULL != adjustConfig.getSessionSuccessCallback() ? YES : NO;
BOOL isSessionFailureCallbackImplemented = NULL != adjustConfig.getSessionFailureCallback() ? YES : NO;
BOOL isDeferredDeeplinkCallbackImplemented = NULL != adjustConfig.getDeferredDeeplinkCallback() ? YES : NO;
+ BOOL isConversionValueUpdatedListenerImplemented = NULL != adjustConfig.getConversionValueUpdatedCallback() ? YES : NO;
if (isAttributionCallbackImplemented
|| isEventSuccessCallbackImplemented
|| isEventFailureCallbackImplemented
|| isSessionSuccessCallbackImplemented
|| isSessionFailureCallbackImplemented
- || isDeferredDeeplinkCallbackImplemented) {
+ || isDeferredDeeplinkCallbackImplemented
+ || isConversionValueUpdatedListenerImplemented) {
((ADJConfig *)adjustConfig.getConfig()).delegate = [ADJDelegate2dx getInstanceWithSwizzleOfAttributionCallback:isAttributionCallbackImplemented
swizzleOfEventSuccessCallback:isEventSuccessCallbackImplemented
swizzleOfEventFailureCallback:isEventFailureCallbackImplemented
swizzleOfSessionSuccessCallback:isSessionSuccessCallbackImplemented
swizzleOfSessionFailureCallback:isSessionFailureCallbackImplemented
swizzleOfDeferredDeeplinkCallback:isDeferredDeeplinkCallbackImplemented
+ swizzleOfConversionValueUpdatedCallback:isConversionValueUpdatedListenerImplemented
andAttributionCallbackId:adjustConfig.getAttributionCallback()
eventSuccessCallbackId:adjustConfig.getEventSuccessCallback()
eventFailureCallbackId:adjustConfig.getEventFailureCallback()
sessionSuccessCallbackId:adjustConfig.getSessionSuccessCallback()
sessionFailureCallbackId:adjustConfig.getSessionFailureCallback()
- deferredDeeplinkCallbackId:adjustConfig.getDeferredDeeplinkCallback()];
+ deferredDeeplinkCallbackId:adjustConfig.getDeferredDeeplinkCallback()
+ conversionValueUpdatedCallbackId:adjustConfig.getConversionValueUpdatedCallback()];
}
[Adjust appDidLaunch:(ADJConfig *)adjustConfig.getConfig()];
@@ -160,6 +164,9 @@
std::string creative;
std::string clickLabel;
std::string adid;
+ std::string costType;
+ double costAmount;
+ std::string costCurrency;
if (nil != attribution) {
if (attribution.trackerToken != NULL) {
@@ -186,9 +193,29 @@
if (attribution.adid != NULL) {
adid = std::string([attribution.adid UTF8String]);
}
+ if (attribution.costType != NULL) {
+ costType = std::string([attribution.costType UTF8String]);
+ }
+ if (attribution.costType != NULL) {
+ costAmount = [attribution.costAmount doubleValue];
+ }
+ if (attribution.costCurrency != NULL) {
+ costCurrency = std::string([attribution.costCurrency UTF8String]);
+ }
}
- AdjustAttribution2dx attribution2dx = AdjustAttribution2dx(trackerToken, trackerName, network, campaign, adgroup, creative, clickLabel, adid);
+ AdjustAttribution2dx attribution2dx = AdjustAttribution2dx(
+ trackerToken,
+ trackerName,
+ network,
+ campaign,
+ adgroup,
+ creative,
+ clickLabel,
+ adid,
+ costType,
+ costAmount,
+ costCurrency);
return attribution2dx;
}
@@ -198,6 +225,22 @@
}];
}
+int ADJAdjust2dx::getAppTrackingAuthorizationStatus() {
+ return [Adjust appTrackingAuthorizationStatus];
+}
+
+void ADJAdjust2dx::updateConversionValue(int conversionValue) {
+ [Adjust updateConversionValue:conversionValue];
+}
+
+void ADJAdjust2dx::trackThirdPartySharing(ADJThirdPartySharing2dx thirdPartySharing) {
+ [Adjust trackThirdPartySharing:(ADJThirdPartySharing *)thirdPartySharing.getThirdPartySharing()];
+}
+
+void ADJAdjust2dx::trackMeasurementConsent(bool measurementConsent) {
+ [Adjust trackMeasurementConsent:measurementConsent];
+}
+
void ADJAdjust2dx::setTestOptions(std::map testOptionsMap) {
AdjustTestOptions *testOptions = [[AdjustTestOptions alloc] init];
testOptions.baseUrl = [NSString stringWithUTF8String:testOptionsMap["baseUrl"].c_str()];
@@ -251,6 +294,13 @@
testOptions.iAdFrameworkEnabled = YES;
}
}
+ testOptions.adServicesFrameworkEnabled = NO;
+ if (testOptionsMap.find("adServicesFrameworkEnabled") != testOptionsMap.end()) {
+ NSString *adServicesFrameworkEnabled = [NSString stringWithUTF8String:testOptionsMap["adServicesFrameworkEnabled"].c_str()];
+ if ([adServicesFrameworkEnabled isEqualToString:@"true"]) {
+ testOptions.adServicesFrameworkEnabled = YES;
+ }
+ }
[Adjust setTestOptions:testOptions];
}
diff --git a/src/ADJConfig2dx.h b/src/ADJConfig2dx.h
index 959aed4f..7f93981f 100755
--- a/src/ADJConfig2dx.h
+++ b/src/ADJConfig2dx.h
@@ -23,7 +23,8 @@ enum ADJLogLevel2dx {
ADJLogLevel2dxWarn = 4,
ADJLogLevel2dxError = 5,
ADJLogLevel2dxAssert = 6,
- ADJLogLevel2dxSuppress = 7 };
+ ADJLogLevel2dxSuppress = 7
+};
class ADJConfig2dx {
private:
@@ -34,6 +35,7 @@ class ADJConfig2dx {
void (*sessionSuccessCallback)(AdjustSessionSuccess2dx sessionSuccess) = NULL;
void (*sessionFailureCallback)(AdjustSessionFailure2dx sessionFailure) = NULL;
bool (*deferredDeeplinkCallback)(std::string deeplink) = NULL;
+ void (*conversionValueUpdatedCallback)(int conversionValue) = NULL;
void initConfig(std::string appToken, std::string environment, bool allowSuppressLogLevel, std::string sdkPrefix);
public:
@@ -51,19 +53,22 @@ class ADJConfig2dx {
void setEventBufferingEnabled(bool isEnabled);
void setAllowIdfaReading(bool isAllowed);
void setAllowiAdInfoReading(bool isAllowed);
+ void setAllowAdServicesInfoReading(bool isAllowed);
+ void setNeedsCost(bool needsCost);
void setUserAgent(std::string userAgent);
void setDefaultTracker(std::string defaultTracker);
void setExternalDeviceId(std::string externalDeviceId);
void setAppSecret(long secretId, long info1, long info2, long info3, long info4);
void setIsDeviceKnown(bool isDeviceKnown);
void setUrlStrategy(std::string urlStrategy);
- void deactivateSKAdNetworkHandling();
+ void deactivateSkAdNetworkHandling();
void setAttributionCallback(void(*callbackMethod)(AdjustAttribution2dx attribution));
void setEventSuccessCallback(void(*callbackMethod)(AdjustEventSuccess2dx eventSuccess));
void setEventFailureCallback(void(*callbackMethod)(AdjustEventFailure2dx eventFailure));
void setSessionSuccessCallback(void(*callbackMethod)(AdjustSessionSuccess2dx sessionSuccess));
void setSessionFailureCallback(void(*callbackMethod)(AdjustSessionFailure2dx sessionFailure));
void setDeferredDeeplinkCallback(bool(*callbackMethod)(std::string deeplink));
+ void setConversionValueUpdatedCallback(void(*callbackMethod)(int conversionValue));
void* getConfig();
void(*getAttributionCallback())(AdjustAttribution2dx);
void(*getEventSuccessCallback())(AdjustEventSuccess2dx);
@@ -71,6 +76,7 @@ class ADJConfig2dx {
void(*getSessionSuccessCallback())(AdjustSessionSuccess2dx);
void(*getSessionFailureCallback())(AdjustSessionFailure2dx);
bool(*getDeferredDeeplinkCallback())(std::string);
+ void(*getConversionValueUpdatedCallback())(int);
};
#endif /* _ADJUST_ADJCONFIG2DX_H_ */
diff --git a/src/ADJConfig2dx.mm b/src/ADJConfig2dx.mm
index 14b2fda5..5c5fd13d 100755
--- a/src/ADJConfig2dx.mm
+++ b/src/ADJConfig2dx.mm
@@ -41,6 +41,14 @@
((ADJConfig *)config).allowiAdInfoReading = isAllowed;
}
+void ADJConfig2dx::setAllowAdServicesInfoReading(bool isAllowed) {
+ ((ADJConfig *)config).allowAdServicesInfoReading = isAllowed;
+}
+
+void ADJConfig2dx::setNeedsCost(bool needsCost) {
+ ((ADJConfig *)config).needsCost = needsCost;
+}
+
void ADJConfig2dx::setUserAgent(std::string userAgent) {
((ADJConfig *)config).userAgent = [NSString stringWithUTF8String:userAgent.c_str()];
}
@@ -59,10 +67,16 @@
((ADJConfig *)config).urlStrategy = ADJUrlStrategyChina;
} else if ([strUrlStrategy isEqualToString:@"india"]) {
((ADJConfig *)config).urlStrategy = ADJUrlStrategyIndia;
+ } else if ([strUrlStrategy isEqualToString:@"data-residency-eu"]) {
+ ((ADJConfig *)config).urlStrategy = ADJDataResidencyEU;
+ } else if ([strUrlStrategy isEqualToString:@"data-residency-tr"]) {
+ ((ADJConfig *)config).urlStrategy = ADJDataResidencyTR;
+ } else if ([strUrlStrategy isEqualToString:@"data-residency-us"]) {
+ ((ADJConfig *)config).urlStrategy = ADJDataResidencyUS;
}
}
-void ADJConfig2dx::deactivateSKAdNetworkHandling() {
+void ADJConfig2dx::deactivateSkAdNetworkHandling() {
[((ADJConfig *)config) deactivateSKAdNetworkHandling];
}
@@ -90,6 +104,10 @@
deferredDeeplinkCallback = callbackMethod;
}
+void ADJConfig2dx::setConversionValueUpdatedCallback(void(*callbackMethod)(int conversionValue)) {
+ conversionValueUpdatedCallback = callbackMethod;
+}
+
void* ADJConfig2dx::getConfig() {
return config;
}
@@ -125,3 +143,7 @@
bool(*ADJConfig2dx::getDeferredDeeplinkCallback())(std::string) {
return deferredDeeplinkCallback;
}
+
+void(*ADJConfig2dx::getConversionValueUpdatedCallback())(int) {
+ return conversionValueUpdatedCallback;
+}
diff --git a/src/ADJDelegate2dx.h b/src/ADJDelegate2dx.h
index 8033e2bc..3f931108 100644
--- a/src/ADJDelegate2dx.h
+++ b/src/ADJDelegate2dx.h
@@ -16,6 +16,7 @@
@property (nonatomic) void (*sessionSuccessCallbackMethod)(AdjustSessionSuccess2dx sessionSuccess);
@property (nonatomic) void (*sessionFailureCallbackMethod)(AdjustSessionFailure2dx sessionFailure);
@property (nonatomic) bool (*deferredDeeplinkCallbackMethod)(std::string deeplink);
+@property (nonatomic) void (*conversionValueUpdatedCallbackMethod)(int conversionValue);
+ (id)getInstanceWithSwizzleOfAttributionCallback:(BOOL)swizzleAttributionCallback
swizzleOfEventSuccessCallback:(BOOL)swizzleEventSuccessCallback
@@ -23,12 +24,14 @@
swizzleOfSessionSuccessCallback:(BOOL)swizzleSessionSuccessCallback
swizzleOfSessionFailureCallback:(BOOL)swizzleSessionFailureCallback
swizzleOfDeferredDeeplinkCallback:(BOOL)swizzleDeferredDeeplinkCallback
- andAttributionCallbackId:(void (*)(AdjustAttribution2dx attribution))attributionCallbackId
+ swizzleOfConversionValueUpdatedCallback:(BOOL)swizzleConversionValueUpdatedCallback
+ andAttributionCallbackId:(void (*)(AdjustAttribution2dx attribution))attributionCallbackId
eventSuccessCallbackId:(void (*)(AdjustEventSuccess2dx eventSuccess))eventSuccessCallbackId
eventFailureCallbackId:(void (*)(AdjustEventFailure2dx eventFailure))eventFailureCallbackId
sessionSuccessCallbackId:(void (*)(AdjustSessionSuccess2dx sessionSuccess))sessionSuccessCallbackId
sessionFailureCallbackId:(void (*)(AdjustSessionFailure2dx sessionFailure))sessionFailureCallbackId
- deferredDeeplinkCallbackId:(bool (*)(std::string deeplink))deferredDeeplinkCallbackId;
+ deferredDeeplinkCallbackId:(bool (*)(std::string deeplink))deferredDeeplinkCallbackId
+ conversionValueUpdatedCallbackId:(void (*)(int conversionValue))conversionValueUpdatedCallbackId;
+ (void)teardown;
@end
diff --git a/src/ADJDelegate2dx.mm b/src/ADJDelegate2dx.mm
index 572b6497..a8e77bff 100644
--- a/src/ADJDelegate2dx.mm
+++ b/src/ADJDelegate2dx.mm
@@ -21,12 +21,14 @@ + (id)getInstanceWithSwizzleOfAttributionCallback:(BOOL)swizzleAttributionCallba
swizzleOfSessionSuccessCallback:(BOOL)swizzleSessionSuccessCallback
swizzleOfSessionFailureCallback:(BOOL)swizzleSessionFailureCallback
swizzleOfDeferredDeeplinkCallback:(BOOL)swizzleDeferredDeeplinkCallback
+ swizzleOfConversionValueUpdatedCallback:(BOOL)swizzleConversionValueUpdatedCallback
andAttributionCallbackId:(void (*)(AdjustAttribution2dx attribution))attributionCallbackId
eventSuccessCallbackId:(void (*)(AdjustEventSuccess2dx eventSuccess))eventSuccessCallbackId
eventFailureCallbackId:(void (*)(AdjustEventFailure2dx eventFailure))eventFailureCallbackId
sessionSuccessCallbackId:(void (*)(AdjustSessionSuccess2dx sessionSuccess))sessionSuccessCallbackId
sessionFailureCallbackId:(void (*)(AdjustSessionFailure2dx sessionFailure))sessionFailureCallbackId
- deferredDeeplinkCallbackId:(bool (*)(std::string deeplink))deferredDeeplinkCallbackId {
+ deferredDeeplinkCallbackId:(bool (*)(std::string deeplink))deferredDeeplinkCallbackId
+ conversionValueUpdatedCallbackId:(void (*)(int conversionValue))conversionValueUpdatedCallbackId {
dispatch_once(&onceToken, ^{
defaultInstance = [[ADJDelegate2dx alloc] init];
@@ -55,6 +57,10 @@ + (id)getInstanceWithSwizzleOfAttributionCallback:(BOOL)swizzleAttributionCallba
[defaultInstance swizzleCallbackMethod:@selector(adjustDeeplinkResponse:)
swizzledSelector:@selector(adjustDeeplinkResponseWannabe:)];
}
+ if (swizzleConversionValueUpdatedCallback) {
+ [defaultInstance swizzleCallbackMethod:@selector(adjustConversionValueUpdated:)
+ swizzledSelector:@selector(adjustConversionValueUpdatedWannabe:)];
+ }
[defaultInstance setAttributionCallbackMethod:attributionCallbackId];
[defaultInstance setEventSuccessCallbackMethod:eventSuccessCallbackId];
@@ -62,6 +68,7 @@ + (id)getInstanceWithSwizzleOfAttributionCallback:(BOOL)swizzleAttributionCallba
[defaultInstance setSessionSuccessCallbackMethod:sessionSuccessCallbackId];
[defaultInstance setSessionFailureCallbackMethod:sessionFailureCallbackId];
[defaultInstance setDeferredDeeplinkCallbackMethod:deferredDeeplinkCallbackId];
+ [defaultInstance setConversionValueUpdatedCallbackMethod:conversionValueUpdatedCallbackId];
});
return defaultInstance;
@@ -97,6 +104,9 @@ - (void)adjustAttributionChangedWannabe:(ADJAttribution *)attribution {
[self addValueOrEmpty:dictionary key:@"adgroup" value:attribution.adgroup];
[self addValueOrEmpty:dictionary key:@"clickLabel" value:attribution.clickLabel];
[self addValueOrEmpty:dictionary key:@"adid" value:attribution.adid];
+ [self addValueOrEmpty:dictionary key:@"costType" value:attribution.costType];
+ [self addValueOrEmpty:dictionary key:@"costAmount" value:attribution.costAmount];
+ [self addValueOrEmpty:dictionary key:@"costCurrency" value:attribution.costCurrency];
std::string trackerToken = std::string([[dictionary objectForKey:@"trackerToken"] UTF8String]);
std::string trackerName = std::string([[dictionary objectForKey:@"trackerName"] UTF8String]);
@@ -106,8 +116,22 @@ - (void)adjustAttributionChangedWannabe:(ADJAttribution *)attribution {
std::string adgroup = std::string([[dictionary objectForKey:@"adgroup"] UTF8String]);
std::string clickLabel = std::string([[dictionary objectForKey:@"clickLabel"] UTF8String]);
std::string adid = std::string([[dictionary objectForKey:@"adid"] UTF8String]);
+ std::string costType = std::string([[dictionary objectForKey:@"costType"] UTF8String]);
+ double costAmount = [dictionary objectForKey:@"costAmount"] != nil ? [[dictionary objectForKey:@"costAmount"] doubleValue] : 0;
+ std::string costCurrency = std::string([[dictionary objectForKey:@"costCurrency"] UTF8String]);
- AdjustAttribution2dx attribution2dx = AdjustAttribution2dx(trackerToken, trackerName, network, campaign, adgroup, creative, clickLabel, adid);
+ AdjustAttribution2dx attribution2dx = AdjustAttribution2dx(
+ trackerToken,
+ trackerName,
+ network,
+ campaign,
+ adgroup,
+ creative,
+ clickLabel,
+ adid,
+ costType,
+ costAmount,
+ costCurrency);
_attributionCallbackMethod(attribution2dx);
}
@@ -233,6 +257,13 @@ - (BOOL)adjustDeeplinkResponseWannabe:(NSURL *)deeplink {
return _deferredDeeplinkCallbackMethod(strDeeplink);
}
+- (void)adjustConversionValueUpdatedWannabe:(NSNumber *)conversionValue {
+ if (conversionValue == nil) {
+ return;
+ }
+ _conversionValueUpdatedCallbackMethod([conversionValue intValue]);
+}
+
- (void)swizzleCallbackMethod:(SEL)originalSelector
swizzledSelector:(SEL)swizzledSelector {
Class cls = [self class];
@@ -256,7 +287,13 @@ - (void)addValueOrEmpty:(NSMutableDictionary *)dictionary
key:(NSString *)key
value:(NSObject *)value {
if (nil != value) {
- [dictionary setObject:[NSString stringWithFormat:@"%@", value] forKey:key];
+ if ([value isKindOfClass:[NSString class]]) {
+ [dictionary setObject:[NSString stringWithFormat:@"%@", value] forKey:key];
+ } else if ([value isKindOfClass:[NSNumber class]]) {
+ [dictionary setObject:[NSString stringWithFormat:@"%@", [((NSNumber *)value) stringValue]] forKey:key];
+ } else {
+ [dictionary setObject:@"" forKey:key];
+ }
} else {
[dictionary setObject:@"" forKey:key];
}
diff --git a/src/ADJThirdPartySharing2dx.h b/src/ADJThirdPartySharing2dx.h
new file mode 100755
index 00000000..60f01422
--- /dev/null
+++ b/src/ADJThirdPartySharing2dx.h
@@ -0,0 +1,32 @@
+//
+// ADJThirdPartySharing2dx.h
+// Adjust SDK
+//
+// Created by Uglješa Erceg (@uerceg) on 10th September 2021.
+// Copyright © 2021 Adjust GmbH. All rights reserved.
+//
+
+#ifndef _ADJUST_ADJTHIRDPARTYSHARING2DX_H_
+#define _ADJUST_ADJTHIRDPARTYSHARING2DX_H_
+
+#include
+
+class ADJThirdPartySharing2dx {
+private:
+ void* thirdPartySharing;
+ void initThirdPartySharing();
+ void initThirdPartySharing(bool isEnabled);
+
+public:
+ ADJThirdPartySharing2dx() {
+ initThirdPartySharing();
+ }
+ ADJThirdPartySharing2dx(bool isEnabled) {
+ initThirdPartySharing(isEnabled);
+ }
+
+ void addGranularOption(std::string partnerName, std::string key, std::string value);
+ void* getThirdPartySharing();
+};
+
+#endif /* _ADJUST_ADJTHIRDPARTYSHARING2DX_H_ */
diff --git a/src/ADJThirdPartySharing2dx.mm b/src/ADJThirdPartySharing2dx.mm
new file mode 100755
index 00000000..692d5a0c
--- /dev/null
+++ b/src/ADJThirdPartySharing2dx.mm
@@ -0,0 +1,28 @@
+//
+// ADJThirdPartySharing2dx.mm
+// Adjust SDK
+//
+// Created by Uglješa Erceg (@uerceg) on 10th September 2015.
+// Copyright © 2021 Adjust GmbH. All rights reserved.
+//
+
+#include "ADJThirdPartySharing2dx.h"
+#include
+
+void ADJThirdPartySharing2dx::initThirdPartySharing() {
+ thirdPartySharing = [[ADJThirdPartySharing alloc] initWithIsEnabledNumberBool:nil];
+}
+
+void ADJThirdPartySharing2dx::initThirdPartySharing(bool isEnabled) {
+ thirdPartySharing = [[ADJThirdPartySharing alloc] initWithIsEnabledNumberBool:[NSNumber numberWithBool:isEnabled]];
+}
+
+void ADJThirdPartySharing2dx::addGranularOption(std::string partnerName, std::string key, std::string value) {
+ [((ADJThirdPartySharing *)thirdPartySharing) addGranularOption:[NSString stringWithUTF8String:partnerName.c_str()]
+ key:[NSString stringWithUTF8String:key.c_str()]
+ value:[NSString stringWithUTF8String:value.c_str()]];
+}
+
+void* ADJThirdPartySharing2dx::getThirdPartySharing() {
+ return thirdPartySharing;
+}
diff --git a/src/Adjust2dx.cpp b/src/Adjust2dx.cpp
index 6f508292..c5561218 100755
--- a/src/Adjust2dx.cpp
+++ b/src/Adjust2dx.cpp
@@ -309,6 +309,30 @@ void Adjust2dx::disableThirdPartySharing() {
#endif
}
+void Adjust2dx::trackThirdPartySharing(AdjustThirdPartySharing2dx thirdPartySharing) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ cocos2d::JniMethodInfo jmiTrackThirdPartySharing;
+ if (!cocos2d::JniHelper::getStaticMethodInfo(jmiTrackThirdPartySharing, "com/adjust/sdk/Adjust", "trackThirdPartySharing", "(Lcom/adjust/sdk/AdjustThirdPartySharing;)V")) {
+ return;
+ }
+ jmiTrackThirdPartySharing.env->CallStaticVoidMethod(jmiTrackThirdPartySharing.classID, jmiTrackThirdPartySharing.methodID, thirdPartySharing.getThirdPartySharing());
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ ADJAdjust2dx::trackThirdPartySharing(thirdPartySharing.getThirdPartySharing());
+#endif
+}
+
+void Adjust2dx::trackMeasurementConsent(bool measurementConsent) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ cocos2d::JniMethodInfo jmiTrackMeasurementConsent;
+ if (!cocos2d::JniHelper::getStaticMethodInfo(jmiTrackMeasurementConsent, "com/adjust/sdk/Adjust", "trackMeasurementConsent", "(Z)V")) {
+ return;
+ }
+ jmiTrackMeasurementConsent.env->CallStaticVoidMethod(jmiTrackMeasurementConsent.classID, jmiTrackMeasurementConsent.methodID, measurementConsent);
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ ADJAdjust2dx::trackMeasurementConsent(measurementConsent);
+#endif
+}
+
std::string Adjust2dx::getAdid() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return ADJAdjust2dx::getAdid();
@@ -363,10 +387,24 @@ AdjustAttribution2dx Adjust2dx::getAttribution() {
std::string creative;
std::string clickLabel;
std::string adid;
+ std::string costType;
+ double costAmount;
+ std::string costCurrency;
cocos2d::JniMethodInfo jmiGetAttribution;
if (!cocos2d::JniHelper::getStaticMethodInfo(jmiGetAttribution, "com/adjust/sdk/Adjust", "getAttribution", "()Lcom/adjust/sdk/AdjustAttribution;")) {
- AdjustAttribution2dx attribution2dx = AdjustAttribution2dx(trackerToken, trackerName, network, campaign, adgroup, creative, clickLabel, adid);
+ AdjustAttribution2dx attribution2dx = AdjustAttribution2dx(
+ trackerToken,
+ trackerName,
+ network,
+ campaign,
+ adgroup,
+ creative,
+ clickLabel,
+ adid,
+ costType,
+ costAmount,
+ costCurrency);
return attribution2dx;
}
@@ -381,6 +419,9 @@ AdjustAttribution2dx Adjust2dx::getAttribution() {
jfieldID jfidCreative = jmiGetAttribution.env->GetFieldID(clsAdjustAttribution, "creative", "Ljava/lang/String;");
jfieldID jfidClickLabel = jmiGetAttribution.env->GetFieldID(clsAdjustAttribution, "clickLabel", "Ljava/lang/String;");
jfieldID jfidAdid = jmiGetAttribution.env->GetFieldID(clsAdjustAttribution, "adid", "Ljava/lang/String;");
+ jfieldID jfidCostType = jmiGetAttribution.env->GetFieldID(clsAdjustAttribution, "costType", "Ljava/lang/String;");
+ jfieldID jfidCostAmount = jmiGetAttribution.env->GetFieldID(clsAdjustAttribution, "costAmount", "Ljava/lang/Double;");
+ jfieldID jfidCostCurrency = jmiGetAttribution.env->GetFieldID(clsAdjustAttribution, "costCurrency", "Ljava/lang/String;");
jstring jTrackerToken = (jstring)jmiGetAttribution.env->GetObjectField(jAttribution, jfidTrackerToken);
jstring jTrackerName = (jstring)jmiGetAttribution.env->GetObjectField(jAttribution, jfidTrackerName);
jstring jNetwork = (jstring)jmiGetAttribution.env->GetObjectField(jAttribution, jfidNetwork);
@@ -389,6 +430,9 @@ AdjustAttribution2dx Adjust2dx::getAttribution() {
jstring jCreative = (jstring)jmiGetAttribution.env->GetObjectField(jAttribution, jfidCreative);
jstring jClickLabel = (jstring)jmiGetAttribution.env->GetObjectField(jAttribution, jfidClickLabel);
jstring jAdid = (jstring)jmiGetAttribution.env->GetObjectField(jAttribution, jfidAdid);
+ jstring jCostType = (jstring)jmiGetAttribution.env->GetObjectField(jAttribution, jfidCostType);
+ jobject jCostAmount = jmiGetAttribution.env->GetObjectField(jAttribution, jfidCostAmount);
+ jstring jCostCurrency = (jstring)jmiGetAttribution.env->GetObjectField(jAttribution, jfidCostCurrency);
if (NULL != jTrackerToken) {
const char *trackerTokenCStr = jmiGetAttribution.env->GetStringUTFChars(jTrackerToken, NULL);
@@ -461,9 +505,46 @@ AdjustAttribution2dx Adjust2dx::getAttribution() {
} else {
adid = "";
}
+
+ if (NULL != jCostType) {
+ const char *costTypeCStr = jmiGetAttribution.env->GetStringUTFChars(jCostType, NULL);
+ costType = std::string(costTypeCStr);
+ jmiGetAttribution.env->ReleaseStringUTFChars(jCostType, costTypeCStr);
+ jmiGetAttribution.env->DeleteLocalRef(jCostType);
+ } else {
+ costType = "";
+ }
+
+ if (NULL != jCostAmount) {
+ jclass jcDouble = jmiGetAttribution.env->FindClass("java/lang/Double");
+ jmethodID jmidDoubleValue = jmiGetAttribution.env->GetMethodID(jcDouble, "doubleValue", "()D" );
+ costAmount = jmiGetAttribution.env->CallDoubleMethod(jCostAmount, jmidDoubleValue);
+ } else {
+ costAmount = 0;
+ }
+
+ if (NULL != jCostCurrency) {
+ const char *costCurrencyCStr = jmiGetAttribution.env->GetStringUTFChars(jCostCurrency, NULL);
+ costCurrency = std::string(costCurrencyCStr);
+ jmiGetAttribution.env->ReleaseStringUTFChars(jCostCurrency, costCurrencyCStr);
+ jmiGetAttribution.env->DeleteLocalRef(jCostCurrency);
+ } else {
+ costCurrency = "";
+ }
}
- AdjustAttribution2dx attribution2dx = AdjustAttribution2dx(trackerToken, trackerName, network, campaign, adgroup, creative, clickLabel, adid);
+ AdjustAttribution2dx attribution2dx = AdjustAttribution2dx(
+ trackerToken,
+ trackerName,
+ network,
+ campaign,
+ adgroup,
+ creative,
+ clickLabel,
+ adid,
+ costType,
+ costAmount,
+ costCurrency);
return attribution2dx;
#endif
}
@@ -579,6 +660,12 @@ void Adjust2dx::requestTrackingAuthorizationWithCompletionHandler(void (*trackin
#endif
}
+void Adjust2dx::updateConversionValue(int conversionValue) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ ADJAdjust2dx::updateConversionValue(conversionValue);
+#endif
+}
+
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
jobject getTestOptions(std::map testOptions) {
cocos2d::JniMethodInfo jmiInit;
diff --git a/src/Adjust2dx.h b/src/Adjust2dx.h
index 6900addd..7236c7dd 100755
--- a/src/Adjust2dx.h
+++ b/src/Adjust2dx.h
@@ -16,6 +16,7 @@
#include "AdjustAttribution2dx.h"
#include "AdjustAppStoreSubscription2dx.h"
#include "AdjustPlayStoreSubscription2dx.h"
+#include "AdjustThirdPartySharing2dx.h"
extern const std::string AdjustEnvironmentSandbox2dx;
extern const std::string AdjustEnvironmentProduction2dx;
@@ -39,6 +40,8 @@ class Adjust2dx {
static void resetSessionPartnerParameters();
static void trackAdRevenue(std::string source, std::string payload);
static void disableThirdPartySharing();
+ static void trackThirdPartySharing(AdjustThirdPartySharing2dx thirdPartySharing);
+ static void trackMeasurementConsent(bool measurementConsent);
static std::string getAdid();
static std::string getSdkVersion();
static AdjustAttribution2dx getAttribution();
@@ -53,6 +56,8 @@ class Adjust2dx {
static std::string getIdfa();
static void trackAppStoreSubscription(AdjustAppStoreSubscription2dx subscription);
static void requestTrackingAuthorizationWithCompletionHandler(void (*trackingStatusCallback)(int status));
+ static int getAppTrackingAuthorizationStatus();
+ static void updateConversionValue(int conversionValue);
// For testing purposes only.
static void setTestOptions(std::map testOptions);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
diff --git a/src/AdjustAttribution2dx.cpp b/src/AdjustAttribution2dx.cpp
index 0d32948a..7b8ce6d6 100755
--- a/src/AdjustAttribution2dx.cpp
+++ b/src/AdjustAttribution2dx.cpp
@@ -39,3 +39,15 @@ std::string AdjustAttribution2dx::getClickLabel() {
std::string AdjustAttribution2dx::getAdid() {
return this->adid;
}
+
+std::string AdjustAttribution2dx::getCostType() {
+ return this->costType;
+}
+
+double AdjustAttribution2dx::getCostAmount() {
+ return this->costAmount;
+}
+
+std::string AdjustAttribution2dx::getCostCurrency() {
+ return this->costCurrency;
+}
diff --git a/src/AdjustAttribution2dx.h b/src/AdjustAttribution2dx.h
index 8af98cc0..557a2cd1 100755
--- a/src/AdjustAttribution2dx.h
+++ b/src/AdjustAttribution2dx.h
@@ -21,6 +21,9 @@ class AdjustAttribution2dx {
std::string creative;
std::string clickLabel;
std::string adid;
+ std::string costType;
+ double costAmount;
+ std::string costCurrency;
public:
AdjustAttribution2dx() {}
AdjustAttribution2dx(
@@ -31,7 +34,10 @@ class AdjustAttribution2dx {
std::string adgroup,
std::string creative,
std::string clickLabel,
- std::string adid) {
+ std::string adid,
+ std::string costType,
+ double costAmount,
+ std::string costCurrency) {
this->trackerToken = trackerToken;
this->trackerName = trackerName;
this->network = network;
@@ -40,6 +46,9 @@ class AdjustAttribution2dx {
this->creative = creative;
this->clickLabel = clickLabel;
this->adid = adid;
+ this->costType = costType;
+ this->costAmount = costAmount;
+ this->costCurrency = costCurrency;
}
std::string getTrackerToken();
@@ -50,6 +59,9 @@ class AdjustAttribution2dx {
std::string getCreative();
std::string getClickLabel();
std::string getAdid();
+ std::string getCostType();
+ double getCostAmount();
+ std::string getCostCurrency();
};
#endif /* ADJUST_ADJUSTATTRIBUTION2DX_H_ */
diff --git a/src/AdjustConfig2dx.cpp b/src/AdjustConfig2dx.cpp
index 364115f5..b3ee7fb1 100755
--- a/src/AdjustConfig2dx.cpp
+++ b/src/AdjustConfig2dx.cpp
@@ -15,9 +15,12 @@
#include "AdjustConfig2dx.h"
USING_NS_CC;
-const std::string AdjustSdkPrefix2dx = "cocos2d-x4.28.0";
+const std::string AdjustSdkPrefix2dx = "cocos2d-x4.29.0";
const std::string AdjustUrlStrategyChina = "china";
const std::string AdjustUrlStrategyIndia = "india";
+const std::string AdjustDataResidencyEU = "data-residency-eu";
+const std::string AdjustDataResidencyTR = "data-residency-tr";
+const std::string AdjustDataResidencyUS = "data-residency-us";
void AdjustConfig2dx::initConfig(std::string appToken, std::string environment, bool allowSuppressLogLevel) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
@@ -168,6 +171,27 @@ void AdjustConfig2dx::setEventBufferingEnabled(bool isEnabled) {
#endif
}
+void AdjustConfig2dx::setNeedsCost(bool needsCost) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ if (config == NULL) {
+ return;
+ }
+ cocos2d::JniMethodInfo jmiSetNeedsCost;
+ if (!cocos2d::JniHelper::getMethodInfo(jmiSetNeedsCost, "com/adjust/sdk/AdjustConfig", "setNeedsCost", "(Ljava/lang/Boolean;)V")) {
+ return;
+ }
+
+ jclass jclsBoolean = jmiSetNeedsCost.env->FindClass("java/lang/Boolean");
+ jmethodID jmidValueOf = jmiSetNeedsCost.env->GetStaticMethodID(jclsBoolean, "valueOf", "(Z)Ljava/lang/Boolean;");
+ jobject jNeedsCost = jmiSetNeedsCost.env->CallStaticObjectMethod(jclsBoolean, jmidValueOf, needsCost);
+ jmiSetNeedsCost.env->CallVoidMethod(config, jmiSetNeedsCost.methodID, jNeedsCost);
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ if (isConfigSet) {
+ config.setNeedsCost(needsCost);
+ }
+#endif
+}
+
void AdjustConfig2dx::setAllowIdfaReading(bool isAllowed) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
@@ -186,6 +210,15 @@ void AdjustConfig2dx::setAllowiAdInfoReading(bool isAllowed) {
#endif
}
+void AdjustConfig2dx::setAllowAdServicesInfoReading(bool isAllowed) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ if (isConfigSet) {
+ config.setAllowAdServicesInfoReading(isAllowed);
+ }
+#endif
+}
+
void AdjustConfig2dx::setUserAgent(std::string userAgent) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
cocos2d::JniMethodInfo jmiSetUserAgent;
@@ -265,6 +298,24 @@ void AdjustConfig2dx::setUrlStrategy(std::string urlStrategy) {
jstring jUrlStrategyIndia = (jstring)jmiSetUrlStrategy.env->GetStaticObjectField(jclsAdjustConfig, jfidUrlStrategyIndia);
jmiSetUrlStrategy.env->CallVoidMethod(config, jmiSetUrlStrategy.methodID, jUrlStrategyIndia);
jmiSetUrlStrategy.env->DeleteLocalRef(jUrlStrategyIndia);
+ } else if (urlStrategy.compare(AdjustDataResidencyEU) == 0) {
+ jclass jclsAdjustConfig = jmiSetUrlStrategy.env->FindClass("com/adjust/sdk/AdjustConfig");
+ jfieldID jfidDataResidencyEU = jmiSetUrlStrategy.env->GetStaticFieldID(jclsAdjustConfig, "DATA_RESIDENCY_EU", "Ljava/lang/String;");
+ jstring jDataResidencyEU = (jstring)jmiSetUrlStrategy.env->GetStaticObjectField(jclsAdjustConfig, jfidDataResidencyEU);
+ jmiSetUrlStrategy.env->CallVoidMethod(config, jmiSetUrlStrategy.methodID, jDataResidencyEU);
+ jmiSetUrlStrategy.env->DeleteLocalRef(jDataResidencyEU);
+ } else if (urlStrategy.compare(AdjustDataResidencyTR) == 0) {
+ jclass jclsAdjustConfig = jmiSetUrlStrategy.env->FindClass("com/adjust/sdk/AdjustConfig");
+ jfieldID jfidDataResidencyTR = jmiSetUrlStrategy.env->GetStaticFieldID(jclsAdjustConfig, "DATA_RESIDENCY_TR", "Ljava/lang/String;");
+ jstring jDataResidencyTR = (jstring)jmiSetUrlStrategy.env->GetStaticObjectField(jclsAdjustConfig, jfidDataResidencyTR);
+ jmiSetUrlStrategy.env->CallVoidMethod(config, jmiSetUrlStrategy.methodID, jDataResidencyTR);
+ jmiSetUrlStrategy.env->DeleteLocalRef(jDataResidencyTR);
+ } else if (urlStrategy.compare(AdjustDataResidencyUS) == 0) {
+ jclass jclsAdjustConfig = jmiSetUrlStrategy.env->FindClass("com/adjust/sdk/AdjustConfig");
+ jfieldID jfidDataResidencyUS = jmiSetUrlStrategy.env->GetStaticFieldID(jclsAdjustConfig, "DATA_RESIDENCY_US", "Ljava/lang/String;");
+ jstring jDataResidencyUS = (jstring)jmiSetUrlStrategy.env->GetStaticObjectField(jclsAdjustConfig, jfidDataResidencyUS);
+ jmiSetUrlStrategy.env->CallVoidMethod(config, jmiSetUrlStrategy.methodID, jDataResidencyUS);
+ jmiSetUrlStrategy.env->DeleteLocalRef(jDataResidencyUS);
}
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
if (isConfigSet) {
@@ -273,6 +324,44 @@ void AdjustConfig2dx::setUrlStrategy(std::string urlStrategy) {
#endif
}
+void AdjustConfig2dx::setPreinstallTrackingEnabled(bool isEnabled) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ if (config == NULL) {
+ return;
+ }
+ cocos2d::JniMethodInfo jmiSetPreinstallTrackingEnabled;
+ if (!cocos2d::JniHelper::getMethodInfo(jmiSetPreinstallTrackingEnabled, "com/adjust/sdk/AdjustConfig", "jmiSetPreinstallTrackingEnabled", "(Ljava/lang/Boolean;)V")) {
+ return;
+ }
+
+ jclass jclsBoolean = jmiSetPreinstallTrackingEnabled.env->FindClass("java/lang/Boolean");
+ jmethodID jmidValueOf = jmiSetPreinstallTrackingEnabled.env->GetStaticMethodID(jclsBoolean, "valueOf", "(Z)Ljava/lang/Boolean;");
+ jobject jIsEnabled = jmiSetPreinstallTrackingEnabled.env->CallStaticObjectMethod(jclsBoolean, jmidValueOf, isEnabled);
+ jmiSetPreinstallTrackingEnabled.env->CallVoidMethod(config, jmiSetPreinstallTrackingEnabled.methodID, jIsEnabled);
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+#endif
+}
+
+void AdjustConfig2dx::setPreinstallFilePath(std::string externalDeviceId) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ if (config == NULL) {
+ return;
+ }
+ cocos2d::JniMethodInfo jmiSetExternalDeviceId;
+ if (!cocos2d::JniHelper::getMethodInfo(jmiSetExternalDeviceId, "com/adjust/sdk/AdjustConfig", "setExternalDeviceId", "(Ljava/lang/String;)V")) {
+ return;
+ }
+
+ jstring jExternalDeviceId = jmiSetExternalDeviceId.env->NewStringUTF(externalDeviceId.c_str());
+ jmiSetExternalDeviceId.env->CallVoidMethod(config, jmiSetExternalDeviceId.methodID, jExternalDeviceId);
+ jmiSetExternalDeviceId.env->DeleteLocalRef(jExternalDeviceId);
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ if (isConfigSet) {
+ config.setExternalDeviceId(externalDeviceId);
+ }
+#endif
+}
+
void AdjustConfig2dx::setAppSecret(unsigned long long secretId, unsigned long long info1, unsigned long long info2, unsigned long long info3, unsigned long long info4) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
if (config == NULL) {
@@ -307,10 +396,10 @@ void AdjustConfig2dx::setDeviceKnown(bool isDeviceKnown) {
#endif
}
-void AdjustConfig2dx::deactivateSKAdNetworkHandling() {
+void AdjustConfig2dx::deactivateSkAdNetworkHandling() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
if (isConfigSet) {
- config.deactivateSKAdNetworkHandling();
+ config.deactivateSkAdNetworkHandling();
}
#endif
}
@@ -512,6 +601,15 @@ void AdjustConfig2dx::setDeferredDeeplinkCallback(bool(*deferredDeeplinkCallback
#endif
}
+void AdjustConfig2dx::setConversionValueUpdatedCallback(void(*conversionValueUpdatedCallback)(int conversionValue)) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ if (isConfigSet) {
+ config.setConversionValueUpdatedCallback(conversionValueUpdatedCallback);
+ }
+#endif
+}
+
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
jobject AdjustConfig2dx::getConfig() {
return config;
diff --git a/src/AdjustConfig2dx.h b/src/AdjustConfig2dx.h
index 81b353fd..b0dc355e 100755
--- a/src/AdjustConfig2dx.h
+++ b/src/AdjustConfig2dx.h
@@ -25,6 +25,9 @@
extern const std::string AdjustSdkPrefix2dx;
extern const std::string AdjustUrlStrategyChina;
extern const std::string AdjustUrlStrategyIndia;
+extern const std::string AdjustDataResidencyEU;
+extern const std::string AdjustDataResidencyTR;
+extern const std::string AdjustDataResidencyUS;
enum AdjustLogLevel2dx {
AdjustLogLevel2dxVerbose = 1,
@@ -70,9 +73,7 @@ class AdjustConfig2dx {
void setDeviceKnown(bool isDeviceKnown);
void setSendInBackground(bool isEnabled);
void setEventBufferingEnabled(bool isEnabled);
- void setAllowIdfaReading(bool isAllowed);
- void setAllowiAdInfoReading(bool isAllowed);
- void setReadMobileEquipmentIdentity(bool readMobileEquipmentIdentity);
+ void setNeedsCost(bool needsCost);
void setUserAgent(std::string userAgent);
void setProcessName(std::string processName);
void setDefaultTracker(std::string defaultTracker);
@@ -81,13 +82,22 @@ class AdjustConfig2dx {
void setDelayStart(double delayStart);
void setLogLevel(AdjustLogLevel2dx logLevel, void(*logCallback)(const char* log) = NULL);
void setAppSecret(unsigned long long secretId, unsigned long long info1, unsigned long long info2, unsigned long long info3, unsigned long long info4);
- void deactivateSKAdNetworkHandling();
void setAttributionCallback(void(*attributionCallback)(AdjustAttribution2dx attribution));
void setEventSuccessCallback(void(*eventSuccessCallback)(AdjustEventSuccess2dx eventSuccess));
void setEventFailureCallback(void(*eventFailureCallback)(AdjustEventFailure2dx eventFailure));
void setSessionSuccessCallback(void(*sessionSuccessCallback)(AdjustSessionSuccess2dx sessionSuccess));
void setSessionFailureCallback(void(*sessionFailureCallback)(AdjustSessionFailure2dx sessionFailure));
void setDeferredDeeplinkCallback(bool(*deferredDeeplinkCallback)(std::string deeplink));
+ // iOS only
+ void deactivateSkAdNetworkHandling();
+ void setAllowIdfaReading(bool isAllowed);
+ void setAllowiAdInfoReading(bool isAllowed);
+ void setAllowAdServicesInfoReading(bool isAllowed);
+ void setConversionValueUpdatedCallback(void(*conversionValueUpdatedCallback)(int conversionValue));
+ // Android only
+ void setReadMobileEquipmentIdentity(bool readMobileEquipmentIdentity);
+ void setPreinstallTrackingEnabled(bool isEnabled);
+ void setPreinstallFilePath(std::string filePath);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
jobject getConfig();
diff --git a/src/AdjustProxy2dx.cpp b/src/AdjustProxy2dx.cpp
index a662459b..8b2594a9 100755
--- a/src/AdjustProxy2dx.cpp
+++ b/src/AdjustProxy2dx.cpp
@@ -43,6 +43,9 @@ JNIEXPORT void JNICALL Java_com_adjust_sdk_Adjust2dxAttributionCallback_attribut
std::string creative;
std::string clickLabel;
std::string adid;
+ std::string costType;
+ double costAmount;
+ std::string costCurrency;
jclass jclsAdjustAttribution = env->FindClass("com/adjust/sdk/AdjustAttribution");
jfieldID jfidTrackerToken = env->GetFieldID(jclsAdjustAttribution, "trackerToken", "Ljava/lang/String;");
@@ -53,6 +56,9 @@ JNIEXPORT void JNICALL Java_com_adjust_sdk_Adjust2dxAttributionCallback_attribut
jfieldID jfidCreative = env->GetFieldID(jclsAdjustAttribution, "creative", "Ljava/lang/String;");
jfieldID jfidClickLabel = env->GetFieldID(jclsAdjustAttribution, "clickLabel", "Ljava/lang/String;");
jfieldID jfidAdid = env->GetFieldID(jclsAdjustAttribution, "adid", "Ljava/lang/String;");
+ jfieldID jfidCostType = env->GetFieldID(jclsAdjustAttribution, "costType", "Ljava/lang/String;");
+ jfieldID jfidCostAmount = env->GetFieldID(jclsAdjustAttribution, "costAmount", "Ljava/lang/Double;");
+ jfieldID jfidCostCurrency = env->GetFieldID(jclsAdjustAttribution, "costCurrency", "Ljava/lang/String;");
jstring jTrackerToken = (jstring)env->GetObjectField(attributionObject, jfidTrackerToken);
jstring jTrackerName = (jstring)env->GetObjectField(attributionObject, jfidTrackerName);
jstring jNetwork = (jstring)env->GetObjectField(attributionObject, jfidNetwork);
@@ -61,6 +67,9 @@ JNIEXPORT void JNICALL Java_com_adjust_sdk_Adjust2dxAttributionCallback_attribut
jstring jCreative = (jstring)env->GetObjectField(attributionObject, jfidCreative);
jstring jClickLabel = (jstring)env->GetObjectField(attributionObject, jfidClickLabel);
jstring jAdid = (jstring)env->GetObjectField(attributionObject, jfidAdid);
+ jstring jCostType = (jstring)env->GetObjectField(attributionObject, jfidCostType);
+ jobject jCostAmount = env->GetObjectField(attributionObject, jfidCostAmount);
+ jstring jCostCurrency = (jstring)env->GetObjectField(attributionObject, jfidCostCurrency);
if (NULL != jTrackerToken) {
const char *trackerTokenCStr = env->GetStringUTFChars(jTrackerToken, NULL);
@@ -134,7 +143,44 @@ JNIEXPORT void JNICALL Java_com_adjust_sdk_Adjust2dxAttributionCallback_attribut
adid = "";
}
- AdjustAttribution2dx attribution = AdjustAttribution2dx(trackerToken, trackerName, network, campaign, adgroup, creative, clickLabel, adid);
+ if (NULL != jCostType) {
+ const char *costTypeCStr = env->GetStringUTFChars(jCostType, NULL);
+ costType = std::string(costTypeCStr);
+ env->ReleaseStringUTFChars(jCostType, costTypeCStr);
+ env->DeleteLocalRef(jCostType);
+ } else {
+ costType = "";
+ }
+
+ if (NULL != jCostAmount) {
+ jclass jcDouble = env->FindClass("java/lang/Double");
+ jmethodID jmidDoubleValue = env->GetMethodID(jcDouble, "doubleValue", "()D" );
+ costAmount = env->CallDoubleMethod(jCostAmount, jmidDoubleValue);
+ } else {
+ costAmount = 0;
+ }
+
+ if (NULL != jCostCurrency) {
+ const char *costCurrencyCStr = env->GetStringUTFChars(jCostCurrency, NULL);
+ costCurrency = std::string(costCurrencyCStr);
+ env->ReleaseStringUTFChars(jCostCurrency, costCurrencyCStr);
+ env->DeleteLocalRef(jCostCurrency);
+ } else {
+ costCurrency = "";
+ }
+
+ AdjustAttribution2dx attribution = AdjustAttribution2dx(
+ trackerToken,
+ trackerName,
+ network,
+ campaign,
+ adgroup,
+ creative,
+ clickLabel,
+ adid,
+ costType,
+ costAmount,
+ costCurrency);
attributionCallbackMethod(attribution);
}
diff --git a/src/AdjustThirdPartySharing2dx.cpp b/src/AdjustThirdPartySharing2dx.cpp
new file mode 100755
index 00000000..3c684375
--- /dev/null
+++ b/src/AdjustThirdPartySharing2dx.cpp
@@ -0,0 +1,88 @@
+//
+// AdjustThirdPartySharing2dx.cpp
+// Adjust SDK
+//
+// Created by Uglješa Erceg (@uerceg) on 10th September 2021.
+// Copyright © 2021 Adjust GmbH. All rights reserved.
+//
+
+#include "AdjustThirdPartySharing2dx.h"
+
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+#include
+#include "platform/android/jni/JniHelper.h"
+#endif
+
+void AdjustThirdPartySharing2dx::initThirdPartySharing() {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ cocos2d::JniMethodInfo jmiInit;
+ if (!cocos2d::JniHelper::getMethodInfo(jmiInit, "com/adjust/sdk/AdjustThirdPartySharing", "", "(Ljava/lang/Boolean;)V")) {
+ return;
+ }
+
+ jclass jclsAdjustThirdPartySharing = jmiInit.env->FindClass("com/adjust/sdk/AdjustThirdPartySharing");
+ jmethodID jmidInit = jmiInit.env->GetMethodID(jclsAdjustThirdPartySharing, "", "(Ljava/lang/Boolean;)V");
+ // jclass jclsBoolean = jmiInit.env->FindClass("java/lang/Boolean");
+ // jmethodID jmidValueOf = jmiInit.env->GetStaticMethodID(jclsBoolean, "valueOf", "(Z)Ljava/lang/Boolean;");
+ // jobject jIsEnabled = jmiInit.env->CallStaticObjectMethod(jclsBoolean, jmidValueOf, isEnabled);
+ thirdPartySharing = jmiInit.env->NewObject(jclsAdjustThirdPartySharing, jmidInit, nullptr);
+ // jmiInit.env->DeleteLocalRef(jIsEnabled);
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ thirdPartySharing = ADJThirdPartySharing2dx();
+ isThirdPartySharingSet = true;
+#endif
+}
+
+void AdjustThirdPartySharing2dx::initThirdPartySharing(bool isEnabled) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ cocos2d::JniMethodInfo jmiInit;
+ if (!cocos2d::JniHelper::getMethodInfo(jmiInit, "com/adjust/sdk/AdjustThirdPartySharing", "", "(Ljava/lang/Boolean;)V")) {
+ return;
+ }
+
+ jclass jclsAdjustThirdPartySharing = jmiInit.env->FindClass("com/adjust/sdk/AdjustThirdPartySharing");
+ jmethodID jmidInit = jmiInit.env->GetMethodID(jclsAdjustThirdPartySharing, "", "(Ljava/lang/Boolean;)V");
+ jclass jclsBoolean = jmiInit.env->FindClass("java/lang/Boolean");
+ jmethodID jmidValueOf = jmiInit.env->GetStaticMethodID(jclsBoolean, "valueOf", "(Z)Ljava/lang/Boolean;");
+ jobject jIsEnabled = jmiInit.env->CallStaticObjectMethod(jclsBoolean, jmidValueOf, isEnabled);
+ thirdPartySharing = jmiInit.env->NewObject(jclsAdjustThirdPartySharing, jmidInit, jIsEnabled);
+ jmiInit.env->DeleteLocalRef(jIsEnabled);
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ thirdPartySharing = ADJThirdPartySharing2dx(isEnabled);
+ isThirdPartySharingSet = true;
+#endif
+}
+
+void AdjustThirdPartySharing2dx::addGranularOption(std::string partnerName, std::string key, std::string value) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ if (thirdPartySharing == NULL) {
+ return;
+ }
+ cocos2d::JniMethodInfo jmiAddGranularOption;
+ if (!cocos2d::JniHelper::getMethodInfo(jmiAddGranularOption, "com/adjust/sdk/AdjustThirdPartySharing", "addGranularOption", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V")) {
+ return;
+ }
+
+ jstring jPartnerName = jmiAddGranularOption.env->NewStringUTF(partnerName.c_str());
+ jstring jKey = jmiAddGranularOption.env->NewStringUTF(key.c_str());
+ jstring jValue = jmiAddGranularOption.env->NewStringUTF(value.c_str());
+ jmiAddGranularOption.env->CallVoidMethod(thirdPartySharing, jmiAddGranularOption.methodID, jPartnerName, jKey, jValue);
+ jmiAddGranularOption.env->DeleteLocalRef(jPartnerName);
+ jmiAddGranularOption.env->DeleteLocalRef(jKey);
+ jmiAddGranularOption.env->DeleteLocalRef(jValue);
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ if (isThirdPartySharingSet) {
+ thirdPartySharing.addGranularOption(partnerName, key, value);
+ }
+#endif
+}
+
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+jobject AdjustThirdPartySharing2dx::getThirdPartySharing() {
+ return thirdPartySharing;
+}
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ADJThirdPartySharing2dx AdjustThirdPartySharing2dx::getThirdPartySharing() {
+ return thirdPartySharing;
+}
+#endif
diff --git a/src/AdjustThirdPartySharing2dx.h b/src/AdjustThirdPartySharing2dx.h
new file mode 100755
index 00000000..57780997
--- /dev/null
+++ b/src/AdjustThirdPartySharing2dx.h
@@ -0,0 +1,61 @@
+//
+// AdjustThirdPartySharing2dx.h
+// Adjust SDK
+//
+// Created by Uglješa Erceg (@uerceg) on 10th September 2021.
+// Copyright © 2021 Adjust GmbH. All rights reserved.
+//
+
+#ifndef ADJUST_ADJUSTTHIRDPARTYSHARING_H_
+#define ADJUST_ADJUSTTHIRDPARTYSHARING_H_
+
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+#include
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+#include "ADJThirdPartySharing2dx.h"
+#endif
+
+#include
+
+class AdjustThirdPartySharing2dx {
+private:
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ jobject thirdPartySharing;
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ bool isThirdPartySharingSet;
+ ADJThirdPartySharing2dx thirdPartySharing;
+#endif
+ void initThirdPartySharing();
+ void initThirdPartySharing(bool isEnabled);
+
+public:
+ // nullable workaround
+ // consider more meaningful API for v5
+ AdjustThirdPartySharing2dx() {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ initThirdPartySharing();
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ isThirdPartySharingSet = false;
+ initThirdPartySharing();
+#endif
+ }
+
+ AdjustThirdPartySharing2dx(bool isEnabled) {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ initThirdPartySharing(isEnabled);
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ isThirdPartySharingSet = false;
+ initThirdPartySharing(isEnabled);
+#endif
+ }
+
+ void addGranularOption(std::string partnerName, std::string key, std::string value);
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ jobject getThirdPartySharing();
+};
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+ ADJThirdPartySharing2dx getThirdPartySharing();
+};
+#endif
+
+#endif /* ADJUST_ADJUSTTHIRDPARTYSHARING_H_ */
diff --git a/src/test/TestConnectionOptions2dx.cpp b/src/test/TestConnectionOptions2dx.cpp
new file mode 100644
index 00000000..067c866b
--- /dev/null
+++ b/src/test/TestConnectionOptions2dx.cpp
@@ -0,0 +1,27 @@
+//
+// TestConnectionOptions2dx.cpp
+// Adjust SDK
+//
+// Created by Ugljesa Erceg (@uerceg) on 14th September 2021.
+// Copyright © 2021 Adjust GmbH. All rights reserved.
+//
+
+#include "TestConnectionOptions2dx.h"
+
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+#include
+#include "platform/android/jni/JniHelper.h"
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+#endif
+
+void TestConnectionOptions2dx::setTestConnectionOptions() {
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ cocos2d::JniMethodInfo jmiSetTestConnectionOptions;
+ if (!cocos2d::JniHelper::getStaticMethodInfo(jmiSetTestConnectionOptions, "com/adjust/test_options/TestConnectionOptions", "setTestConnectionOptions", "()V")) {
+ return;
+ }
+
+ jmiSetTestConnectionOptions.env->CallStaticVoidMethod(jmiSetTestConnectionOptions.classID, jmiSetTestConnectionOptions.methodID);
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+#endif
+}
\ No newline at end of file
diff --git a/src/test/TestConnectionOptions2dx.h b/src/test/TestConnectionOptions2dx.h
new file mode 100644
index 00000000..90856b88
--- /dev/null
+++ b/src/test/TestConnectionOptions2dx.h
@@ -0,0 +1,19 @@
+//
+// TestConnectionOptions2dx.h
+// Adjust SDK
+//
+// Created by Ugljesa Erceg (@uerceg) on 14th September 2021.
+// Copyright © 2021 Adjust GmbH. All rights reserved.
+//
+
+#ifndef ADJUST_TESTCONNECTIONOPTIONS2DX_H_
+#define ADJUST_TESTCONNECTIONOPTIONS2DX_H_
+
+#include
+
+class TestConnectionOptions2dx {
+public:
+ static void setTestConnectionOptions();
+};
+
+#endif /* ADJUST_TESTCONNECTIONOPTIONS2DX_H_ */
diff --git a/test/app/Classes/AdjustCommandExecutor.cpp b/test/app/Classes/AdjustCommandExecutor.cpp
index 86e960cb..7beb4d8d 100644
--- a/test/app/Classes/AdjustCommandExecutor.cpp
+++ b/test/app/Classes/AdjustCommandExecutor.cpp
@@ -72,6 +72,10 @@ void AdjustCommandExecutor::executeCommand(Command *command) {
this->disableThirdPartySharing();
} else if (command->methodName == "trackSubscription") {
this->trackSubscription();
+ } else if (command->methodName == "thirdPartySharing") {
+ this->trackThirdPartySharing();
+ } else if (command->methodName == "measurementConsent") {
+ this->trackMeasurementConsent();
}
}
@@ -109,6 +113,15 @@ void AdjustCommandExecutor::testOptions() {
if (this->command->containsParameter("iAdFrameworkEnabled")) {
testOptions["iAdFrameworkEnabled"] = command->getFirstParameterValue("iAdFrameworkEnabled");
}
+ // "false" is default value - AdServices will not be used in test app by default.
+ testOptions["adServicesFrameworkEnabled"] = "false";
+ if (this->command->containsParameter("adServicesFrameworkEnabled")) {
+ testOptions["adServicesFrameworkEnabled"] = command->getFirstParameterValue("adServicesFrameworkEnabled");
+ }
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ bool useTestConnectionOptions = false;
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+#endif
if (this->command->containsParameter("teardown")) {
std::vector teardownOptions = command->getParameters("teardown");
std::vector::iterator toIterator = teardownOptions.begin();
@@ -121,11 +134,15 @@ void AdjustCommandExecutor::testOptions() {
testOptions["subscriptionPath"] = this->subscriptionPath;
testOptions["extraPath"] = this->extraPath;
// Android specific.
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
testOptions["useTestConnectionOptions"] = "true";
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ useTestConnectionOptions = true;
+#endif
testOptions["tryInstallReferrer"] = "false";
- #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
Adjust2dx::teardown();
- #endif
+#endif
}
if (teardownOption == "deleteState") {
// Android specific.
@@ -148,7 +165,10 @@ void AdjustCommandExecutor::testOptions() {
testOptions["subscriptionPath"] = "";
testOptions["extraPath"] = "";
// Android specific.
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
testOptions["useTestConnectionOptions"] = "false";
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+#endif
}
if (teardownOption == "test") {
savedEvents.clear();
@@ -163,6 +183,12 @@ void AdjustCommandExecutor::testOptions() {
}
Adjust2dx::setTestOptions(testOptions);
+#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
+ if (useTestConnectionOptions == true) {
+ TestConnectionOptions2dx::setTestConnectionOptions();
+ }
+#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
+#endif
}
void AdjustCommandExecutor::config() {
@@ -270,6 +296,20 @@ void AdjustCommandExecutor::config() {
bool allowiAdInfoReading = (allowiAdInfoReadingString == "true");
adjustConfig->setAllowiAdInfoReading(allowiAdInfoReading);
}
+
+ if (this->command->containsParameter("allowAdServicesInfoReading")) {
+ std::string allowAdServicesInfoReadingString = command->getFirstParameterValue("allowAdServicesInfoReading");
+ bool allowAdServicesInfoReading = (allowAdServicesInfoReadingString == "true");
+ adjustConfig->setAllowAdServicesInfoReading(allowAdServicesInfoReading);
+ }
+
+ if (this->command->containsParameter("allowSkAdNetworkHandling")) {
+ std::string allowSkAdNetworkHandlingString = command->getFirstParameterValue("allowSkAdNetworkHandling");
+ bool allowSkAdNetworkHandling = (allowSkAdNetworkHandlingString == "true");
+ if (allowSkAdNetworkHandling == false) {
+ adjustConfig->deactivateSkAdNetworkHandling();
+ }
+ }
if (this->command->containsParameter("sendInBackground")) {
std::string sendInBackgroundString = command->getFirstParameterValue("sendInBackground");
@@ -304,6 +344,12 @@ void AdjustCommandExecutor::config() {
TestLib2dx::addInfoToSend("creative", attribution.getCreative());
TestLib2dx::addInfoToSend("clickLabel", attribution.getClickLabel());
TestLib2dx::addInfoToSend("adid", attribution.getAdid());
+ TestLib2dx::addInfoToSend("costType", attribution.getCostType());
+ std::ostringstream sstream;
+ sstream << attribution.getCostAmount();
+ std::string strCostAmount = sstream.str();
+ TestLib2dx::addInfoToSend("costAmount", strCostAmount);
+ TestLib2dx::addInfoToSend("costCurrency", attribution.getCostCurrency());
TestLib2dx::sendInfoToServer(localBasePath);
});
}
@@ -659,3 +705,30 @@ void AdjustCommandExecutor::trackSubscription() {
Adjust2dx::trackPlayStoreSubscription(subscription);
#endif
}
+
+void AdjustCommandExecutor::trackThirdPartySharing() {
+ std::string enabled = command->getFirstParameterValue("isEnabled");
+ AdjustThirdPartySharing2dx thirdPartySharing;
+ if (enabled.empty()) {
+ thirdPartySharing = AdjustThirdPartySharing2dx();
+ } else {
+ thirdPartySharing = AdjustThirdPartySharing2dx(enabled == "true" ? true : false);
+ }
+
+ if (this->command->containsParameter("granularOptions")) {
+ std::vector granularOptions = command->getParameters("granularOptions");
+ for (int i = 0; i < granularOptions.size(); i = i + 3) {
+ std::string partnerName = granularOptions[i];
+ std::string key = granularOptions[i + 1];
+ std::string value = granularOptions[i + 2];
+ thirdPartySharing.addGranularOption(partnerName, key, value);
+ }
+ }
+
+ Adjust2dx::trackThirdPartySharing(thirdPartySharing);
+}
+
+void AdjustCommandExecutor::trackMeasurementConsent() {
+ std::string enabled = command->getFirstParameterValue("isEnabled");
+ Adjust2dx::trackMeasurementConsent(enabled == "true" ? true : false);
+}
diff --git a/test/app/Classes/AdjustCommandExecutor.h b/test/app/Classes/AdjustCommandExecutor.h
index f15086e1..81afaf17 100644
--- a/test/app/Classes/AdjustCommandExecutor.h
+++ b/test/app/Classes/AdjustCommandExecutor.h
@@ -23,7 +23,9 @@
#include "Adjust/AdjustEventSuccess2dx.h"
#include "Adjust/AdjustSessionSuccess2dx.h"
#include "Adjust/AdjustSessionFailure2dx.h"
+#include "Adjust/AdjustThirdPartySharing2dx.h"
#include "Adjust/test/TestLib2dx.h"
+#include "Adjust/test/TestConnectionOptions2dx.h"
class AdjustCommandExecutor {
private:
@@ -62,6 +64,8 @@ class AdjustCommandExecutor {
void trackAdRevenue();
void disableThirdPartySharing();
void trackSubscription();
+ void trackThirdPartySharing();
+ void trackMeasurementConsent();
public:
static const std::string TAG;
AdjustCommandExecutor(std::string baseUrl, std::string gdprUrl, std::string subscriptionUrl);
diff --git a/test/app/Classes/HelloWorldScene.cpp b/test/app/Classes/HelloWorldScene.cpp
index 2cb7acaa..c83f9acf 100644
--- a/test/app/Classes/HelloWorldScene.cpp
+++ b/test/app/Classes/HelloWorldScene.cpp
@@ -18,7 +18,7 @@ Scene *TestApp::createScene() {
return TestApp::create();
}
-static std::string serverIp = "192.168.86.32";
+static std::string serverIp = "192.168.86.65";
static std::string controlUrl = "ws://" + serverIp + ":1987";
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
@@ -79,6 +79,8 @@ bool TestApp::init() {
TestApp::initTestLibrary();
CCLOG("[AdjustTest]: Start test session called!");
+ // this->testLibrary->addTest("Test_AttributionCallback_no_ask_in");
+ // this->testLibrary->addTest("Test_ThirdPartySharing_after_install");
this->testLibrary->startTestSession(Adjust2dx::getSdkVersion());
// Add main menu to screen
diff --git a/test/libs/android/adjust-test-library.jar b/test/libs/android/adjust-test-library.jar
new file mode 100644
index 00000000..aa0f6346
Binary files /dev/null and b/test/libs/android/adjust-test-library.jar differ
diff --git a/test/libs/android/adjust-test.jar b/test/libs/android/adjust-test.jar
index 0fad79c7..bf9e7c46 100644
Binary files a/test/libs/android/adjust-test.jar and b/test/libs/android/adjust-test.jar differ
diff --git a/test/libs/ios/AdjustTestLibrary.framework/Versions/A/AdjustTestLibrary b/test/libs/ios/AdjustTestLibrary.framework/Versions/A/AdjustTestLibrary
index c58e0eb1..baa3897b 100644
Binary files a/test/libs/ios/AdjustTestLibrary.framework/Versions/A/AdjustTestLibrary and b/test/libs/ios/AdjustTestLibrary.framework/Versions/A/AdjustTestLibrary differ