Skip to content

Commit

Permalink
refac: clean up public api a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
uerceg committed Aug 2, 2024
1 parent 30188d6 commit e1a57b9
Show file tree
Hide file tree
Showing 25 changed files with 326 additions and 344 deletions.
6 changes: 3 additions & 3 deletions Adjust.xcodeproj/xcshareddata/xcschemes/AdjustSdkIm.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9DE354D12100726300D211C9"
BuildableName = "AdjustSdkIm.framework"
BuildableName = "AdjustSdk.framework"
BlueprintName = "AdjustSdkIm"
ReferencedContainer = "container:Adjust.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -44,7 +44,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9DE354D12100726300D211C9"
BuildableName = "AdjustSdkIm.framework"
BuildableName = "AdjustSdk.framework"
BlueprintName = "AdjustSdkIm"
ReferencedContainer = "container:Adjust.xcodeproj">
</BuildableReference>
Expand All @@ -60,7 +60,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9DE354D12100726300D211C9"
BuildableName = "AdjustSdkIm.framework"
BuildableName = "AdjustSdk.framework"
BlueprintName = "AdjustSdkIm"
ReferencedContainer = "container:Adjust.xcodeproj">
</BuildableReference>
Expand Down
6 changes: 3 additions & 3 deletions Adjust.xcodeproj/xcshareddata/xcschemes/AdjustSdkTv.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9DFB060F1D747070006D48FC"
BuildableName = "AdjustSdkTv.framework"
BuildableName = "AdjustSdk.framework"
BlueprintName = "AdjustSdkTv"
ReferencedContainer = "container:Adjust.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -44,7 +44,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9DFB060F1D747070006D48FC"
BuildableName = "AdjustSdkTv.framework"
BuildableName = "AdjustSdk.framework"
BlueprintName = "AdjustSdkTv"
ReferencedContainer = "container:Adjust.xcodeproj">
</BuildableReference>
Expand All @@ -60,7 +60,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9DFB060F1D747070006D48FC"
BuildableName = "AdjustSdkTv.framework"
BuildableName = "AdjustSdk.framework"
BlueprintName = "AdjustSdkTv"
ReferencedContainer = "container:Adjust.xcodeproj">
</BuildableReference>
Expand Down
222 changes: 146 additions & 76 deletions Adjust/ADJConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#import "ADJSessionSuccess.h"
#import "ADJSessionFailure.h"

#pragma mark - AdjustDelegate methods

/**
* @brief Optional delegate that will get informed about tracking results.
*/
Expand All @@ -34,90 +36,154 @@
/**
* @brief Optional delegate method that gets called when an event is tracked with success.
*
* @param eventSuccessResponseData The response information from tracking with success
* @param eventSuccessResponse The response information from tracking with success
*
* @note See ADJEventSuccess for details.
*/
- (void)adjustEventTrackingSucceeded:(nullable ADJEventSuccess *)eventSuccessResponseData;
- (void)adjustEventTrackingSucceeded:(nullable ADJEventSuccess *)eventSuccessResponse;

/**
* @brief Optional delegate method that gets called when an event is tracked with failure.
*
* @param eventFailureResponseData The response information from tracking with failure
* @param eventFailureResponse The response information from tracking with failure
*
* @note See ADJEventFailure for details.
*/
- (void)adjustEventTrackingFailed:(nullable ADJEventFailure *)eventFailureResponseData;
- (void)adjustEventTrackingFailed:(nullable ADJEventFailure *)eventFailureResponse;

/**
* @brief Optional delegate method that gets called when a session is tracked with success.
*
* @param sessionSuccessResponseData The response information from tracking with success
* @param sessionSuccessResponse The response information from tracking with success
*
* @note See ADJSessionSuccess for details.
*/
- (void)adjustSessionTrackingSucceeded:(nullable ADJSessionSuccess *)sessionSuccessResponseData;
- (void)adjustSessionTrackingSucceeded:(nullable ADJSessionSuccess *)sessionSuccessResponse;

/**
* @brief Optional delegate method that gets called when a session is tracked with failure.
*
* @param sessionFailureResponseData The response information from tracking with failure
* @param sessionFailureResponse The response information from tracking with failure
*
* @note See ADJSessionFailure for details.
*/
- (void)adjustSessionTrackingFailed:(nullable ADJSessionFailure *)sessionFailureResponseData;
- (void)adjustSessionTrackingFailed:(nullable ADJSessionFailure *)sessionFailureResponse;

