This commit is contained in:
corn
2026-06-07 22:59:32 +08:00
commit a62ff7379b
7171 changed files with 10015624 additions and 0 deletions

View File

@@ -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 <Foundation/Foundation.h>
/**
* @brief Adjust ad revenue class.
*/
@interface ADJAdRevenue : NSObject<NSCopying>
/**
* @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

View File

@@ -0,0 +1,24 @@
fileFormatVersion: 2
guid: f382ac4ce0db3407baf40dd118470093
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,99 @@
//
// ADJAttribution.h
// adjust
//
// Created by Pedro Filipe on 29/10/14.
// Copyright (c) 2014 adjust GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
/**
* @brief Adjust attribution object.
*/
@interface ADJAttribution : NSObject <NSCoding, NSCopying>
/**
* @brief Tracker token.
*/
@property (nonatomic, copy, nullable) NSString *trackerToken;
/**
* @brief Tracker name.
*/
@property (nonatomic, copy, nullable) NSString *trackerName;
/**
* @brief Network name.
*/
@property (nonatomic, copy, nullable) NSString *network;
/**
* @brief Campaign name.
*/
@property (nonatomic, copy, nullable) NSString *campaign;
/**
* @brief Adgroup name.
*/
@property (nonatomic, copy, nullable) NSString *adgroup;
/**
* @brief Creative name.
*/
@property (nonatomic, copy, nullable) NSString *creative;
/**
* @brief Click label content.
*/
@property (nonatomic, copy, nullable) NSString *clickLabel;
/**
* @brief Adjust identifier value.
*/
@property (nonatomic, copy, nullable) NSString *adid;
/**
* @brief Cost type.
*/
@property (nonatomic, copy, nullable) NSString *costType;
/**
* @brief Cost amount.
*/
@property (nonatomic, copy, nullable) NSNumber *costAmount;
/**
* @brief Cost currency.
*/
@property (nonatomic, copy, nullable) NSString *costCurrency;
/**
* @brief Make attribution object.
*
* @param jsonDict Dictionary holding attribution key value pairs.
* @param adid Adjust identifier value.
*
* @return Adjust attribution object.
*/
+ (nullable ADJAttribution *)dataWithJsonDict:(nonnull NSDictionary *)jsonDict adid:(nonnull NSString *)adid;
- (nullable id)initWithJsonDict:(nonnull NSDictionary *)jsonDict adid:(nonnull NSString *)adid;
/**
* @brief Check if given attribution equals current one.
*
* @param attribution Attribution object to be compared with current one.
*
* @return Boolean indicating whether two attribution objects are the equal.
*/
- (BOOL)isEqualToAttribution:(nonnull ADJAttribution *)attribution;
/**
* @brief Get attribution value as dictionary.
*
* @return Dictionary containing attribution as key-value pairs.
*/
- (nullable NSDictionary *)dictionary;
@end

View File

@@ -0,0 +1,21 @@
fileFormatVersion: 2
guid: 7dddf8beb94ee49a7aba11b4e22e059c
PluginImporter:
serializedVersion: 1
iconMap: {}
executionOrder: {}
isPreloaded: 0
platformData:
Any:
enabled: 0
settings: {}
Editor:
enabled: 0
settings:
DefaultValueInitialized: true
iOS:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,276 @@
//
// ADJConfig.h
// adjust
//
// Created by Pedro Filipe on 30/10/14.
// Copyright (c) 2014 adjust GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "ADJLogger.h"
#import "ADJAttribution.h"
#import "ADJEventSuccess.h"
#import "ADJEventFailure.h"
#import "ADJSessionSuccess.h"
#import "ADJSessionFailure.h"
/**
* @brief Optional delegate that will get informed about tracking results.
*/
@protocol AdjustDelegate
@optional
/**
* @brief Optional delegate method that gets called when the attribution information changed.
*
* @param attribution The attribution information.
*
* @note See ADJAttribution for details.
*/
- (void)adjustAttributionChanged:(nullable ADJAttribution *)attribution;
/**
* @brief Optional delegate method that gets called when an event is tracked with success.
*
* @param eventSuccessResponseData The response information from tracking with success
*
* @note See ADJEventSuccess for details.
*/
- (void)adjustEventTrackingSucceeded:(nullable ADJEventSuccess *)eventSuccessResponseData;
/**
* @brief Optional delegate method that gets called when an event is tracked with failure.
*
* @param eventFailureResponseData The response information from tracking with failure
*
* @note See ADJEventFailure for details.
*/
- (void)adjustEventTrackingFailed:(nullable ADJEventFailure *)eventFailureResponseData;
/**
* @brief Optional delegate method that gets called when an session is tracked with success.
*
* @param sessionSuccessResponseData The response information from tracking with success
*
* @note See ADJSessionSuccess for details.
*/
- (void)adjustSessionTrackingSucceeded:(nullable ADJSessionSuccess *)sessionSuccessResponseData;
/**
* @brief Optional delegate method that gets called when an session is tracked with failure.
*
* @param sessionFailureResponseData The response information from tracking with failure
*
* @note See ADJSessionFailure for details.
*/
- (void)adjustSessionTrackingFailed:(nullable ADJSessionFailure *)sessionFailureResponseData;
/**
* @brief Optional delegate method that gets called when a deferred deep link is about to be opened by the adjust SDK.
*
* @param deeplink The deep link url that was received by the adjust SDK to be opened.
*
* @return Boolean that indicates whether the deep link should be opened by the adjust SDK or not.
*/
- (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
/**
* @brief Adjust configuration object class.
*/
@interface ADJConfig : NSObject<NSCopying>
/**
* @brief SDK prefix.
*
* @note Not to be used by users, intended for non-native adjust SDKs only.
*/
@property (nonatomic, copy, nullable) NSString *sdkPrefix;
/**
* @brief Default tracker to attribute organic installs to (optional).
*/
@property (nonatomic, copy, nullable) NSString *defaultTracker;
@property (nonatomic, copy, nullable) NSString *externalDeviceId;
/**
* @brief Adjust app token.
*/
@property (nonatomic, copy, readonly, nonnull) NSString *appToken;
/**
* @brief Adjust environment variable.
*/
@property (nonatomic, copy, readonly, nonnull) NSString *environment;
/**
* @brief Change the verbosity of Adjust's logs.
*
* @note You can increase or reduce the amount of logs from Adjust by passing
* one of the following parameters. Use ADJLogLevelSuppress to disable all logging.
* The desired minimum log level (default: info)
* Must be one of the following:
* - ADJLogLevelVerbose (enable all logging)
* - ADJLogLevelDebug (enable more logging)
* - ADJLogLevelInfo (the default)
* - ADJLogLevelWarn (disable info logging)
* - ADJLogLevelError (disable warnings as well)
* - ADJLogLevelAssert (disable errors as well)
* - ADJLogLevelSuppress (suppress all logging)
*/
@property (nonatomic, assign) ADJLogLevel logLevel;
/**
* @brief Enable event buffering if your app triggers a lot of events.
* When enabled, events get buffered and only get tracked each
* minute. Buffered events are still persisted, of course.
*/
@property (nonatomic, assign) BOOL eventBufferingEnabled;
/**
* @brief Set the optional delegate that will inform you about attribution or events.
*
* @note See the AdjustDelegate declaration above for details.
*/
@property (nonatomic, weak, nullable) NSObject<AdjustDelegate> *delegate;
/**
* @brief Enables sending in the background.
*/
@property (nonatomic, assign) BOOL sendInBackground;
/**
* @brief Enables/disables reading of iAd framework data needed for ASA tracking.
*/
@property (nonatomic, assign) BOOL allowiAdInfoReading;
/**
* @brief Enables/disables reading of AdServices framework data needed for attribution.
*/
@property (nonatomic, assign) BOOL allowAdServicesInfoReading;
/**
* @brief Enables/disables reading of IDFA parameter.
*/
@property (nonatomic, assign) BOOL allowIdfaReading;
/**
* @brief Enables delayed start of the SDK.
*/
@property (nonatomic, assign) double delayStart;
/**
* @brief User agent for the requests.
*/
@property (nonatomic, copy, nullable) NSString *userAgent;
/**
* @brief Set if the device is known.
*/
@property (nonatomic, assign) BOOL isDeviceKnown;
/**
* @brief Set if cost data is needed in attribution response.
*/
@property (nonatomic, assign) BOOL needsCost;
/**
* @brief Adjust app secret id.
*/
@property (nonatomic, copy, readonly, nullable) NSString *secretId;
/**
* @brief Adjust app secret.
*/
@property (nonatomic, copy, readonly, nullable) NSString *appSecret;
/**
* @brief Adjust set app secret.
*/
- (void)setAppSecret:(NSUInteger)secretId
info1:(NSUInteger)info1
info2:(NSUInteger)info2
info3:(NSUInteger)info3
info4:(NSUInteger)info4;
@property (nonatomic, assign, readonly) BOOL isSKAdNetworkHandlingActive;
- (void)deactivateSKAdNetworkHandling;
/**
* @brief Adjust url strategy.
*/
@property (nonatomic, copy, readwrite, nullable) NSString *urlStrategy;
/**
* @brief Enables/disables linkMe
*/
@property (nonatomic, assign) BOOL linkMeEnabled;
/**
* @brief Get configuration object for the initialization of the Adjust SDK.
*
* @param appToken The App Token of your app. This unique identifier can
* be found it in your dashboard at http://adjust.com and should always
* be 12 characters long.
* @param environment The current environment your app. We use this environment to
* distinguish between real traffic and artificial traffic from test devices.
* It is very important that you keep this value meaningful at all times!
* Especially if you are tracking revenue.
*
* @returns Adjust configuration object.
*/
+ (nullable ADJConfig *)configWithAppToken:(nonnull NSString *)appToken
environment:(nonnull NSString *)environment;
- (nullable id)initWithAppToken:(nonnull NSString *)appToken
environment:(nonnull NSString *)environment;
/**
* @brief Configuration object for the initialization of the Adjust SDK.
*
* @param appToken The App Token of your app. This unique identifier can
* be found it in your dashboard at http://adjust.com and should always
* be 12 characters long.
* @param environment The current environment your app. We use this environment to
* distinguish between real traffic and artificial traffic from test devices.
* It is very important that you keep this value meaningful at all times!
* Especially if you are tracking revenue.
* @param allowSuppressLogLevel If set to true, it allows usage of ADJLogLevelSuppress
* and replaces the default value for production environment.
*
* @returns Adjust configuration object.
*/
+ (nullable ADJConfig *)configWithAppToken:(nonnull NSString *)appToken
environment:(nonnull NSString *)environment
allowSuppressLogLevel:(BOOL)allowSuppressLogLevel;
- (nullable id)initWithAppToken:(nonnull NSString *)appToken
environment:(nonnull NSString *)environment
allowSuppressLogLevel:(BOOL)allowSuppressLogLevel;
/**
* @brief Check if adjust configuration object is valid.
*
* @return Boolean indicating whether adjust config object is valid or not.
*/
- (BOOL)isValid;
/**
* @brief Enable COPPA (Children's Online Privacy Protection Act) compliant for the application.
*/
@property (nonatomic, assign) BOOL coppaCompliantEnabled;
@end

View File

@@ -0,0 +1,21 @@
fileFormatVersion: 2
guid: 0c958f3cabffd44b6a58b8e0621ee82e
PluginImporter:
serializedVersion: 1
iconMap: {}
executionOrder: {}
isPreloaded: 0
platformData:
Any:
enabled: 0
settings: {}
Editor:
enabled: 0
settings:
DefaultValueInitialized: true
iOS:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,140 @@
//
// ADJEvent.h
// adjust
//
// Created by Pedro Filipe on 15/10/14.
// Copyright (c) 2014 adjust GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
/**
* @brief Adjust event class.
*/
@interface ADJEvent : NSObject<NSCopying>
/**
* @brief Revenue attached to the event.
*/
@property (nonatomic, copy, readonly, nonnull) NSNumber *revenue;
/**
* @brief Event token.
*/
@property (nonatomic, copy, readonly, nonnull) NSString *eventToken;
/**
* @brief IAP transaction ID.
*/
@property (nonatomic, copy, readonly, nonnull) NSString *transactionId;
/**
* @brief Custom user defined event ID.
*/
@property (nonatomic, copy, readonly, nonnull) NSString *callbackId;
/**
* @brief Currency value.
*/
@property (nonatomic, copy, readonly, nonnull) NSString *currency;
/**
* @brief IAP receipt.
*/
@property (nonatomic, copy, readonly, nonnull) NSData *receipt;
/**
* @brief List of partner parameters.
*/
@property (nonatomic, readonly, nonnull) NSDictionary *partnerParameters;
/**
* @brief List of callback parameters.
*/
@property (nonatomic, readonly, nonnull) NSDictionary *callbackParameters;
/**
* @brief Is the given receipt empty.
*/
@property (nonatomic, assign, readonly) BOOL emptyReceipt;
/**
* @brief Create Event object with event token.
*
* @param eventToken Event token that is created in the dashboard
* at http://adjust.com and should be six characters long.
*/
+ (nullable ADJEvent *)eventWithEventToken:(nonnull NSString *)eventToken;
- (nullable id)initWithEventToken:(nonnull NSString *)eventToken;
/**
* @brief Add a key-pair to a callback URL.
*
* @param key String key in the callback URL.
* @param value String value of the key in the Callback URL.
*
* @note In your dashboard at http://adjust.com you can assign a callback URL to each
* event type. That URL will get called every time the event is triggered. On
* top of that you can add callback parameters to the following method that
* will be forwarded to these callbacks.
*/
- (void)addCallbackParameter:(nonnull NSString *)key value:(nonnull NSString *)value;
/**
* @brief Add a key-pair to be fowarded to a partner.
*
* @param key String key to be fowarded to the partner.
* @param value String value of the key to be fowarded to the partner.
*/
- (void)addPartnerParameter:(nonnull NSString *)key value:(nonnull NSString *)value;
/**
* @brief Set the revenue and associated currency of the event.
*
* @param amount The amount in units (example: for 1.50 EUR is 1.5).
* @param currency String of the currency with ISO 4217 format.
* It should be 3 characters long (example: for 1.50 EUR is @"EUR").
*
* @note The event can contain some revenue. The amount revenue is measured in units.
* It must include a currency in the ISO 4217 format.
*/
- (void)setRevenue:(double)amount currency:(nonnull NSString *)currency;
/**
* @brief Set the transaction ID of a In-App Purchases to avoid revenue duplications.
*
* @note A transaction ID can be used to avoid duplicate revenue events. The last ten
* transaction identifiers are remembered.
*
* @param transactionId The identifier used to avoid duplicate revenue events.
*/
- (void)setTransactionId:(nonnull NSString *)transactionId;
/**
* @brief Set the custom user defined ID for the event which will be reported in
* success/failure callbacks.
*
* @param callbackId Custom user defined identifier for the event
*/
- (void)setCallbackId:(nonnull NSString *)callbackId;
/**
* @brief Check if created adjust event object is valid.
*
* @return Boolean indicating whether the adjust event object is valid or not.
*/
- (BOOL)isValid;
/**
* @brief Validate a in-app-purchase receipt.
*
* @param receipt The receipt to validate.
* @param transactionId The identifier used to validate the receipt and to avoid duplicate revenue events.
*
* @note This method is obsolete and should not be used.
* For more information, visit: https://github.com/adjust/ios_purchase_sdk
*/
- (void)setReceipt:(nonnull NSData *)receipt transactionId:(nonnull NSString *)transactionId;
@end

View File

@@ -0,0 +1,21 @@
fileFormatVersion: 2
guid: 426362cccd2154c908b504e138832851
PluginImporter:
serializedVersion: 1
iconMap: {}
executionOrder: {}
isPreloaded: 0
platformData:
Any:
enabled: 0
settings: {}
Editor:
enabled: 0
settings:
DefaultValueInitialized: true
iOS:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,55 @@
//
// ADJEventFailure.h
// adjust
//
// Created by Pedro Filipe on 17/02/16.
// Copyright © 2016 adjust GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ADJEventFailure : NSObject
/**
* @brief Message from the adjust backend.
*/
@property (nonatomic, copy) NSString * message;
/**
* @brief Timestamp from the adjust backend.
*/
@property (nonatomic, copy) NSString * timeStamp;
/**
* @brief Adjust identifier of the device.
*/
@property (nonatomic, copy) NSString * adid;
/**
* @brief Event token value.
*/
@property (nonatomic, copy) NSString * eventToken;
/**
* @brief Event callback ID.
*/
@property (nonatomic, copy) NSString *callbackId;
/**
* @brief Information whether sending of the package will be retried or not.
*/
@property (nonatomic, assign) BOOL willRetry;
/**
* @brief Backend response in JSON format.
*/
@property (nonatomic, strong) NSDictionary *jsonResponse;
/**
* @brief Initialisation method.
*
* @return ADJEventFailure instance.
*/
+ (ADJEventFailure *)eventFailureResponseData;
@end

View File

@@ -0,0 +1,147 @@
fileFormatVersion: 2
guid: b274a5403f60c4e7ca731709d03d1ee8
timeCreated: 1458122523
licenseType: Free
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 1
Exclude Linux: 1
Exclude Linux64: 1
Exclude LinuxUniversal: 1
Exclude OSXIntel: 1
Exclude OSXIntel64: 1
Exclude OSXUniversal: 1
Exclude WebGL: 1
Exclude Win: 1
Exclude Win64: 1
Exclude iOS: 0
Exclude tvOS: 1
data:
first:
'': Editor
second:
enabled: 0
settings:
CPU: AnyCPU
OS: AnyOS
data:
first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
data:
first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: Linux
second:
enabled: 0
settings:
CPU: x86
data:
first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: x86_64
data:
first:
Standalone: LinuxUniversal
second:
enabled: 0
settings:
CPU: None
data:
first:
Standalone: OSXIntel
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: OSXIntel64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: None
data:
first:
Standalone: Win
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
iPhone: iOS
second:
enabled: 1
settings:
CompileFlags:
FrameworkDependencies:
data:
first:
tvOS: tvOS
second:
enabled: 0
settings:
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,50 @@
//
// ADJEventSuccess.h
// adjust
//
// Created by Pedro Filipe on 17/02/16.
// Copyright © 2016 adjust GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ADJEventSuccess : NSObject
/**
* @brief Message from the adjust backend.
*/
@property (nonatomic, copy) NSString *message;
/**
* @brief Timestamp from the adjust backend.
*/
@property (nonatomic, copy) NSString *timeStamp;
/**
* @brief Adjust identifier of the device.
*/
@property (nonatomic, copy) NSString *adid;
/**
* @brief Event token value.
*/
@property (nonatomic, copy) NSString *eventToken;
/**
* @brief Event callback ID.
*/
@property (nonatomic, copy) NSString *callbackId;
/**
* @brief Backend response in JSON format.
*/
@property (nonatomic, strong) NSDictionary *jsonResponse;
/**
* @brief Initialisation method.
*
* @return ADJEventSuccess instance.
*/
+ (ADJEventSuccess *)eventSuccessResponseData;
@end

View File

@@ -0,0 +1,147 @@
fileFormatVersion: 2
guid: 65ff11a24f3b043759b70623a745a004
timeCreated: 1458122523
licenseType: Free
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 1
Exclude Linux: 1
Exclude Linux64: 1
Exclude LinuxUniversal: 1
Exclude OSXIntel: 1
Exclude OSXIntel64: 1
Exclude OSXUniversal: 1
Exclude WebGL: 1
Exclude Win: 1
Exclude Win64: 1
Exclude iOS: 0
Exclude tvOS: 1
data:
first:
'': Editor
second:
enabled: 0
settings:
CPU: AnyCPU
OS: AnyOS
data:
first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
data:
first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: Linux
second:
enabled: 0
settings:
CPU: x86
data:
first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: x86_64
data:
first:
Standalone: LinuxUniversal
second:
enabled: 0
settings:
CPU: None
data:
first:
Standalone: OSXIntel
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: OSXIntel64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: None
data:
first:
Standalone: Win
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
iPhone: iOS
second:
enabled: 1
settings:
CompileFlags:
FrameworkDependencies:
data:
first:
tvOS: tvOS
second:
enabled: 0
settings:
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
//
// ADJLinkResolution.h
// Adjust
//
// Created by Pedro S. on 26.04.21.
// Copyright © 2021 adjust GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ADJLinkResolution : NSObject
+ (void)resolveLinkWithUrl:(nonnull NSURL *)url
resolveUrlSuffixArray:(nullable NSArray<NSString *> *)resolveUrlSuffixArray
callback:(nonnull void (^)(NSURL *_Nullable resolvedLink))callback;
@end

View File

@@ -0,0 +1,24 @@
fileFormatVersion: 2
guid: c6eb7389a3c5c4df6ba3506c8fd4ad2c
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,84 @@
//
// ADJLogger.h
// Adjust
//
// Created by Christian Wellenbrock on 2012-11-15.
// Copyright (c) 2012-2014 adjust GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef enum {
ADJLogLevelVerbose = 1,
ADJLogLevelDebug = 2,
ADJLogLevelInfo = 3,
ADJLogLevelWarn = 4,
ADJLogLevelError = 5,
ADJLogLevelAssert = 6,
ADJLogLevelSuppress = 7
} ADJLogLevel;
/**
* @brief Adjust logger protocol.
*/
@protocol ADJLogger
/**
* @brief Set the log level of the SDK.
*
* @param logLevel Level of the logs to be displayed.
*/
- (void)setLogLevel:(ADJLogLevel)logLevel isProductionEnvironment:(BOOL)isProductionEnvironment;
/**
* @brief Prevent log level changes.
*/
- (void)lockLogLevel;
/**
* @brief Print verbose logs.
*/
- (void)verbose:(nonnull NSString *)message, ...;
/**
* @brief Print debug logs.
*/
- (void)debug:(nonnull NSString *)message, ...;
/**
* @brief Print info logs.
*/
- (void)info:(nonnull NSString *)message, ...;
/**
* @brief Print warn logs.
*/
- (void)warn:(nonnull NSString *)message, ...;
- (void)warnInProduction:(nonnull NSString *)message, ...;
/**
* @brief Print error logs.
*/
- (void)error:(nonnull NSString *)message, ...;
/**
* @brief Print assert logs.
*/
- (void)assert:(nonnull NSString *)message, ...;
@end
/**
* @brief Adjust logger class.
*/
@interface ADJLogger : NSObject<ADJLogger>
/**
* @brief Convert log level string to ADJLogLevel enumeration.
*
* @param logLevelString Log level as string.
*
* @return Log level as ADJLogLevel enumeration.
*/
+ (ADJLogLevel)logLevelFromString:(nonnull NSString *)logLevelString;
@end