/**
* @brief Optional delegate method that gets called when a deferred deep link is about to be opened by the adjust SDK.
* @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.
* @param deeplink The deferred 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.
* @return Boolean that indicates whether the deep link should be opened by the Adjust SDK or not.
*/
- (BOOL)adjustDeeplinkResponse:(nullable NSURL *)deeplink;
- (BOOL)adjustDeferredDeeplinkReceived:(nullable NSURL *)deeplink;

/**
* @brief Optional SKAdNetwork delegate method that gets called when Adjust SDK updates conversion value for the user.
* The conversionData dictionary will contain string representation for the values set by Adjust SDK and
* possible API invocation error.
* @brief Optional SKAdNetwork delegate method that gets called when Adjust SDK updates conversion
* value for the user.
* The conversionData dictionary will contain string representation for the values set by
* Adjust SDK and possible API invocation error.
* Avalable keys are "conversion_value", "coarse_value", "lock_window" and "error".
* Example: {"conversion_value":"1", "coarse_value":"low", "lock_window":"false"}
* Example: {"conversion_value":"1", "coarse_value":"low", "lock_window":"false"}
* You can use this callback even while using pre 4.0 SKAdNetwork.
* In that case the dictionary will contain only "conversion_value" key.
*
* @param data Conversion parameters set by Adjust SDK
* @param data Conversion parameters set by Adjust SDK.
*/
- (void)adjustSkanUpdatedWithConversionData:(nonnull NSDictionary<NSString *, NSString *> *)data;

@end

/**
* @brief Adjust configuration object class.
*/
@interface ADJConfig : NSObject<NSCopying>

#pragma mark - ADJConfig readonly properties

/**
* @brief SDK prefix.
* @brief Adjust app token.
*/
@property (nonatomic, copy, readonly, nonnull) NSString *appToken;

/**
* @brief Adjust environment variable.
*/
@property (nonatomic, copy, readonly, nonnull) NSString *environment;

/**
* @brief Indicator of whether sending in the background is enabled or not.
*
* @note Not to be used by users, intended for non-native adjust SDKs only.
* @note It is disabled by default.
*/
@property (nonatomic, copy, nullable) NSString *sdkPrefix;
@property (nonatomic, readonly) BOOL isSendingInBackgroundEnabled;

/**
* @brief Default tracker to attribute organic installs to (optional).
* @brief Indicator of whether reading of AdServices.framework data is enabled or not.
*
* @note It is enabled by default.
*/
@property (nonatomic, copy, nullable) NSString *defaultTracker;
@property (nonatomic, readonly) BOOL isAdServiesEnabled;

@property (nonatomic, copy, nullable) NSString *externalDeviceId;
/**
* @brief Indicator of whether reading of IDFA is enabled or not.
*
* @note It is enabled by default.
*/
@property (nonatomic, readonly) BOOL isIdfaReadingEnabled;

/**
* @brief Adjust app token.
* @brief Indicator of whether SKAdNetwork (SKAN) attribution is enabled or not.
*
* @note It is enabled by default.
*/
@property (nonatomic, copy, readonly, nonnull) NSString *appToken;
@property (nonatomic, readonly) BOOL isSkanAttributionEnabled;

/**
* @brief Adjust environment variable.
* @brief Indicator of whether LinkMe feature is enabled or not.
*
* @note It is disabled by defailt.
*/
@property (nonatomic, copy, readonly, nonnull) NSString *environment;
@property (nonatomic, readonly) BOOL isLinkMeEnabled;

/**
* @brief Enables caching of device IDs to read it only once.
*
* @note It is disabled by default.
*/
@property (nonatomic, readonly) BOOL isDeviceIdsReadingOnceEnabled;

/**
* @brief Array of domains to be used as part of the URL strategy.
*/
@property (nonatomic, copy, readonly, nullable) NSArray *urlStrategyDomains;

/**
* @brief Indicator of whether Adjust-like subdomains should be made out of custom set domains.
*/
@property (nonatomic, readonly) BOOL useSubdomains;

/**
* @brief Indicator of whether URL strategy is a data residency one or not.
*/
@property (nonatomic, readonly) BOOL isDataResidency;

#pragma mark - AdjustConfig assignable properties

/**
* @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 SDK prefix.
*
* @note Not to be used by users, intended for non-native adjust SDKs only.
*/
@property (nonatomic, copy, nullable) NSString *sdkPrefix;

/**
* @brief Change the verbosity of Adjust's logs.
Expand All @@ -137,29 +203,16 @@
@property (nonatomic, assign) ADJLogLevel logLevel;

/**
* @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 AdServices framework data needed for attribution.
* @brief Default tracker to attribute organic installs to (optional).
*/
@property (nonatomic, assign) BOOL allowAdServicesInfoReading;

@property (nonatomic, assign, readonly) BOOL isIdfaReadingAllowed;
@property (nonatomic, copy, nullable) NSString *defaultTracker;