View File

@@ -0,0 +1,21 @@
fileFormatVersion: 2
guid: 79bead718d24d4562b045c8fb25619ab
PluginImporter:
serializedVersion: 1
iconMap: {}
executionOrder: {}
isPreloaded: 0
platformData:
Any:
enabled: 0
settings: {}
Editor:
enabled: 0
settings:
DefaultValueInitialized: true
iOS:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,45 @@
//
// ADJFailureResponseData.h
// adjust
//
// Created by Pedro Filipe on 05/01/16.
// Copyright © 2016 adjust GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ADJSessionFailure : NSObject <NSCopying>
/**
* @brief Message from the adjust backend.
*/
@property (nonatomic, copy, nullable) NSString *message;
/**
* @brief Timestamp from the adjust backend.
*/
@property (nonatomic, copy, nullable) NSString *timeStamp;
/**
* @brief Adjust identifier of the device.
*/
@property (nonatomic, copy, nullable) NSString *adid;
/**
* @brief Information whether sending of the package will be retried or not.
*/
@property (nonatomic, assign) BOOL willRetry;
/**
* @brief Backend response in JSON format.
*/
@property (nonatomic, strong, nullable) NSDictionary *jsonResponse;
/**
* @brief Initialisation method.
*
* @return ADJSessionFailure instance.
*/
+ (nullable ADJSessionFailure *)sessionFailureResponseData;
@end

View File

@@ -0,0 +1,147 @@
fileFormatVersion: 2
guid: cb5e6ddbbcae24783900c75db92ead71
timeCreated: 1458122523
licenseType: Free
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 1
Exclude Linux: 1
Exclude Linux64: 1
Exclude LinuxUniversal: 1
Exclude OSXIntel: 1
Exclude OSXIntel64: 1
Exclude OSXUniversal: 1
Exclude WebGL: 1
Exclude Win: 1
Exclude Win64: 1
Exclude iOS: 0
Exclude tvOS: 1
data:
first:
'': Editor
second:
enabled: 0
settings:
CPU: AnyCPU
OS: AnyOS
data:
first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
data:
first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: Linux
second:
enabled: 0
settings:
CPU: x86
data:
first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: x86_64
data:
first:
Standalone: LinuxUniversal
second:
enabled: 0
settings:
CPU: None
data:
first:
Standalone: OSXIntel
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: OSXIntel64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: None
data:
first:
Standalone: Win
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
iPhone: iOS
second:
enabled: 1
settings:
CompileFlags:
FrameworkDependencies:
data:
first:
tvOS: tvOS
second:
enabled: 0
settings:
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,40 @@
//
// ADJSuccessResponseData.h
// adjust
//
// Created by Pedro Filipe on 05/01/16.
// Copyright © 2016 adjust GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ADJSessionSuccess : NSObject <NSCopying>
/**
* @brief Message from the adjust backend.
*/
@property (nonatomic, copy, nullable) NSString *message;
/**
* @brief Timestamp from the adjust backend.
*/
@property (nonatomic, copy, nullable) NSString *timeStamp;
/**
* @brief Adjust identifier of the device.
*/
@property (nonatomic, copy, nullable) NSString *adid;
/**
* @brief Backend response in JSON format.
*/
@property (nonatomic, strong, nullable) NSDictionary *jsonResponse;
/**
* @brief Initialisation method.
*
* @return ADJSessionSuccess instance.
*/
+ (nullable ADJSessionSuccess *)sessionSuccessResponseData;
@end

View File

@@ -0,0 +1,147 @@
fileFormatVersion: 2
guid: 65455f64c4f194d6fb1e959ad638f311
timeCreated: 1458122523
licenseType: Free
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 1
Exclude Linux: 1
Exclude Linux64: 1
Exclude LinuxUniversal: 1
Exclude OSXIntel: 1
Exclude OSXIntel64: 1
Exclude OSXUniversal: 1
Exclude WebGL: 1
Exclude Win: 1
Exclude Win64: 1
Exclude iOS: 0
Exclude tvOS: 1
data:
first:
'': Editor
second:
enabled: 0
settings:
CPU: AnyCPU
OS: AnyOS
data:
first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
data:
first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: Linux
second:
enabled: 0
settings:
CPU: x86
data:
first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: x86_64
data:
first:
Standalone: LinuxUniversal
second:
enabled: 0
settings:
CPU: None
data:
first:
Standalone: OSXIntel
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: OSXIntel64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: None
data:
first:
Standalone: Win
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
iPhone: iOS
second:
enabled: 1
settings:
CompileFlags:
FrameworkDependencies:
data:
first:
tvOS: tvOS
second:
enabled: 0
settings:
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,44 @@
//
// ADJSubscription.h
// Adjust
//
// Created by Uglješa Erceg on 16.04.20.
// Copyright © 2020 adjust GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ADJSubscription : NSObject<NSCopying>
@property (nonatomic, copy, readonly, nonnull) NSDecimalNumber *price; // [M] revenue
@property (nonatomic, copy, readonly, nonnull) NSString *currency; // [M] currency
@property (nonatomic, copy, readonly, nonnull) NSString *transactionId; // [M] transaction_id
@property (nonatomic, copy, readonly, nonnull) NSData *receipt; // [M] receipt
@property (nonatomic, copy, readonly, nonnull) NSString *billingStore; // [M] billing_store
@property (nonatomic, copy, readonly, nonnull) NSDate *transactionDate; // [O] transaction_date
@property (nonatomic, copy, readonly, nonnull) NSString *salesRegion; // [O] sales_region
@property (nonatomic, copy, readonly, nonnull) NSDictionary *callbackParameters; // [O] callback_params
@property (nonatomic, copy, readonly, nonnull) NSDictionary *partnerParameters; // [O] partner_params
- (nullable id)initWithPrice:(nonnull NSDecimalNumber *)price
currency:(nonnull NSString *)currency
transactionId:(nonnull NSString *)transactionId
andReceipt:(nonnull NSData *)receipt;
- (void)setTransactionDate:(nonnull NSDate *)transactionDate;
- (void)setSalesRegion:(nonnull NSString *)salesRegion;
- (void)addCallbackParameter:(nonnull NSString *)key value:(nonnull NSString *)value;
- (void)addPartnerParameter:(nonnull NSString *)key value:(nonnull NSString *)value;
@end

View File

@@ -0,0 +1,24 @@
fileFormatVersion: 2
guid: 15bc7056a22f34382aea2497343c3509
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,28 @@
//
// ADJThirdPartySharing.h
// AdjustSdk
//
// Created by Pedro S. on 02.12.20.
// Copyright © 2020 adjust GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ADJThirdPartySharing : NSObject
@property (nonatomic, nullable, readonly, strong) NSNumber *enabled;
@property (nonatomic, nonnull, readonly, strong) NSMutableDictionary *granularOptions;
@property (nonatomic, nonnull, readonly, strong) NSMutableDictionary *partnerSharingSettings;
- (nullable id)initWithIsEnabledNumberBool:(nullable NSNumber *)isEnabledNumberBool;
- (void)addGranularOption:(nonnull NSString *)partnerName
key:(nonnull NSString *)key
value:(nonnull NSString *)value;
- (void)addPartnerSharingSetting:(nonnull NSString *)partnerName
key:(nonnull NSString *)key
value:(BOOL)value;
@end

View File

@@ -0,0 +1,24 @@
fileFormatVersion: 2
guid: e34005ea3283c4e88bf3dc78e9e845e4
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

412
Assets/Adjust/iOS/Adjust.h Normal file
View File

@@ -0,0 +1,412 @@
//
// Adjust.h
// Adjust SDK
//
// V4.32.0
// Created by Christian Wellenbrock (@wellle) on 23rd July 2013.
// Copyright (c) 2012-2021 Adjust GmbH. All rights reserved.
//
#import "ADJEvent.h"
#import "ADJConfig.h"
#import "ADJAttribution.h"
#import "ADJSubscription.h"
#import "ADJThirdPartySharing.h"
#import "ADJAdRevenue.h"
#import "ADJLinkResolution.h"
@interface AdjustTestOptions : NSObject
@property (nonatomic, copy, nullable) NSString *baseUrl;
@property (nonatomic, copy, nullable) NSString *gdprUrl;
@property (nonatomic, copy, nullable) NSString *subscriptionUrl;
@property (nonatomic, copy, nullable) NSString *extraPath;
@property (nonatomic, copy, nullable) NSNumber *timerIntervalInMilliseconds;
@property (nonatomic, copy, nullable) NSNumber *timerStartInMilliseconds;
@property (nonatomic, copy, nullable) NSNumber *sessionIntervalInMilliseconds;
@property (nonatomic, copy, nullable) NSNumber *subsessionIntervalInMilliseconds;
@property (nonatomic, assign) BOOL teardown;
@property (nonatomic, assign) BOOL deleteState;
@property (nonatomic, assign) BOOL noBackoffWait;
@property (nonatomic, assign) BOOL iAdFrameworkEnabled;
@property (nonatomic, assign) BOOL adServicesFrameworkEnabled;
@property (nonatomic, assign) BOOL enableSigning;
@property (nonatomic, assign) BOOL disableSigning;
@end
/**
* Constants for our supported tracking environments.
*/
extern NSString * __nonnull const ADJEnvironmentSandbox;
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 ADJAdRevenueSourceIronSource;
extern NSString * __nonnull const ADJAdRevenueSourceAdMost;
extern NSString * __nonnull const ADJAdRevenueSourceUnity;
extern NSString * __nonnull const ADJAdRevenueSourceHeliumChartboost;
extern NSString * __nonnull const ADJAdRevenueSourcePublisher;
/**
* 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.
*
* @note Use the methods of this class to tell Adjust about the usage of your app.
* See the README for details.
*/
@interface Adjust : NSObject
/**
* @brief Tell Adjust that the application did launch.
* This is required to initialize Adjust. Call this in the didFinishLaunching
* method of your AppDelegate.
*
* @note See ADJConfig.h for more configuration options
*
* @param adjustConfig The configuration object that includes the environment
* and the App Token of your app. This unique identifier can
* be found it in your dashboard at http://adjust.com and should always
* be 12 characters long.
*/
+ (void)appDidLaunch:(nullable ADJConfig *)adjustConfig;
/**
* @brief Tell Adjust that a particular event has happened.
*
* @note See ADJEvent.h for more event options.
*
* @param event The Event object for this kind of event. It needs a event token
* that is created in the dashboard at http://adjust.com and should be six
* characters long.
*/
+ (void)trackEvent:(nullable ADJEvent *)event;
/**
* @brief Tell adjust that the application resumed.
*
* @note Only necessary if the native notifications can't be used
* or if they will happen before call to appDidLaunch: is made.
*/
+ (void)trackSubsessionStart;
/**
* @brief Tell adjust that the application paused.
*
* @note Only necessary if the native notifications can't be used.
*/
+ (void)trackSubsessionEnd;
/**
* @brief Enable or disable the adjust SDK. This setting is saved for future sessions.
*
* @param enabled The flag to enable or disable the adjust SDK.
*/
+ (void)setEnabled:(BOOL)enabled;
/**
* @brief Check if the SDK is enabled or disabled.
*
* return Boolean indicating whether SDK is enabled or not.
*/
+ (BOOL)isEnabled;
/**
* @brief Read the URL that opened the application to search for an adjust deep link.
*
* @param url URL object which contains info about adjust deep link.
*/
+ (void)appWillOpenUrl:(nonnull NSURL *)url;
/**
* @brief Set the device token used by push notifications.
*
* @param deviceToken Apple push notification token for iOS device as NSData.
*/
+ (void)setDeviceToken:(nonnull NSData *)deviceToken;
/**
* @brief Set the device token used by push notifications.
* This method is only used by Adjust non native SDKs. Don't use it anywhere else.
*
* @param pushToken Apple push notification token for iOS device as NSString.
*/
+ (void)setPushToken:(nonnull NSString *)pushToken;
/**
* @brief Enable or disable offline mode. Activities won't be sent but they are saved when
* offline mode is disabled. This feature is not saved for future sessions.
*
* @param enabled The flag to enable or disable offline mode.
*/
+ (void)setOfflineMode:(BOOL)enabled;
/**
* @brief Retrieve iOS device IDFA value.
*
* @return Device IDFA value.
*/
+ (nullable NSString *)idfa;
/**
* @brief Get current adjust identifier for the user.
*
* @note Adjust identifier is available only after installation has been successfully tracked.
*
* @return Current adjust identifier value for the user.
*/
+ (nullable NSString *)adid;
/**
* @brief Get current attribution for the user.
*
* @note Attribution information is available only after installation has been successfully tracked
* and attribution information arrived after that from the backend.
*
* @return Current attribution value for the user.
*/
+ (nullable ADJAttribution *)attribution;
/**
* @brief Get current Adjust SDK version string.
*
* @return Adjust SDK version string (iosX.Y.Z).
*/
+ (nullable NSString *)sdkVersion;
/**
* @brief Convert a universal link style URL to a deeplink style URL with the corresponding scheme.
*
* @param url URL object which contains info about adjust deep link.
* @param scheme Desired scheme to which you want your resulting URL object to be prefixed with.
*
* @return URL object in custom URL scheme style prefixed with given scheme name.
*/
+ (nullable NSURL *)convertUniversalLink:(nonnull NSURL *)url scheme:(nonnull NSString *)scheme;
/**
* @brief Tell the adjust SDK to stop waiting for delayed initialisation timer to complete but rather to start
* upon this call. This should be called if you have obtained needed callback/partner parameters which you
* wanted to put as default ones before the delayedStart value you have set on ADJConfig has expired.
*/
+ (void)sendFirstPackages;
/**
* @brief Tell adjust to send the request to Google and check if the installation
* belongs to Google AdWords campaign.
*
* @note Deprecated method, should not be used.
*/
+ (void)sendAdWordsRequest;
/**
* @brief Add default callback parameter key-value pair which is going to be sent with each tracked session and event.
*
* @param key Default callback parameter key.
* @param value Default callback parameter value.
*/
+ (void)addSessionCallbackParameter:(nonnull NSString *)key value:(nonnull NSString *)value;
/**
* @brief Add default partner parameter key-value pair which is going to be sent with each tracked session.
*
* @param key Default partner parameter key.
* @param value Default partner parameter value.
*/
+ (void)addSessionPartnerParameter:(nonnull NSString *)key value:(nonnull NSString *)value;
/**
* @brief Remove default callback parameter from the session packages.
*
* @param key Default callback parameter key.
*/
+ (void)removeSessionCallbackParameter:(nonnull NSString *)key;
/**
* @brief Remove default partner parameter from the session packages.
*
* @param key Default partner parameter key.
*/
+ (void)removeSessionPartnerParameter:(nonnull NSString *)key;
/**
* @brief Remove all default callback parameters from the session packages.
*/
+ (void)resetSessionCallbackParameters;
/**
* @brief Remove all default partner parameters from the session packages.
*/
+ (void)resetSessionPartnerParameters;
/**
* @brief Give right user to be forgotten in accordance with GDPR law.
*/
+ (void)gdprForgetMe;
/**
* @brief Track ad revenue for given source.
*
* @param source Ad revenue source.
* @param payload Ad revenue payload.
*/
+ (void)trackAdRevenue:(nonnull NSString *)source payload:(nonnull NSData *)payload;
/**
* @brief Give right user to disable sharing data to any third-party.
*/
+ (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.
*
* @param subscription Subscription object.
*/
+ (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;
/**
* @brief Instruct to Adjust SDK to check current state of att_status.
*/
+ (void)checkForNewAttStatus;
/**
* @brief Get the last deep link which has opened the app.
*
* @return Last deep link which has opened the app.
*/
+ (nullable NSURL *)lastDeeplink;
/**
* @brief Method used for internal testing only. Don't use it in production.
*/
+ (void)setTestOptions:(nullable AdjustTestOptions *)testOptions;
/**
* Obtain singleton Adjust object.
*/
+ (nullable instancetype)getInstance;
- (void)appDidLaunch:(nullable ADJConfig *)adjustConfig;
- (void)trackEvent:(nullable ADJEvent *)event;
- (void)setEnabled:(BOOL)enabled;
- (void)teardown;
- (void)appWillOpenUrl:(nonnull NSURL *)url;
- (void)setOfflineMode:(BOOL)enabled;
- (void)setDeviceToken:(nonnull NSData *)deviceToken;
- (void)setPushToken:(nonnull NSString *)pushToken;
- (void)sendFirstPackages;
- (void)trackSubsessionEnd;
- (void)trackSubsessionStart;
- (void)resetSessionPartnerParameters;
- (void)resetSessionCallbackParameters;
- (void)removeSessionPartnerParameter:(nonnull NSString *)key;
- (void)removeSessionCallbackParameter:(nonnull NSString *)key;
- (void)addSessionPartnerParameter:(nonnull NSString *)key value:(nonnull NSString *)value;
- (void)addSessionCallbackParameter:(nonnull NSString *)key value:(nonnull NSString *)value;
- (void)gdprForgetMe;
- (void)trackAdRevenue:(nonnull NSString *)source payload:(nonnull NSData *)payload;
- (void)trackSubscription:(nonnull ADJSubscription *)subscription;
- (BOOL)isEnabled;
- (nullable NSString *)adid;
- (nullable NSString *)idfa;
- (nullable NSString *)sdkVersion;
- (nullable ADJAttribution *)attribution;
- (nullable NSURL *)convertUniversalLink:(nonnull NSURL *)url scheme:(nonnull NSString *)scheme;
- (void)requestTrackingAuthorizationWithCompletionHandler:(void (^_Nullable)(NSUInteger status))completion;
- (int)appTrackingAuthorizationStatus;
- (void)updateConversionValue:(NSInteger)conversionValue;
- (void)trackThirdPartySharing:(nonnull ADJThirdPartySharing *)thirdPartySharing;
- (void)trackMeasurementConsent:(BOOL)enabled;
- (void)trackAdRevenue:(nonnull ADJAdRevenue *)adRevenue;
- (void)checkForNewAttStatus;
- (nullable NSURL *)lastDeeplink;
@end

View File

@@ -0,0 +1,21 @@
fileFormatVersion: 2
guid: 78f041701c2d94787bdb278a5bff4fae
PluginImporter:
serializedVersion: 1
iconMap: {}
executionOrder: {}
isPreloaded: 0
platformData:
Any:
enabled: 0
settings: {}
Editor:
enabled: 0
settings:
DefaultValueInitialized: true
iOS:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,147 @@
fileFormatVersion: 2
guid: 7ecd19f430df2475dad6b1f0cc22114c
timeCreated: 1460026500
licenseType: Free
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 1
Exclude Linux: 1
Exclude Linux64: 1
Exclude LinuxUniversal: 1
Exclude OSXIntel: 1
Exclude OSXIntel64: 1
Exclude OSXUniversal: 1
Exclude WebGL: 1
Exclude Win: 1
Exclude Win64: 1
Exclude iOS: 0
Exclude tvOS: 1
data:
first:
'': Editor
second:
enabled: 0
settings:
CPU: AnyCPU
OS: AnyOS
data:
first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
data:
first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: Linux
second:
enabled: 0
settings:
CPU: x86
data:
first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: x86_64
data:
first:
Standalone: LinuxUniversal
second:
enabled: 0
settings:
CPU: None
data:
first:
Standalone: OSXIntel
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: OSXIntel64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: None
data:
first:
Standalone: Win
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
iPhone: iOS
second:
enabled: 1
settings:
CompileFlags:
FrameworkDependencies:
data:
first:
tvOS: tvOS
second:
enabled: 0
settings:
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
//
// AdjustUnity.h
// Adjust SDK
//
// Created by Pedro Silva (@nonelse) on 27th March 2014.
// Copyright © 2012-2018 Adjust GmbH. All rights reserved.
//
/**
* @brief The main interface to Adjust Unity bridge.
*/
@interface AdjustUnity : NSObject
@end

View File

@@ -0,0 +1,21 @@
fileFormatVersion: 2
guid: 9ffff8839c6ab418b983add4c597fb87
PluginImporter:
serializedVersion: 1
iconMap: {}
executionOrder: {}
isPreloaded: 0
platformData:
Any:
enabled: 0
settings: {}
Editor:
enabled: 0
settings:
DefaultValueInitialized: true
iOS:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,822 @@
//
// AdjustUnity.mm
// Adjust SDK
//
// Created by Pedro Silva (@nonelse) on 27th March 2014.
// Copyright © 2012-2018 Adjust GmbH. All rights reserved.
//
#import "Adjust.h"
#import "ADJEvent.h"
#import "ADJConfig.h"
#import "AdjustUnity.h"
#import "AdjustUnityAppDelegate.h"
#import "AdjustUnityDelegate.h"
@implementation AdjustUnity
#pragma mark - Object lifecycle methods
+ (void)load {
// Swizzle AppDelegate on the load. It should be done as early as possible.
[AdjustUnityAppDelegate swizzleAppDelegateCallbacks];
}
@end
#pragma mark - Helper C methods
// Method for converting JSON stirng parameters into NSArray object.
NSArray* convertArrayParameters(const char* cStringJsonArrayParameters) {
if (cStringJsonArrayParameters == NULL) {
return nil;
}
NSError *error = nil;
NSArray *arrayParameters = nil;
NSString *stringJsonArrayParameters = [NSString stringWithUTF8String:cStringJsonArrayParameters];
if (stringJsonArrayParameters != nil) {
NSData *dataJson = [stringJsonArrayParameters dataUsingEncoding:NSUTF8StringEncoding];
arrayParameters = [NSJSONSerialization JSONObjectWithData:dataJson options:0 error:&error];
}
if (error != nil) {
NSString *errorMessage = @"Failed to parse json parameters!";
NSLog(@"%@", errorMessage);
}
return arrayParameters;
}
BOOL isStringValid(const char* cString) {
if (cString == NULL) {
return false;
}
NSString *objcString = [NSString stringWithUTF8String:cString];
if (objcString == nil) {
return false;
}
if ([objcString isEqualToString:@"ADJ_INVALID"]) {
return false;
}
return true;
}
void addValueOrEmpty(NSMutableDictionary *dictionary, NSString *key, NSObject *value) {
if (nil != value) {
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];
}
}
#pragma mark - Publicly available C methods
extern "C"
{
void _AdjustLaunchApp(const char* appToken,
const char* environment,
const char* sdkPrefix,
const char* userAgent,
const char* defaultTracker,
const char* externalDeviceId,
const char* urlStrategy,
const char* sceneName,
int allowSuppressLogLevel,
int logLevel,
int isDeviceKnown,
int eventBuffering,
int sendInBackground,
int allowiAdInfoReading,
int allowAdServicesInfoReading,
int allowIdfaReading,
int deactivateSkAdNetworkHandling,
int linkMeEnabled,
int needsCost,
int coppaCompliant,
int64_t secretId,
int64_t info1,
int64_t info2,
int64_t info3,
int64_t info4,
double delayStart,
int launchDeferredDeeplink,
int isAttributionCallbackImplemented,
int isEventSuccessCallbackImplemented,
int isEventFailureCallbackImplemented,
int isSessionSuccessCallbackImplemented,
int isSessionFailureCallbackImplemented,
int isDeferredDeeplinkCallbackImplemented,
int isConversionValueUpdatedCallbackImplemented) {
NSString *stringAppToken = isStringValid(appToken) == true ? [NSString stringWithUTF8String:appToken] : nil;
NSString *stringEnvironment = isStringValid(environment) == true ? [NSString stringWithUTF8String:environment] : nil;
NSString *stringSdkPrefix = isStringValid(sdkPrefix) == true ? [NSString stringWithUTF8String:sdkPrefix] : nil;
NSString *stringUserAgent = isStringValid(userAgent) == true ? [NSString stringWithUTF8String:userAgent] : nil;
NSString *stringDefaultTracker = isStringValid(defaultTracker) == true ? [NSString stringWithUTF8String:defaultTracker] : nil;
NSString *stringExternalDeviceId = isStringValid(externalDeviceId) == true ? [NSString stringWithUTF8String:externalDeviceId] : nil;
NSString *stringUrlStrategy = isStringValid(urlStrategy) == true ? [NSString stringWithUTF8String:urlStrategy] : nil;
NSString *stringSceneName = isStringValid(sceneName) == true ? [NSString stringWithUTF8String:sceneName] : nil;
ADJConfig *adjustConfig;
if (allowSuppressLogLevel != -1) {
adjustConfig = [ADJConfig configWithAppToken:stringAppToken
environment:stringEnvironment
allowSuppressLogLevel:(BOOL)allowSuppressLogLevel];
} else {
adjustConfig = [ADJConfig configWithAppToken:stringAppToken
environment:stringEnvironment];
}
// Set SDK prefix.
[adjustConfig setSdkPrefix:stringSdkPrefix];
// Check if user has selected to implement any of the callbacks.
if (isAttributionCallbackImplemented
|| isEventSuccessCallbackImplemented
|| isEventFailureCallbackImplemented
|| isSessionSuccessCallbackImplemented
|| isSessionFailureCallbackImplemented
|| isDeferredDeeplinkCallbackImplemented
|| isConversionValueUpdatedCallbackImplemented) {
[adjustConfig setDelegate:
[AdjustUnityDelegate getInstanceWithSwizzleOfAttributionCallback:isAttributionCallbackImplemented
eventSuccessCallback:isEventSuccessCallbackImplemented
eventFailureCallback:isEventFailureCallbackImplemented
sessionSuccessCallback:isSessionSuccessCallbackImplemented
sessionFailureCallback:isSessionFailureCallbackImplemented
deferredDeeplinkCallback:isDeferredDeeplinkCallbackImplemented
conversionValueUpdatedCallback:isConversionValueUpdatedCallbackImplemented
shouldLaunchDeferredDeeplink:launchDeferredDeeplink
withAdjustUnitySceneName:stringSceneName]];
}
// Log level.
if (logLevel != -1) {
[adjustConfig setLogLevel:(ADJLogLevel)logLevel];
}
// Event buffering.
if (eventBuffering != -1) {
[adjustConfig setEventBufferingEnabled:(BOOL)eventBuffering];
}
// Send in background.
if (sendInBackground != -1) {
[adjustConfig setSendInBackground:(BOOL)sendInBackground];
}
// Allow iAd info reading.
if (allowiAdInfoReading != -1) {
[adjustConfig setAllowiAdInfoReading:(BOOL)allowiAdInfoReading];
}
// Allow AdServices info reading.
if (allowAdServicesInfoReading != -1) {
[adjustConfig setAllowAdServicesInfoReading:(BOOL)allowAdServicesInfoReading];
}
// Deactivate default SKAdNetwork handling.
if (deactivateSkAdNetworkHandling != -1) {
[adjustConfig deactivateSKAdNetworkHandling];
}
// Allow IDFA reading.
if (allowIdfaReading != -1) {
[adjustConfig setAllowIdfaReading:(BOOL)allowIdfaReading];
}
// Enable LinkMe feature.
if (linkMeEnabled != -1) {
[adjustConfig setLinkMeEnabled:(BOOL)linkMeEnabled];
}
// Device known.
if (isDeviceKnown != -1) {
[adjustConfig setIsDeviceKnown:(BOOL)isDeviceKnown];
}
// Delay start.
if (delayStart != -1) {
[adjustConfig setDelayStart:delayStart];
}
// Cost data in attribution callback.
if (needsCost != -1) {
[adjustConfig setNeedsCost:(BOOL)needsCost];
}
// COPPA compliance.
if (coppaCompliant != -1) {
[adjustConfig setCoppaCompliantEnabled:(BOOL)coppaCompliant];
}
// User agent.
if (stringUserAgent != nil) {
[adjustConfig setUserAgent:stringUserAgent];
}
// Default tracker.
if (stringDefaultTracker != nil) {
[adjustConfig setDefaultTracker:stringDefaultTracker];
}
// External device identifier.
if (stringExternalDeviceId != nil) {
[adjustConfig setExternalDeviceId:stringExternalDeviceId];
}
// URL strategy.
if (stringUrlStrategy != nil) {
if ([stringUrlStrategy isEqualToString:@"china"]) {
[adjustConfig setUrlStrategy:ADJUrlStrategyChina];
} else if ([stringUrlStrategy isEqualToString:@"india"]) {
[adjustConfig setUrlStrategy:ADJUrlStrategyIndia];
} else if ([stringUrlStrategy isEqualToString:@"data-residency-eu"]) {
[adjustConfig setUrlStrategy:ADJDataResidencyEU];
} else if ([stringUrlStrategy isEqualToString:@"data-residency-tr"]) {
[adjustConfig setUrlStrategy:ADJDataResidencyTR];
} else if ([stringUrlStrategy isEqualToString:@"data-residency-us"]) {
[adjustConfig setUrlStrategy:ADJDataResidencyUS];
}
}
// App secret.
if (secretId != -1 && info1 != -1 && info2 != -1 && info3 != -1 && info4 != 1) {
[adjustConfig setAppSecret:secretId info1:info1 info2:info2 info3:info3 info4:info4];
}
// Start the SDK.
[Adjust appDidLaunch:adjustConfig];
[Adjust trackSubsessionStart];
}
void _AdjustTrackEvent(const char* eventToken,
double revenue,
const char* currency,
const char* receipt,
const char* transactionId,
const char* callbackId,
int isReceiptSet,
const char* jsonCallbackParameters,
const char* jsonPartnerParameters) {
NSString *stringEventToken = isStringValid(eventToken) == true ? [NSString stringWithUTF8String:eventToken] : nil;
ADJEvent *event = [ADJEvent eventWithEventToken:stringEventToken];
// Revenue and currency.
if (revenue != -1 && currency != NULL) {
NSString *stringCurrency = [NSString stringWithUTF8String:currency];
[event setRevenue:revenue currency:stringCurrency];
}
// Callback parameters.
NSArray *arrayCallbackParameters = convertArrayParameters(jsonCallbackParameters);
if (arrayCallbackParameters != nil) {
NSUInteger count = [arrayCallbackParameters count];
for (int i = 0; i < count;) {
NSString *key = arrayCallbackParameters[i++];
NSString *value = arrayCallbackParameters[i++];
[event addCallbackParameter:key value:value];
}
}
NSArray *arrayPartnerParameters = convertArrayParameters(jsonPartnerParameters);
if (arrayPartnerParameters != nil) {
NSUInteger count = [arrayPartnerParameters count];
for (int i = 0; i < count;) {
NSString *key = arrayPartnerParameters[i++];
NSString *value = arrayPartnerParameters[i++];
[event addPartnerParameter:key value:value];
}
}
// Transaction ID.
if (transactionId != NULL) {
NSString *stringTransactionId = [NSString stringWithUTF8String:transactionId];
[event setTransactionId:stringTransactionId];
}
// Callback ID.
if (callbackId != NULL) {
NSString *stringCallbackId = [NSString stringWithUTF8String:callbackId];
[event setCallbackId:stringCallbackId];
}
// Receipt (legacy).
if ([[NSNumber numberWithInt:isReceiptSet] boolValue]) {
NSString *stringReceipt = nil;
NSString *stringTransactionId = nil;
if (receipt != NULL) {
stringReceipt = [NSString stringWithUTF8String:receipt];
}
if (transactionId != NULL) {
stringTransactionId = [NSString stringWithUTF8String:transactionId];
}
[event setReceipt:[stringReceipt dataUsingEncoding:NSUTF8StringEncoding] transactionId:stringTransactionId];
}
// Track event.
[Adjust trackEvent:event];
}
void _AdjustTrackSubsessionStart() {
[Adjust trackSubsessionStart];
}
void _AdjustTrackSubsessionEnd() {
[Adjust trackSubsessionEnd];
}
void _AdjustSetEnabled(int enabled) {
BOOL bEnabled = (BOOL)enabled;
[Adjust setEnabled:bEnabled];
}
int _AdjustIsEnabled() {
BOOL isEnabled = [Adjust isEnabled];
int iIsEnabled = (int)isEnabled;
return iIsEnabled;
}
void _AdjustSetOfflineMode(int enabled) {
BOOL bEnabled = (BOOL)enabled;
[Adjust setOfflineMode:bEnabled];
}
void _AdjustSetDeviceToken(const char* deviceToken) {
if (deviceToken != NULL) {
NSString *stringDeviceToken = [NSString stringWithUTF8String:deviceToken];
[Adjust setPushToken:stringDeviceToken];
}
}
void _AdjustAppWillOpenUrl(const char* url) {
if (url != NULL) {
NSString *stringUrl = [NSString stringWithUTF8String:url];
NSURL *nsUrl;
if ([NSString instancesRespondToSelector:@selector(stringByAddingPercentEncodingWithAllowedCharacters:)]) {
nsUrl = [NSURL URLWithString:[stringUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]]];
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
nsUrl = [NSURL URLWithString:[stringUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
}
#pragma clang diagnostic pop
[Adjust appWillOpenUrl:nsUrl];
}
}
char* _AdjustGetIdfa() {
NSString *idfa = [Adjust idfa];
if (nil == idfa) {
return NULL;
}
const char* idfaCString = [idfa UTF8String];
if (NULL == idfaCString) {
return NULL;
}
char* idfaCStringCopy = strdup(idfaCString);
return idfaCStringCopy;
}
char* _AdjustGetAdid() {
NSString *adid = [Adjust adid];
if (nil == adid) {
return NULL;
}
const char* adidCString = [adid UTF8String];
if (NULL == adidCString) {
return NULL;
}
char* adidCStringCopy = strdup(adidCString);
return adidCStringCopy;
}
char* _AdjustGetSdkVersion() {
NSString *sdkVersion = [Adjust sdkVersion];
if (nil == sdkVersion) {
return NULL;
}
const char* sdkVersionCString = [sdkVersion UTF8String];
if (NULL == sdkVersionCString) {
return NULL;
}
char* sdkVersionCStringCopy = strdup(sdkVersionCString);
return sdkVersionCStringCopy;
}
char* _AdjustGetAttribution() {
ADJAttribution *attribution = [Adjust attribution];
if (nil == attribution) {
return NULL;
}
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
addValueOrEmpty(dictionary, @"trackerToken", attribution.trackerToken);
addValueOrEmpty(dictionary, @"trackerName", attribution.trackerName);
addValueOrEmpty(dictionary, @"network", attribution.network);
addValueOrEmpty(dictionary, @"campaign", attribution.campaign);
addValueOrEmpty(dictionary, @"creative", attribution.creative);
addValueOrEmpty(dictionary, @"adgroup", attribution.adgroup);
addValueOrEmpty(dictionary, @"clickLabel", attribution.clickLabel);
addValueOrEmpty(dictionary, @"adid", attribution.adid);
addValueOrEmpty(dictionary, @"costType", attribution.costType);
addValueOrEmpty(dictionary, @"costAmount", attribution.costAmount);
addValueOrEmpty(dictionary, @"costCurrency", attribution.costCurrency);
NSData *dataAttribution = [NSJSONSerialization dataWithJSONObject:dictionary options:0 error:nil];
NSString *stringAttribution = [[NSString alloc] initWithBytes:[dataAttribution bytes]
length:[dataAttribution length]
encoding:NSUTF8StringEncoding];
const char* attributionCString = [stringAttribution UTF8String];
char* attributionCStringCopy = strdup(attributionCString);
return attributionCStringCopy;
}
void _AdjustSendFirstPackages() {
[Adjust sendFirstPackages];
}
void _AdjustGdprForgetMe() {
[Adjust gdprForgetMe];
}
void _AdjustDisableThirdPartySharing() {
[Adjust disableThirdPartySharing];
}
void _AdjustAddSessionPartnerParameter(const char* key, const char* value) {
if (key != NULL && value != NULL) {
NSString *stringKey = [NSString stringWithUTF8String:key];
NSString *stringValue = [NSString stringWithUTF8String:value];
[Adjust addSessionPartnerParameter:stringKey value:stringValue];
}
}
void _AdjustAddSessionCallbackParameter(const char* key, const char* value) {
if (key != NULL && value != NULL) {
NSString *stringKey = [NSString stringWithUTF8String:key];
NSString *stringValue = [NSString stringWithUTF8String:value];
[Adjust addSessionCallbackParameter:stringKey value:stringValue];
}
}
void _AdjustRemoveSessionPartnerParameter(const char* key) {
if (key != NULL) {
NSString *stringKey = [NSString stringWithUTF8String:key];
[Adjust removeSessionPartnerParameter:stringKey];
}
}
void _AdjustRemoveSessionCallbackParameter(const char* key) {
if (key != NULL) {
NSString *stringKey = [NSString stringWithUTF8String:key];
[Adjust removeSessionCallbackParameter:stringKey];
}
}
void _AdjustResetSessionPartnerParameters() {
[Adjust resetSessionPartnerParameters];
}
void _AdjustResetSessionCallbackParameters() {
[Adjust resetSessionCallbackParameters];
}
void _AdjustTrackAdRevenue(const char* source, const char* payload) {
if (source != NULL && payload != NULL) {
NSString *stringSource = [NSString stringWithUTF8String:source];
NSString *stringPayload = [NSString stringWithUTF8String:payload];
NSData *dataPayload = [stringPayload dataUsingEncoding:NSUTF8StringEncoding];
[Adjust trackAdRevenue:stringSource payload:dataPayload];
}
}
void _AdjustTrackAdRevenueNew(const char* source,
double revenue,
const char* currency,
int adImpressionsCount,
const char* adRevenueNetwork,
const char* adRevenueUnit,
const char* adRevenuePlacement,
const char* jsonCallbackParameters,
const char* jsonPartnerParameters) {
NSString *stringSource = isStringValid(source) == true ? [NSString stringWithUTF8String:source] : nil;
ADJAdRevenue *adRevenue = [[ADJAdRevenue alloc] initWithSource:stringSource];
// Revenue and currency.
if (revenue != -1 && currency != NULL) {
NSString *stringCurrency = [NSString stringWithUTF8String:currency];
[adRevenue setRevenue:revenue currency:stringCurrency];
}
// Ad impressions count.
if (adImpressionsCount != -1) {
[adRevenue setAdImpressionsCount:adImpressionsCount];
}
// Ad revenue network.
if (adRevenueNetwork != NULL) {
NSString *stringAdRevenueNetwork = [NSString stringWithUTF8String:adRevenueNetwork];
[adRevenue setAdRevenueNetwork:stringAdRevenueNetwork];
}
// Ad revenue unit.
if (adRevenueUnit != NULL) {
NSString *stringAdRevenueUnit = [NSString stringWithUTF8String:adRevenueUnit];
[adRevenue setAdRevenueUnit:stringAdRevenueUnit];
}
// Ad revenue placement.
if (adRevenuePlacement != NULL) {
NSString *stringAdRevenuePlacement = [NSString stringWithUTF8String:adRevenuePlacement];
[adRevenue setAdRevenuePlacement:stringAdRevenuePlacement];
}
// Callback parameters.
NSArray *arrayCallbackParameters = convertArrayParameters(jsonCallbackParameters);
if (arrayCallbackParameters != nil) {
NSUInteger count = [arrayCallbackParameters count];
for (int i = 0; i < count;) {
NSString *key = arrayCallbackParameters[i++];
NSString *value = arrayCallbackParameters[i++];
[adRevenue addCallbackParameter:key value:value];
}
}
NSArray *arrayPartnerParameters = convertArrayParameters(jsonPartnerParameters);
if (arrayPartnerParameters != nil) {
NSUInteger count = [arrayPartnerParameters count];
for (int i = 0; i < count;) {
NSString *key = arrayPartnerParameters[i++];
NSString *value = arrayPartnerParameters[i++];
[adRevenue addPartnerParameter:key value:value];
}
}
// Track ad revenue.
[Adjust trackAdRevenue:adRevenue];
}
void _AdjustTrackAppStoreSubscription(const char* price,
const char* currency,
const char* transactionId,
const char* receipt,
const char* billingStore,
const char* transactionDate,
const char* salesRegion,
const char* jsonCallbackParameters,
const char* jsonPartnerParameters) {
// Mandatory fields.
NSDecimalNumber *mPrice;
NSString *mCurrency;
NSString *mTransactionId;
NSData *mReceipt;
NSString *mBillingStore;
// Price.
if (price != NULL) {
mPrice = [NSDecimalNumber decimalNumberWithString:[NSString stringWithUTF8String:price]];
}
// Currency.
if (currency != NULL) {
mCurrency = [NSString stringWithUTF8String:currency];
}
// Transaction ID.
if (transactionId != NULL) {
mTransactionId = [NSString stringWithUTF8String:transactionId];
}
// Receipt.
if (receipt != NULL) {
mReceipt = [[NSString stringWithUTF8String:receipt] dataUsingEncoding:NSUTF8StringEncoding];
}
// Billing store (not used ATM, maybe in the future).
if (billingStore != NULL) {
mBillingStore = [NSString stringWithUTF8String:billingStore];
}
ADJSubscription *subscription = [[ADJSubscription alloc] initWithPrice:mPrice
currency:mCurrency
transactionId:mTransactionId
andReceipt:mReceipt];
// Optional fields.
// Transaction date.
if (transactionDate != NULL) {
NSTimeInterval transactionDateInterval = [[NSString stringWithUTF8String:transactionDate] doubleValue] / 1000.0;
NSDate *oTransactionDate = [NSDate dateWithTimeIntervalSince1970:transactionDateInterval];
[subscription setTransactionDate:oTransactionDate];
}
// Sales region.
if (salesRegion != NULL) {
NSString *oSalesRegion = [NSString stringWithUTF8String:salesRegion];
[subscription setSalesRegion:oSalesRegion];
}
// Callback parameters.
NSArray *arrayCallbackParameters = convertArrayParameters(jsonCallbackParameters);
if (arrayCallbackParameters != nil) {
NSUInteger count = [arrayCallbackParameters count];
for (int i = 0; i < count;) {
NSString *key = arrayCallbackParameters[i++];
NSString *value = arrayCallbackParameters[i++];
[subscription addCallbackParameter:key value:value];
}
}
// Partner parameters.
NSArray *arrayPartnerParameters = convertArrayParameters(jsonPartnerParameters);
if (arrayPartnerParameters != nil) {
NSUInteger count = [arrayPartnerParameters count];
for (int i = 0; i < count;) {
NSString *key = arrayPartnerParameters[i++];
NSString *value = arrayPartnerParameters[i++];
[subscription addPartnerParameter:key value:value];
}
}
// Track subscription.
[Adjust trackSubscription:subscription];
}
void _AdjustTrackThirdPartySharing(int enabled, const char* jsonGranularOptions, const char* jsonPartnerSharingSettings) {
NSNumber *nEnabled = enabled >= 0 ? [NSNumber numberWithInt:enabled] : nil;
ADJThirdPartySharing *adjustThirdPartySharing = [[ADJThirdPartySharing alloc] initWithIsEnabledNumberBool:nEnabled];
NSArray *arrayGranularOptions = convertArrayParameters(jsonGranularOptions);
if (arrayGranularOptions != nil) {
NSUInteger count = [arrayGranularOptions count];
for (int i = 0; i < count;) {
NSString *partnerName = arrayGranularOptions[i++];
NSString *granularOptions = arrayGranularOptions[i++];
// granularOptions is now NSString which pretty much contains array of partner key-value pairs
if (granularOptions != nil) {
NSData *dataJson = [granularOptions dataUsingEncoding:NSUTF8StringEncoding];
NSArray *partnerGranularOptions = [NSJSONSerialization JSONObjectWithData:dataJson options:0 error:nil];
if (partnerGranularOptions != nil) {
// in here we have partner and key-value pair for it
for (int j = 0; j < [partnerGranularOptions count];) {
[adjustThirdPartySharing addGranularOption:partnerName
key:partnerGranularOptions[j++]
value:partnerGranularOptions[j++]];
}
}
}
}
}
NSArray *arrayPartnerSharingSettings = convertArrayParameters(jsonPartnerSharingSettings);
if (arrayPartnerSharingSettings != nil) {
NSUInteger count = [arrayPartnerSharingSettings count];
for (int i = 0; i < count;) {
NSString *partnerName = arrayPartnerSharingSettings[i++];
NSString *sharingSettings = arrayPartnerSharingSettings[i++];
// sharingSettings is now NSString which pretty much contains array of partner key-value pairs
if (sharingSettings != nil) {
NSData *dataJson = [sharingSettings dataUsingEncoding:NSUTF8StringEncoding];
NSArray *partnerSharingSettings = [NSJSONSerialization JSONObjectWithData:dataJson options:0 error:nil];
if (partnerSharingSettings != nil) {
// in here we have partner and key-value pair for it
for (int j = 0; j < [partnerSharingSettings count];) {
[adjustThirdPartySharing addPartnerSharingSetting:partnerName
key:partnerSharingSettings[j++]
value:[partnerSharingSettings[j++] boolValue]];
}
}
}
}
}
[Adjust trackThirdPartySharing:adjustThirdPartySharing];
}
void _AdjustTrackMeasurementConsent(int enabled) {
BOOL bEnabled = (BOOL)enabled;
[Adjust trackMeasurementConsent:bEnabled];
}
void _AdjustRequestTrackingAuthorizationWithCompletionHandler(const char* sceneName) {
NSString *stringSceneName = isStringValid(sceneName) == true ? [NSString stringWithUTF8String:sceneName] : nil;
if (stringSceneName == nil) {
return;
}
[Adjust requestTrackingAuthorizationWithCompletionHandler:^(NSUInteger status) {
NSString *stringStatus = [NSString stringWithFormat:@"%tu", status];
const char* charStatus = [stringStatus UTF8String];
UnitySendMessage([stringSceneName UTF8String], "GetAuthorizationStatus", charStatus);
}];
}
void _AdjustUpdateConversionValue(int conversionValue) {
[Adjust updateConversionValue:conversionValue];
}
void _AdjustCheckForNewAttStatus() {
[Adjust checkForNewAttStatus];
}
int _AdjustGetAppTrackingAuthorizationStatus() {
return [Adjust appTrackingAuthorizationStatus];
}
char* _AdjustGetLastDeeplink() {
NSURL *lastDeeplink = [Adjust lastDeeplink];
if (nil == lastDeeplink) {
return NULL;
}
NSString *lastDeeplinkString = [lastDeeplink absoluteString];
if (nil == lastDeeplinkString) {
return NULL;
}
const char* lastDeeplinkCString = [lastDeeplinkString UTF8String];
if (NULL == lastDeeplinkCString) {
return NULL;
}
char* lastDeeplinkCStringCopy = strdup(lastDeeplinkCString);
return lastDeeplinkCStringCopy;
}
void _AdjustSetTestOptions(const char* baseUrl,
const char* gdprUrl,
const char* subscriptionUrl,
const char* extraPath,
long timerIntervalInMilliseconds,
long timerStartInMilliseconds,
long sessionIntervalInMilliseconds,
long subsessionIntervalInMilliseconds,
int teardown,
int deleteState,
int noBackoffWait,
int iAdFrameworkEnabled,
int adServicesFrameworkEnabled) {
AdjustTestOptions *testOptions = [[AdjustTestOptions alloc] init];
NSString *stringBaseUrl = isStringValid(baseUrl) == true ? [NSString stringWithUTF8String:baseUrl] : nil;
if (stringBaseUrl != nil) {
[testOptions setBaseUrl:stringBaseUrl];
}
NSString *stringGdprUrl = isStringValid(baseUrl) == true ? [NSString stringWithUTF8String:gdprUrl] : nil;
if (stringGdprUrl != nil) {
[testOptions setGdprUrl:stringGdprUrl];
}
NSString *stringSubscriptionUrl = isStringValid(baseUrl) == true ? [NSString stringWithUTF8String:subscriptionUrl] : nil;
if (stringSubscriptionUrl != nil) {
[testOptions setSubscriptionUrl:stringSubscriptionUrl];
}
NSString *stringExtraPath = isStringValid(extraPath) == true ? [NSString stringWithUTF8String:extraPath] : nil;
if (stringExtraPath != nil && [stringExtraPath length] > 0) {
[testOptions setExtraPath:stringExtraPath];
}
testOptions.timerIntervalInMilliseconds = [NSNumber numberWithLong:timerIntervalInMilliseconds];
testOptions.timerStartInMilliseconds = [NSNumber numberWithLong:timerStartInMilliseconds];
testOptions.sessionIntervalInMilliseconds = [NSNumber numberWithLong:sessionIntervalInMilliseconds];
testOptions.subsessionIntervalInMilliseconds = [NSNumber numberWithLong:subsessionIntervalInMilliseconds];
if (teardown != -1) {
[AdjustUnityDelegate teardown];
[testOptions setTeardown:(BOOL)teardown];
}
if (deleteState != -1) {
[testOptions setDeleteState:(BOOL)deleteState];
}
if (noBackoffWait != -1) {
[testOptions setNoBackoffWait:(BOOL)noBackoffWait];
}
if (iAdFrameworkEnabled != -1) {
[testOptions setIAdFrameworkEnabled:(BOOL)iAdFrameworkEnabled];
}
if (adServicesFrameworkEnabled != -1) {
[testOptions setAdServicesFrameworkEnabled:(BOOL)adServicesFrameworkEnabled];
}
[Adjust setTestOptions:testOptions];
}
}

View File

@@ -0,0 +1,131 @@
fileFormatVersion: 2
guid: 3e17e20d987e4449489d9e3accbd8602
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 1
Exclude Linux: 1
Exclude Linux64: 1
Exclude LinuxUniversal: 1
Exclude OSXIntel: 1
Exclude OSXIntel64: 1
Exclude OSXUniversal: 1
Exclude WebGL: 1
Exclude Win: 1
Exclude Win64: 1
Exclude iOS: 0
Exclude tvOS: 1
data:
first:
'': Editor
second:
enabled: 0
settings:
CPU: AnyCPU
OS: AnyOS
data:
first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
data:
first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: Linux
second:
enabled: 0
settings:
CPU: x86
data:
first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: x86_64
data:
first:
Standalone: OSXIntel
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: OSXIntel64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: Win
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
iPhone: iOS
second:
enabled: 1
settings:
CompileFlags:
FrameworkDependencies:
data:
first:
tvOS: tvOS
second:
enabled: 0
settings:
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
//
// AdjustUnityAppDelegate.h
// Adjust SDK
//
// Copyright © 2012-2021 Adjust GmbH. All rights reserved.
//
/**
* @brief The interface to Adjust App Delegate. Used to do callback methods swizzling for deep linking.
*/
@interface AdjustUnityAppDelegate : NSObject
/**
* @brief Swizzle AppDelegate deep linking callbacks.
*/
+ (void)swizzleAppDelegateCallbacks;
@end

View File

@@ -0,0 +1,27 @@
fileFormatVersion: 2
guid: ac4b0b80967dd499b94e6bd430ac6662
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,73 @@
//
// AdjustUnityAppDelegate.mm
// Adjust SDK
//
// Copyright © 2012-2021 Adjust GmbH. All rights reserved.
//
#import <objc/runtime.h>
#import "Adjust.h"
#import "AdjustUnityAppDelegate.h"
typedef BOOL (*openURL_t)(id, SEL, UIApplication *, NSURL *, NSDictionary *);
typedef BOOL (*continueUserActivity_t)(id, SEL, UIApplication *, NSUserActivity *, void (^)(NSArray *restorableObjects));
static openURL_t original_openURL = NULL;
static continueUserActivity_t original_continueUserActivity = NULL;
@implementation AdjustUnityAppDelegate
+ (void)swizzleAppDelegateCallbacks {
NSLog(@"[Adjust] Swizzling AppDelegate callbacks...");
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
original_openURL = (openURL_t)[self swizzleOriginalSelector:@selector(application:openURL:options:)
withSelector:@selector(adjust_application:openURL:options:)];
original_continueUserActivity = (continueUserActivity_t)[self swizzleOriginalSelector:@selector(application:continueUserActivity:restorationHandler:)
withSelector:@selector(adjust_application:continueUserActivity:restorationHandler:)];
});
}
+ (IMP)swizzleOriginalSelector:(SEL)originalSelector
withSelector:(SEL)swizzledSelector {
// The Unity base app controller class name.
extern const char* AppControllerClassName;
Class originalClass = NSClassFromString([NSString stringWithUTF8String:AppControllerClassName]);
Class swizzledClass = [self class];
IMP originalImp = NULL;
IMP swizzledImp = class_getMethodImplementation(swizzledClass, swizzledSelector);
// Replace original implementation by the custom one.
Method originalMethod = class_getInstanceMethod(originalClass, originalSelector);
if (originalMethod) {
originalImp = method_setImplementation(originalMethod, swizzledImp);
} else if (![originalClass instancesRespondToSelector:originalSelector]) {
// Add the method to the original class if it doesn't implement the selector.
Method swizzledMethod = class_getInstanceMethod(swizzledClass, swizzledSelector);
BOOL methodAdded = class_addMethod(originalClass, originalSelector, swizzledImp, method_getTypeEncoding(swizzledMethod));
if (!methodAdded) {
NSLog(@"[Adjust] Cannot swizzle selector '%@' of class '%@'.", NSStringFromSelector(originalSelector), originalClass);
return NULL;
}
}
NSLog(@"[Adjust] Selector '%@' of class '%@' is swizzled.", NSStringFromSelector(originalSelector), originalClass);
return originalImp;
}
- (BOOL)adjust_application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary *)options {
[Adjust appWillOpenUrl:url];
return original_openURL ? original_openURL(self, _cmd, application, url, options) : YES;
}
- (BOOL)adjust_application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {
if ([[userActivity activityType] isEqualToString:NSUserActivityTypeBrowsingWeb]) {
NSURL *url = [userActivity webpageURL];
[Adjust appWillOpenUrl:url];
}
return original_continueUserActivity ? original_continueUserActivity(self, _cmd, application, userActivity, restorationHandler) : YES;
}
@end