/**
* @brief Disables reading of IDFA parameter.
* @brief Custom defined unique device ID (optional).
*
* @note Make sure to have a UNIQUE external ID for each user / device.
*/

- (void)disableIdfaReading;
@property (nonatomic, copy, nullable) NSString *externalDeviceId;

/**
* @brief Define how many seconds to wait for ATT status before sending the first data.
Expand All @@ -171,19 +224,14 @@
*/
@property (nonatomic, assign) BOOL needsCost;

@property (nonatomic, assign, readonly) BOOL isSkanAttributionHandlingEnabled;

/**
* @brief Disables SKAdNetwork attribution handling
* @brief Maximum number of deduplication IDs to be stored by the SDK.
*
* @note If not set, maximum is 10.
*/
- (void)disableSkanAttributionHandling;
@property (nonatomic, assign) NSInteger eventDeduplicationIdsMaxSize;

@property (nonatomic, assign, readonly) BOOL isLinkMeEnabled;

/**
* @brief Enables linkMe
*/
- (void)enableLinkMe;
# pragma mark - AdjustConfig construtors

/**
* @brief Get configuration object for the initialization of the Adjust SDK.
Expand All @@ -198,11 +246,9 @@
*
* @returns Adjust configuration object.
*/
+ (nullable ADJConfig *)configWithAppToken:(nonnull NSString *)appToken
environment:(nonnull NSString *)environment;

- (nullable id)initWithAppToken:(nonnull NSString *)appToken
environment:(nonnull NSString *)environment;
- (nullable ADJConfig *)initWithAppToken:(nonnull NSString *)appToken
andEnvironment:(nonnull NSString *)environment;

/**
* @brief Configuration object for the initialization of the Adjust SDK.
Expand All @@ -219,36 +265,60 @@
*
* @returns Adjust configuration object.
*/
+ (nullable ADJConfig *)configWithAppToken:(nonnull NSString *)appToken
environment:(nonnull NSString *)environment
allowSuppressLogLevel:(BOOL)allowSuppressLogLevel;
- (nullable ADJConfig *)initWithAppToken:(nonnull NSString *)appToken
environment:(nonnull NSString *)environment
andSuppressLogLevel:(BOOL)allowSuppressLogLevel;

- (nullable id)initWithAppToken:(nonnull NSString *)appToken
environment:(nonnull NSString *)environment
allowSuppressLogLevel:(BOOL)allowSuppressLogLevel;
#pragma mark - AdjustConfig instance methods

/**
* @brief Check if adjust configuration object is valid.
* @brief Check if Adjust configuration object is valid.
*
* @return Boolean indicating whether adjust config object is valid or not.
* @return Boolean indicating whether Adjust config object is valid or not.
*/
- (BOOL)isValid;

/**
* @brief Enables caching of device ids to read it only once
* @brief A method for disabling SDK's handling of AdServies.framework.
*/
@property (nonatomic, readonly) BOOL shouldReadDeviceInfoOnce;
- (void)disableAdServies;

- (void)readDeviceIdsOnce;
/**
* @brief A method for disabling the reading of IDFA parameter.
*/
- (void)disableIdfaReading;

@property (nonatomic, assign) NSInteger eventDeduplicationIdsMaxSize;
/**
* @brief A method for disabling SKAdNetwork (SKAN) attribution.
*/
- (void)disableSkanAttribution;

@property (nonatomic, copy, readonly, nullable) NSArray *urlStrategyDomains;
/**
* @brief A method for enabling of sending in the background.
*/
- (void)enableSendingInBackground;

@property (nonatomic, readonly) BOOL useSubdomains;
/**
* @brief A method to enable LinkMe feature.
*/
- (void)enableLinkMe;

@property (nonatomic, readonly) BOOL isDataResidency;
/**
* @brief A method to enable reading of the device IDs just once.
*/
- (void)enableDeviceIdsReadingOnce;

/**
* @brief A method to set custom URL strategy.
*
* @param urlStrategyDomains Array of domains to be used as part of the URL strategy.
* @param useSubdomains Array of domains to be used as part of the URL strategy.
* @param isDataResidency Indicator of whether URL strategy is a data residency one or not.
*
* @note If not set, by default SDK will attempt to send traffic to:
* - {analytics,consent}.adjust.com
* - {analytics,consent}.adjust.world
*/
- (void)setUrlStrategy:(NSArray * _Nullable)urlStrategyDomains
withSubdomains:(BOOL)useSubdomains
andDataResidency:(BOOL)isDataResidency;
Expand Down
Loading

0 comments on commit e1a57b9

Please sign in to comment.