View File

@@ -0,0 +1,37 @@
fileFormatVersion: 2
guid: ea1bc374f78b747f8a81fcc82cd77d96
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings: {}
- first:
tvOS: tvOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,57 @@
//
// AdjustUnityDelegate.h
// Adjust SDK
//
// Created by Uglješa Erceg (@uerceg) on 5th December 2016.
// Copyright © 2012-2018 Adjust GmbH. All rights reserved.
//
#import "Adjust.h"
/**
* @brief The main interface to Adjust Unity delegate. Used to do callback methods swizzling where needed.
*/
@interface AdjustUnityDelegate : NSObject<AdjustDelegate>
/**
* @brief Boolean indicating whether deferred deep link should be launched by SDK or not.
*/
@property (nonatomic) BOOL shouldLaunchDeferredDeeplink;
/**
* @brief Name of the Unity scene that loads Adjust SDK.
*/
@property (nonatomic, copy) NSString *adjustUnitySceneName;
/**
* @brief Get instance of the AdjustUnityDelegate with properly swizzled callback methods.
*
* @param swizzleAttributionCallback Indicator whether attribution callback should be swizzled or not.
* @param swizzleEventSuccessCallback Indicator whether event success callback should be swizzled or not.
* @param swizzleEventFailureCallback Indicator whether event failure callback should be swizzled or not.
* @param swizzleSessionSuccessCallback Indicator whether session success callback should be swizzled or not.
* @param swizzleSessionFailureCallback Indicator whether session failure callback should be swizzled or not.
* @param swizzleDeferredDeeplinkCallback Indicator whether deferred deep link callback should be swizzled or not.
* @param swizzleConversionValueUpdatedCallback Indicator whether deferred deep link callback should be swizzled or not.
* @param shouldLaunchDeferredDeeplink Indicator whether SDK should launch deferred deep link by default or not.
* @param adjustUnitySceneName Name of the Unity scene that loads Adjust SDK.
*
* @return AdjustUnityDelegate object instance with properly swizzled callback methods.
*/
+ (id)getInstanceWithSwizzleOfAttributionCallback:(BOOL)swizzleAttributionCallback
eventSuccessCallback:(BOOL)swizzleEventSuccessCallback
eventFailureCallback:(BOOL)swizzleEventFailureCallback
sessionSuccessCallback:(BOOL)swizzleSessionSuccessCallback
sessionFailureCallback:(BOOL)swizzleSessionFailureCallback
deferredDeeplinkCallback:(BOOL)swizzleDeferredDeeplinkCallback
conversionValueUpdatedCallback:(BOOL)swizzleConversionValueUpdatedCallback
shouldLaunchDeferredDeeplink:(BOOL)shouldLaunchDeferredDeeplink
withAdjustUnitySceneName:(NSString *)adjustUnitySceneName;
/**
* @brief Teardown method used to reset static AdjustUnityDelegate instance.
* Used for testing purposes only.
*/
+ (void)teardown;
@end

View File

@@ -0,0 +1,147 @@
fileFormatVersion: 2
guid: 5d2beef19c617f74fbca612cc97e3c60
timeCreated: 1489655216
licenseType: Pro
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 1
Exclude Linux: 1
Exclude Linux64: 1
Exclude LinuxUniversal: 1
Exclude OSXIntel: 1
Exclude OSXIntel64: 1
Exclude OSXUniversal: 1
Exclude WebGL: 1
Exclude Win: 1
Exclude Win64: 1
Exclude iOS: 0
Exclude tvOS: 1
data:
first:
'': Editor
second:
enabled: 0
settings:
CPU: AnyCPU
OS: AnyOS
data:
first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
data:
first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: Linux
second:
enabled: 0
settings:
CPU: x86
data:
first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: x86_64
data:
first:
Standalone: LinuxUniversal
second:
enabled: 0
settings:
CPU: None
data:
first:
Standalone: OSXIntel
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: OSXIntel64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: None
data:
first:
Standalone: Win
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
iPhone: iOS
second:
enabled: 1
settings:
CompileFlags:
FrameworkDependencies:
data:
first:
tvOS: tvOS
second:
enabled: 0
settings:
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,250 @@
//
// AdjustUnityDelegate.mm
// Adjust SDK
//
// Created by Uglješa Erceg (@uerceg) on 5th December 2016.
// Copyright © 2012-2018 Adjust GmbH. All rights reserved.
//
#import <objc/runtime.h>
#import "AdjustUnityDelegate.h"
static dispatch_once_t onceToken;
static AdjustUnityDelegate *defaultInstance = nil;
@implementation AdjustUnityDelegate
#pragma mark - Object lifecycle methods
- (id)init {
self = [super init];
if (nil == self) {
return nil;
}
return self;
}
#pragma mark - Public methods
+ (id)getInstanceWithSwizzleOfAttributionCallback:(BOOL)swizzleAttributionCallback
eventSuccessCallback:(BOOL)swizzleEventSuccessCallback
eventFailureCallback:(BOOL)swizzleEventFailureCallback
sessionSuccessCallback:(BOOL)swizzleSessionSuccessCallback
sessionFailureCallback:(BOOL)swizzleSessionFailureCallback
deferredDeeplinkCallback:(BOOL)swizzleDeferredDeeplinkCallback
conversionValueUpdatedCallback:(BOOL)swizzleConversionValueUpdatedCallback
shouldLaunchDeferredDeeplink:(BOOL)shouldLaunchDeferredDeeplink
withAdjustUnitySceneName:(NSString *)adjustUnitySceneName; {
dispatch_once(&onceToken, ^{
defaultInstance = [[AdjustUnityDelegate alloc] init];
// Do the swizzling where and if needed.
if (swizzleAttributionCallback) {
[defaultInstance swizzleOriginalSelector:@selector(adjustAttributionChanged:)
withSelector:@selector(adjustAttributionChangedWannabe:)];
}
if (swizzleEventSuccessCallback) {
[defaultInstance swizzleOriginalSelector:@selector(adjustEventTrackingSucceeded:)
withSelector:@selector(adjustEventTrackingSucceededWannabe:)];
}
if (swizzleEventFailureCallback) {
[defaultInstance swizzleOriginalSelector:@selector(adjustEventTrackingFailed:)
withSelector:@selector(adjustEventTrackingFailedWannabe:)];
}
if (swizzleSessionSuccessCallback) {
[defaultInstance swizzleOriginalSelector:@selector(adjustSessionTrackingSucceeded:)
withSelector:@selector(adjustSessionTrackingSucceededWannabe:)];
}
if (swizzleSessionFailureCallback) {
[defaultInstance swizzleOriginalSelector:@selector(adjustSessionTrackingFailed:)
withSelector:@selector(adjustSessionTrackingFailedWannabe:)];
}
if (swizzleDeferredDeeplinkCallback) {
[defaultInstance swizzleOriginalSelector:@selector(adjustDeeplinkResponse:)
withSelector:@selector(adjustDeeplinkResponseWannabe:)];
}
if (swizzleConversionValueUpdatedCallback) {
[defaultInstance swizzleOriginalSelector:@selector(adjustConversionValueUpdated:)
withSelector:@selector(adjustConversionValueUpdatedWannabe:)];
}
[defaultInstance setShouldLaunchDeferredDeeplink:shouldLaunchDeferredDeeplink];
[defaultInstance setAdjustUnitySceneName:adjustUnitySceneName];
});
return defaultInstance;
}
+ (void)teardown {
defaultInstance = nil;
onceToken = 0;
}
#pragma mark - Private & helper methods
- (void)adjustAttributionChangedWannabe:(ADJAttribution *)attribution {
if (attribution == nil) {
return;
}
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
[self addValueOrEmpty:attribution.trackerToken forKey:@"trackerToken" toDictionary:dictionary];
[self addValueOrEmpty:attribution.trackerName forKey:@"trackerName" toDictionary:dictionary];
[self addValueOrEmpty:attribution.network forKey:@"network" toDictionary:dictionary];
[self addValueOrEmpty:attribution.campaign forKey:@"campaign" toDictionary:dictionary];
[self addValueOrEmpty:attribution.creative forKey:@"creative" toDictionary:dictionary];
[self addValueOrEmpty:attribution.adgroup forKey:@"adgroup" toDictionary:dictionary];
[self addValueOrEmpty:attribution.clickLabel forKey:@"clickLabel" toDictionary:dictionary];
[self addValueOrEmpty:attribution.adid forKey:@"adid" toDictionary:dictionary];
[self addValueOrEmpty:attribution.costType forKey:@"costType" toDictionary:dictionary];
[self addValueOrEmpty:attribution.costAmount forKey:@"costAmount" toDictionary:dictionary];
[self addValueOrEmpty:attribution.costCurrency forKey:@"costCurrency" toDictionary:dictionary];
NSData *dataAttribution = [NSJSONSerialization dataWithJSONObject:dictionary options:0 error:nil];
NSString *stringAttribution = [[NSString alloc] initWithBytes:[dataAttribution bytes]
length:[dataAttribution length]
encoding:NSUTF8StringEncoding];
const char* charArrayAttribution = [stringAttribution UTF8String];
UnitySendMessage([self.adjustUnitySceneName UTF8String], "GetNativeAttribution", charArrayAttribution);
}
- (void)adjustEventTrackingSucceededWannabe:(ADJEventSuccess *)eventSuccessResponseData {
if (nil == eventSuccessResponseData) {
return;
}
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
[self addValueOrEmpty:eventSuccessResponseData.message forKey:@"message" toDictionary:dictionary];
[self addValueOrEmpty:eventSuccessResponseData.timeStamp forKey:@"timestamp" toDictionary:dictionary];
[self addValueOrEmpty:eventSuccessResponseData.adid forKey:@"adid" toDictionary:dictionary];
[self addValueOrEmpty:eventSuccessResponseData.eventToken forKey:@"eventToken" toDictionary:dictionary];
[self addValueOrEmpty:eventSuccessResponseData.callbackId forKey:@"callbackId" toDictionary:dictionary];
if (eventSuccessResponseData.jsonResponse != nil) {
[dictionary setObject:eventSuccessResponseData.jsonResponse forKey:@"jsonResponse"];
}
NSData *dataEventSuccess = [NSJSONSerialization dataWithJSONObject:dictionary options:0 error:nil];
NSString *stringEventSuccess = [[NSString alloc] initWithBytes:[dataEventSuccess bytes]
length:[dataEventSuccess length]
encoding:NSUTF8StringEncoding];
const char* charArrayEventSuccess = [stringEventSuccess UTF8String];
UnitySendMessage([self.adjustUnitySceneName UTF8String], "GetNativeEventSuccess", charArrayEventSuccess);
}
- (void)adjustEventTrackingFailedWannabe:(ADJEventFailure *)eventFailureResponseData {
if (nil == eventFailureResponseData) {
return;
}
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
[self addValueOrEmpty:eventFailureResponseData.message forKey:@"message" toDictionary:dictionary];
[self addValueOrEmpty:eventFailureResponseData.timeStamp forKey:@"timestamp" toDictionary:dictionary];
[self addValueOrEmpty:eventFailureResponseData.adid forKey:@"adid" toDictionary:dictionary];
[self addValueOrEmpty:eventFailureResponseData.eventToken forKey:@"eventToken" toDictionary:dictionary];
[self addValueOrEmpty:eventFailureResponseData.callbackId forKey:@"callbackId" toDictionary:dictionary];
[dictionary setObject:(eventFailureResponseData.willRetry ? @"true" : @"false") forKey:@"willRetry"];
if (eventFailureResponseData.jsonResponse != nil) {
[dictionary setObject:eventFailureResponseData.jsonResponse forKey:@"jsonResponse"];
}
NSData *dataEventFailure = [NSJSONSerialization dataWithJSONObject:dictionary options:0 error:nil];
NSString *stringEventFailure = [[NSString alloc] initWithBytes:[dataEventFailure bytes]
length:[dataEventFailure length]
encoding:NSUTF8StringEncoding];
const char* charArrayEventFailure = [stringEventFailure UTF8String];
UnitySendMessage([self.adjustUnitySceneName UTF8String], "GetNativeEventFailure", charArrayEventFailure);
}
- (void)adjustSessionTrackingSucceededWannabe:(ADJSessionSuccess *)sessionSuccessResponseData {
if (nil == sessionSuccessResponseData) {
return;
}
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
[self addValueOrEmpty:sessionSuccessResponseData.message forKey:@"message" toDictionary:dictionary];
[self addValueOrEmpty:sessionSuccessResponseData.timeStamp forKey:@"timestamp" toDictionary:dictionary];
[self addValueOrEmpty:sessionSuccessResponseData.adid forKey:@"adid" toDictionary:dictionary];
if (sessionSuccessResponseData.jsonResponse != nil) {
[dictionary setObject:sessionSuccessResponseData.jsonResponse forKey:@"jsonResponse"];
}
NSData *dataSessionSuccess = [NSJSONSerialization dataWithJSONObject:dictionary options:0 error:nil];
NSString *stringSessionSuccess = [[NSString alloc] initWithBytes:[dataSessionSuccess bytes]
length:[dataSessionSuccess length]
encoding:NSUTF8StringEncoding];
const char* charArraySessionSuccess = [stringSessionSuccess UTF8String];
UnitySendMessage([self.adjustUnitySceneName UTF8String], "GetNativeSessionSuccess", charArraySessionSuccess);
}
- (void)adjustSessionTrackingFailedWannabe:(ADJSessionFailure *)sessionFailureResponseData {
if (nil == sessionFailureResponseData) {
return;
}
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
[self addValueOrEmpty:sessionFailureResponseData.message forKey:@"message" toDictionary:dictionary];
[self addValueOrEmpty:sessionFailureResponseData.timeStamp forKey:@"timestamp" toDictionary:dictionary];
[self addValueOrEmpty:sessionFailureResponseData.adid forKey:@"adid" toDictionary:dictionary];
[dictionary setObject:(sessionFailureResponseData.willRetry ? @"true" : @"false") forKey:@"willRetry"];
if (sessionFailureResponseData.jsonResponse != nil) {
[dictionary setObject:sessionFailureResponseData.jsonResponse forKey:@"jsonResponse"];
}
NSData *dataSessionFailure = [NSJSONSerialization dataWithJSONObject:dictionary options:0 error:nil];
NSString *stringSessionFailure = [[NSString alloc] initWithBytes:[dataSessionFailure bytes]
length:[dataSessionFailure length]
encoding:NSUTF8StringEncoding];
const char* charArraySessionFailure = [stringSessionFailure UTF8String];
UnitySendMessage([self.adjustUnitySceneName UTF8String], "GetNativeSessionFailure", charArraySessionFailure);
}
- (BOOL)adjustDeeplinkResponseWannabe:(NSURL *)deeplink {
NSString *stringDeeplink = [deeplink absoluteString];
const char* charDeeplink = [stringDeeplink UTF8String];
UnitySendMessage([self.adjustUnitySceneName UTF8String], "GetNativeDeferredDeeplink", charDeeplink);
return _shouldLaunchDeferredDeeplink;
}
- (void)adjustConversionValueUpdatedWannabe:(NSNumber *)conversionValue {
NSString *stringConversionValue = [conversionValue stringValue];
const char* charConversionValue = [stringConversionValue UTF8String];
UnitySendMessage([self.adjustUnitySceneName UTF8String], "GetNativeConversionValueUpdated", charConversionValue);
}
- (void)swizzleOriginalSelector:(SEL)originalSelector
withSelector:(SEL)swizzledSelector {
Class className = [self class];
Method originalMethod = class_getInstanceMethod(className, originalSelector);
Method swizzledMethod = class_getInstanceMethod(className, swizzledSelector);
BOOL didAddMethod = class_addMethod(className,
originalSelector,
method_getImplementation(swizzledMethod),
method_getTypeEncoding(swizzledMethod));
if (didAddMethod) {
class_replaceMethod(className,
swizzledSelector,
method_getImplementation(originalMethod),
method_getTypeEncoding(originalMethod));
} else {
method_exchangeImplementations(originalMethod, swizzledMethod);
}
}
- (void)addValueOrEmpty:(NSObject *)value
forKey:(NSString *)key
toDictionary:(NSMutableDictionary *)dictionary {
if (nil != value) {
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];
}
}
@end

View File

@@ -0,0 +1,133 @@
fileFormatVersion: 2
guid: 81438eed05b2e4b489f13efc94d5476a
timeCreated: 1489655217
licenseType: Pro
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 1
Exclude Linux: 1
Exclude Linux64: 1
Exclude LinuxUniversal: 1
Exclude OSXIntel: 1
Exclude OSXIntel64: 1
Exclude OSXUniversal: 1
Exclude WebGL: 1
Exclude Win: 1
Exclude Win64: 1
Exclude iOS: 0
Exclude tvOS: 1
data:
first:
'': Editor
second:
enabled: 0
settings:
CPU: AnyCPU
OS: AnyOS
data:
first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
data:
first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: Linux
second:
enabled: 0
settings:
CPU: x86
data:
first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: x86_64
data:
first:
Standalone: OSXIntel
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: OSXIntel64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: Win
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
iPhone: iOS
second:
enabled: 1
settings:
CompileFlags:
FrameworkDependencies:
data:
first:
tvOS: tvOS
second:
enabled: 0
settings:
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,564 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
namespace com.adjust.sdk
{
//
public class AdjustiOS
{
private const string sdkPrefix = "unity4.32.2";
[DllImport("__Internal")]
private static extern void _AdjustLaunchApp(
string appToken,
string environment,
string sdkPrefix,
string userAgent,
string defaultTracker,
string extenralDeviceId,
string urlStrategy,
string sceneName,
int allowSuppressLogLevel,
int logLevel,
int isDeviceKnown,
int eventBuffering,
int sendInBackground,
int allowiAdInfoReading,
int allowAdServicesInfoReading,
int allowIdfaReading,
int deactivateSkAdNetworkHandling,
int linkMeEnabled,
int needsCost,
int coppaCompliant,
long secretId,
long info1,
long info2,
long info3,
long info4,
double delayStart,
int launchDeferredDeeplink,
int isAttributionCallbackImplemented,
int isEventSuccessCallbackImplemented,
int isEventFailureCallbackImplemented,
int isSessionSuccessCallbackImplemented,
int isSessionFailureCallbackImplemented,
int isDeferredDeeplinkCallbackImplemented,
int isConversionValueUpdatedCallbackImplemented);
[DllImport("__Internal")]
private static extern void _AdjustTrackEvent(
string eventToken,
double revenue,
string currency,
string receipt,
string transactionId,
string callbackId,
int isReceiptSet,
string jsonCallbackParameters,
string jsonPartnerParameters);
[DllImport("__Internal")]
private static extern void _AdjustSetEnabled(int enabled);
[DllImport("__Internal")]
private static extern int _AdjustIsEnabled();
[DllImport("__Internal")]
private static extern void _AdjustSetOfflineMode(int enabled);
[DllImport("__Internal")]
private static extern void _AdjustSetDeviceToken(string deviceToken);
[DllImport("__Internal")]
private static extern void _AdjustAppWillOpenUrl(string url);
[DllImport("__Internal")]
private static extern string _AdjustGetIdfa();
[DllImport("__Internal")]
private static extern string _AdjustGetAdid();
[DllImport("__Internal")]
private static extern string _AdjustGetSdkVersion();
[DllImport("__Internal")]
private static extern void _AdjustGdprForgetMe();
[DllImport("__Internal")]
private static extern void _AdjustDisableThirdPartySharing();
[DllImport("__Internal")]
private static extern string _AdjustGetAttribution();
[DllImport("__Internal")]
private static extern void _AdjustSendFirstPackages();
[DllImport("__Internal")]
private static extern void _AdjustAddSessionPartnerParameter(string key, string value);
[DllImport("__Internal")]
private static extern void _AdjustAddSessionCallbackParameter(string key, string value);
[DllImport("__Internal")]
private static extern void _AdjustRemoveSessionPartnerParameter(string key);
[DllImport("__Internal")]
private static extern void _AdjustRemoveSessionCallbackParameter(string key);
[DllImport("__Internal")]
private static extern void _AdjustResetSessionPartnerParameters();
[DllImport("__Internal")]
private static extern void _AdjustResetSessionCallbackParameters();
[DllImport("__Internal")]
private static extern void _AdjustTrackAdRevenue(string source, string payload);
[DllImport("__Internal")]
private static extern void _AdjustTrackAdRevenueNew(
string source,
double revenue,
string currency,
int adImpressionsCount,
string adRevenueNetwork,
string adRevenueUnit,
string adRevenuePlacement,
string jsonCallbackParameters,
string jsonPartnerParameters);
[DllImport("__Internal")]
private static extern void _AdjustTrackAppStoreSubscription(
string price,
string currency,
string transactionId,
string receipt,
string billingStore,
string transactionDate,
string salesRegion,
string jsonCallbackParameters,
string jsonPartnerParameters);
[DllImport("__Internal")]
private static extern void _AdjustTrackThirdPartySharing(int enabled, string jsonGranularOptions, string jsonPartnerSharingSettings);
[DllImport("__Internal")]
private static extern void _AdjustTrackMeasurementConsent(int enabled);
[DllImport("__Internal")]
private static extern void _AdjustSetTestOptions(
string baseUrl,
string gdprUrl,
string subscriptionUrl,
string extraPath,
long timerIntervalInMilliseconds,
long timerStartInMilliseconds,
long sessionIntervalInMilliseconds,
long subsessionIntervalInMilliseconds,
int teardown,
int deleteState,
int noBackoffWait,
int iAdFrameworkEnabled,
int adServicesFrameworkEnabled);
[DllImport("__Internal")]
private static extern void _AdjustRequestTrackingAuthorizationWithCompletionHandler(string sceneName);
[DllImport("__Internal")]
private static extern void _AdjustUpdateConversionValue(int conversionValue);
[DllImport("__Internal")]
private static extern void _AdjustCheckForNewAttStatus();
[DllImport("__Internal")]
private static extern int _AdjustGetAppTrackingAuthorizationStatus();
[DllImport("__Internal")]
private static extern void _AdjustTrackSubsessionStart();
[DllImport("__Internal")]
private static extern void _AdjustTrackSubsessionEnd();
[DllImport("__Internal")]
private static extern string _AdjustGetLastDeeplink();
public AdjustiOS() {}
public static void Start(AdjustConfig adjustConfig)
{
string appToken = adjustConfig.appToken != null ? adjustConfig.appToken : "ADJ_INVALID";
string sceneName = adjustConfig.sceneName != null ? adjustConfig.sceneName : "ADJ_INVALID";
string userAgent = adjustConfig.userAgent != null ? adjustConfig.userAgent : "ADJ_INVALID";
string defaultTracker = adjustConfig.defaultTracker != null ? adjustConfig.defaultTracker : "ADJ_INVALID";
string externalDeviceId = adjustConfig.externalDeviceId != null ? adjustConfig.externalDeviceId : "ADJ_INVALID";
string urlStrategy = adjustConfig.urlStrategy != null ? adjustConfig.urlStrategy : "ADJ_INVALID";
string environment = adjustConfig.environment.ToLowercaseString();
long info1 = AdjustUtils.ConvertLong(adjustConfig.info1);
long info2 = AdjustUtils.ConvertLong(adjustConfig.info2);
long info3 = AdjustUtils.ConvertLong(adjustConfig.info3);
long info4 = AdjustUtils.ConvertLong(adjustConfig.info4);
long secretId = AdjustUtils.ConvertLong(adjustConfig.secretId);
double delayStart = AdjustUtils.ConvertDouble(adjustConfig.delayStart);
int logLevel = AdjustUtils.ConvertLogLevel(adjustConfig.logLevel);
int isDeviceKnown = AdjustUtils.ConvertBool(adjustConfig.isDeviceKnown);
int sendInBackground = AdjustUtils.ConvertBool(adjustConfig.sendInBackground);
int eventBufferingEnabled = AdjustUtils.ConvertBool(adjustConfig.eventBufferingEnabled);
int allowiAdInfoReading = AdjustUtils.ConvertBool(adjustConfig.allowiAdInfoReading);
int allowAdServicesInfoReading = AdjustUtils.ConvertBool(adjustConfig.allowAdServicesInfoReading);
int allowIdfaReading = AdjustUtils.ConvertBool(adjustConfig.allowIdfaReading);
int allowSuppressLogLevel = AdjustUtils.ConvertBool(adjustConfig.allowSuppressLogLevel);
int launchDeferredDeeplink = AdjustUtils.ConvertBool(adjustConfig.launchDeferredDeeplink);
int deactivateSkAdNetworkHandling = AdjustUtils.ConvertBool(adjustConfig.skAdNetworkHandling);
int linkMeEnabled = AdjustUtils.ConvertBool(adjustConfig.linkMeEnabled);
int needsCost = AdjustUtils.ConvertBool(adjustConfig.needsCost);
int coppaCompliant = AdjustUtils.ConvertBool(adjustConfig.coppaCompliantEnabled);
int isAttributionCallbackImplemented = AdjustUtils.ConvertBool(adjustConfig.getAttributionChangedDelegate() != null);
int isEventSuccessCallbackImplemented = AdjustUtils.ConvertBool(adjustConfig.getEventSuccessDelegate() != null);
int isEventFailureCallbackImplemented = AdjustUtils.ConvertBool(adjustConfig.getEventFailureDelegate() != null);
int isSessionSuccessCallbackImplemented = AdjustUtils.ConvertBool(adjustConfig.getSessionSuccessDelegate() != null);
int isSessionFailureCallbackImplemented = AdjustUtils.ConvertBool(adjustConfig.getSessionFailureDelegate() != null);
int isDeferredDeeplinkCallbackImplemented = AdjustUtils.ConvertBool(adjustConfig.getDeferredDeeplinkDelegate() != null);
int isConversionValueUpdatedCallbackImplemented = AdjustUtils.ConvertBool(adjustConfig.getConversionValueUpdatedDelegate() != null);
_AdjustLaunchApp(
appToken,
environment,
sdkPrefix,
userAgent,
defaultTracker,
externalDeviceId,
urlStrategy,
sceneName,
allowSuppressLogLevel,
logLevel,
isDeviceKnown,
eventBufferingEnabled,
sendInBackground,
allowiAdInfoReading,
allowAdServicesInfoReading,
allowIdfaReading,
deactivateSkAdNetworkHandling,
linkMeEnabled,
needsCost,
coppaCompliant,
secretId,
info1,
info2,
info3,
info4,
delayStart,
launchDeferredDeeplink,
isAttributionCallbackImplemented,
isEventSuccessCallbackImplemented,
isEventFailureCallbackImplemented,
isSessionSuccessCallbackImplemented,
isSessionFailureCallbackImplemented,
isDeferredDeeplinkCallbackImplemented,
isConversionValueUpdatedCallbackImplemented);
}
public static void TrackEvent(AdjustEvent adjustEvent)
{
int isReceiptSet = AdjustUtils.ConvertBool(adjustEvent.isReceiptSet);
double revenue = AdjustUtils.ConvertDouble(adjustEvent.revenue);
string eventToken = adjustEvent.eventToken;
string currency = adjustEvent.currency;
string receipt = adjustEvent.receipt;
string transactionId = adjustEvent.transactionId;
string callbackId = adjustEvent.callbackId;
string stringJsonCallbackParameters = AdjustUtils.ConvertListToJson(adjustEvent.callbackList);
string stringJsonPartnerParameters = AdjustUtils.ConvertListToJson(adjustEvent.partnerList);
_AdjustTrackEvent(eventToken, revenue, currency, receipt, transactionId, callbackId, isReceiptSet, stringJsonCallbackParameters, stringJsonPartnerParameters);
}
public static void SetEnabled(bool enabled)
{
_AdjustSetEnabled(AdjustUtils.ConvertBool(enabled));
}
public static bool IsEnabled()
{
var iIsEnabled = _AdjustIsEnabled();
return Convert.ToBoolean(iIsEnabled);
}
public static void SetOfflineMode(bool enabled)
{
_AdjustSetOfflineMode(AdjustUtils.ConvertBool(enabled));
}
public static void SendFirstPackages()
{
_AdjustSendFirstPackages();
}
public static void AppWillOpenUrl(string url)
{
_AdjustAppWillOpenUrl(url);
}
public static void AddSessionPartnerParameter(string key, string value)
{
_AdjustAddSessionPartnerParameter(key, value);
}
public static void AddSessionCallbackParameter(string key, string value)
{
_AdjustAddSessionCallbackParameter(key, value);
}
public static void RemoveSessionPartnerParameter(string key)
{
_AdjustRemoveSessionPartnerParameter(key);
}
public static void RemoveSessionCallbackParameter(string key)
{
_AdjustRemoveSessionCallbackParameter(key);
}
public static void ResetSessionPartnerParameters()
{
_AdjustResetSessionPartnerParameters();
}
public static void ResetSessionCallbackParameters()
{
_AdjustResetSessionCallbackParameters();
}
public static void TrackAdRevenue(string source, string payload)
{
_AdjustTrackAdRevenue(source, payload);
}
public static void TrackAdRevenue(AdjustAdRevenue adRevenue)
{
string source = adRevenue.source;
double revenue = AdjustUtils.ConvertDouble(adRevenue.revenue);
string currency = adRevenue.currency;
int adImpressionsCount = AdjustUtils.ConvertInt(adRevenue.adImpressionsCount);
string adRevenueNetwork = adRevenue.adRevenueNetwork;
string adRevenueUnit = adRevenue.adRevenueUnit;
string adRevenuePlacement = adRevenue.adRevenuePlacement;
string stringJsonCallbackParameters = AdjustUtils.ConvertListToJson(adRevenue.callbackList);
string stringJsonPartnerParameters = AdjustUtils.ConvertListToJson(adRevenue.partnerList);
_AdjustTrackAdRevenueNew(
source,
revenue,
currency,
adImpressionsCount,
adRevenueNetwork,
adRevenueUnit,
adRevenuePlacement,
stringJsonCallbackParameters,
stringJsonPartnerParameters);
}
public static void TrackAppStoreSubscription(AdjustAppStoreSubscription subscription)
{
string price = subscription.price;
string currency = subscription.currency;
string transactionId = subscription.transactionId;
string receipt = subscription.receipt;
string billingStore = subscription.billingStore;
string transactionDate = subscription.transactionDate;
string salesRegion = subscription.salesRegion;
string stringJsonCallbackParameters = AdjustUtils.ConvertListToJson(subscription.callbackList);
string stringJsonPartnerParameters = AdjustUtils.ConvertListToJson(subscription.partnerList);
_AdjustTrackAppStoreSubscription(
price,
currency,
transactionId,
receipt,
billingStore,
transactionDate,
salesRegion,
stringJsonCallbackParameters,
stringJsonPartnerParameters);
}
public static void TrackThirdPartySharing(AdjustThirdPartySharing thirdPartySharing)
{
int enabled = AdjustUtils.ConvertBool(thirdPartySharing.isEnabled);
List<string> jsonGranularOptions = new List<string>();
foreach (KeyValuePair<string, List<string>> entry in thirdPartySharing.granularOptions)
{
jsonGranularOptions.Add(entry.Key);
jsonGranularOptions.Add(AdjustUtils.ConvertListToJson(entry.Value));
}
List<string> jsonPartnerSharingSettings = new List<string>();
foreach (KeyValuePair<string, List<string>> entry in thirdPartySharing.partnerSharingSettings)
{
jsonPartnerSharingSettings.Add(entry.Key);
jsonPartnerSharingSettings.Add(AdjustUtils.ConvertListToJson(entry.Value));
}
_AdjustTrackThirdPartySharing(enabled, AdjustUtils.ConvertListToJson(jsonGranularOptions), AdjustUtils.ConvertListToJson(jsonPartnerSharingSettings));
}
public static void TrackMeasurementConsent(bool enabled)
{
_AdjustTrackMeasurementConsent(AdjustUtils.ConvertBool(enabled));
}
public static void RequestTrackingAuthorizationWithCompletionHandler(string sceneName)
{
string cSceneName = sceneName != null ? sceneName : "ADJ_INVALID";
_AdjustRequestTrackingAuthorizationWithCompletionHandler(cSceneName);
}
public static void UpdateConversionValue(int conversionValue)
{
_AdjustUpdateConversionValue(conversionValue);
}
public static void CheckForNewAttStatus()
{
_AdjustCheckForNewAttStatus();
}
public static int GetAppTrackingAuthorizationStatus()
{
return _AdjustGetAppTrackingAuthorizationStatus();
}
public static void SetDeviceToken(string deviceToken)
{
_AdjustSetDeviceToken(deviceToken);
}
public static string GetIdfa()
{
return _AdjustGetIdfa();
}
public static string GetAdid()
{
return _AdjustGetAdid();
}
public static string GetSdkVersion()
{
return sdkPrefix + "@" + _AdjustGetSdkVersion();
}
public static void GdprForgetMe()
{
_AdjustGdprForgetMe();
}
public static void DisableThirdPartySharing()
{
_AdjustDisableThirdPartySharing();
}
public static AdjustAttribution GetAttribution()
{
string attributionString = _AdjustGetAttribution();
if (null == attributionString)
{
return null;
}
var attribution = new AdjustAttribution(attributionString);
return attribution;
}
public static string GetLastDeeplink()
{
return _AdjustGetLastDeeplink();
}
// Used for testing only.
public static void SetTestOptions(Dictionary<string, string> testOptions)
{
string baseUrl = testOptions[AdjustUtils.KeyTestOptionsBaseUrl];
string gdprUrl = testOptions[AdjustUtils.KeyTestOptionsGdprUrl];
string subscriptionUrl = testOptions[AdjustUtils.KeyTestOptionsSubscriptionUrl];
string extraPath = testOptions.ContainsKey(AdjustUtils.KeyTestOptionsExtraPath) ? testOptions[AdjustUtils.KeyTestOptionsExtraPath] : null;
long timerIntervalMilis = -1;
long timerStartMilis = -1;
long sessionIntMilis = -1;
long subsessionIntMilis = -1;
bool teardown = false;
bool deleteState = false;
bool noBackoffWait = false;
bool iAdFrameworkEnabled = false;
bool adServicesFrameworkEnabled = false;
if (testOptions.ContainsKey(AdjustUtils.KeyTestOptionsTimerIntervalInMilliseconds))
{
timerIntervalMilis = long.Parse(testOptions[AdjustUtils.KeyTestOptionsTimerIntervalInMilliseconds]);
}
if (testOptions.ContainsKey(AdjustUtils.KeyTestOptionsTimerStartInMilliseconds))
{
timerStartMilis = long.Parse(testOptions[AdjustUtils.KeyTestOptionsTimerStartInMilliseconds]);
}
if (testOptions.ContainsKey(AdjustUtils.KeyTestOptionsSessionIntervalInMilliseconds))
{
sessionIntMilis = long.Parse(testOptions[AdjustUtils.KeyTestOptionsSessionIntervalInMilliseconds]);
}
if (testOptions.ContainsKey(AdjustUtils.KeyTestOptionsSubsessionIntervalInMilliseconds))
{
subsessionIntMilis = long.Parse(testOptions[AdjustUtils.KeyTestOptionsSubsessionIntervalInMilliseconds]);
}
if (testOptions.ContainsKey(AdjustUtils.KeyTestOptionsTeardown))
{
teardown = testOptions[AdjustUtils.KeyTestOptionsTeardown].ToLower() == "true";
}
if (testOptions.ContainsKey(AdjustUtils.KeyTestOptionsDeleteState))
{
deleteState = testOptions[AdjustUtils.KeyTestOptionsDeleteState].ToLower() == "true";
}
if (testOptions.ContainsKey(AdjustUtils.KeyTestOptionsNoBackoffWait))
{
noBackoffWait = testOptions[AdjustUtils.KeyTestOptionsNoBackoffWait].ToLower() == "true";
}
if (testOptions.ContainsKey(AdjustUtils.KeyTestOptionsiAdFrameworkEnabled))
{
iAdFrameworkEnabled = testOptions[AdjustUtils.KeyTestOptionsiAdFrameworkEnabled].ToLower() == "true";
}
if (testOptions.ContainsKey(AdjustUtils.KeyTestOptionsAdServicesFrameworkEnabled))
{
adServicesFrameworkEnabled = testOptions[AdjustUtils.KeyTestOptionsAdServicesFrameworkEnabled].ToLower() == "true";
}
_AdjustSetTestOptions(
baseUrl,
gdprUrl,
subscriptionUrl,
extraPath,
timerIntervalMilis,
timerStartMilis,
sessionIntMilis,
subsessionIntMilis,
AdjustUtils.ConvertBool(teardown),
AdjustUtils.ConvertBool(deleteState),
AdjustUtils.ConvertBool(noBackoffWait),
AdjustUtils.ConvertBool(iAdFrameworkEnabled),
AdjustUtils.ConvertBool(adServicesFrameworkEnabled));
}
public static void TrackSubsessionStart(string testingArgument = null)
{
if (testingArgument == "test")
{
_AdjustTrackSubsessionStart();
}
}
public static void TrackSubsessionEnd(string testingArgument = null)
{
if (testingArgument == "test")
{
_AdjustTrackSubsessionEnd();
}
}
}
//#endif
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e0210f5940cff42e699945b0c5aa4c9b
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData: