Skip to content

Commit

Permalink
Merge pull request #653 from adjust/v4334
Browse files Browse the repository at this point in the history
Version 4.33.4
  • Loading branch information
uerceg authored Feb 9, 2023
2 parents 85f1ac8 + 7adafae commit 6ae0388
Show file tree
Hide file tree
Showing 96 changed files with 99 additions and 8,300 deletions.
8 changes: 4 additions & 4 deletions Adjust.podspec
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Pod::Spec.new do |s|
s.name = "Adjust"
s.version = "4.33.3"
s.version = "4.33.4"
s.summary = "This is the iOS SDK of adjust. You can read more about it at http://adjust.com."
s.homepage = "https://github.com/adjust/ios_sdk"
s.license = { :type => 'MIT', :file => 'MIT-LICENSE' }
s.author = { "Adjust GmbH" => "[email protected]" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.33.3" }
s.author = { "Adjust" => "[email protected]" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.33.4" }
s.ios.deployment_target = '9.0'
s.tvos.deployment_target = '9.0'
s.framework = 'SystemConfiguration'
s.ios.weak_framework = 'AdSupport', 'iAd'
s.ios.weak_framework = 'AdSupport'
s.tvos.weak_framework = 'AdSupport'
s.requires_arc = true
s.default_subspec = 'Core'
Expand Down
223 changes: 1 addition & 222 deletions Adjust.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Adjust.xcodeproj/xcshareddata/xcschemes/AdjustSdk.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1250"
LastUpgradeVersion = "1420"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1250"
LastUpgradeVersion = "1420"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1250"
LastUpgradeVersion = "1420"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1250"
LastUpgradeVersion = "1420"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
3 changes: 0 additions & 3 deletions Adjust/ADJActivityHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@

- (BOOL)updateAttributionI:(id<ADJActivityHandler> _Nullable)selfI
attribution:(ADJAttribution * _Nullable)attribution;
- (void)setAttributionDetails:(NSDictionary * _Nullable)attributionDetails
error:(NSError * _Nullable)error;
- (void)setAdServicesAttributionToken:(NSString * _Nullable)token
error:(NSError * _Nullable)error;

Expand Down Expand Up @@ -157,5 +155,4 @@

@end

extern NSString * _Nullable const ADJiAdPackageKey;
extern NSString * _Nullable const ADJAdServicesPackageKey;
189 changes: 0 additions & 189 deletions Adjust/ADJActivityHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#import "ADJUrlStrategy.h"
#import "ADJSKAdNetwork.h"

NSString * const ADJiAdPackageKey = @"iad3";
NSString * const ADJAdServicesPackageKey = @"apple_ads";

typedef void (^activityHandlerBlockI)(ADJActivityHandler * activityHandler);
Expand All @@ -44,7 +43,6 @@
static NSTimeInterval kBackgroundTimerInterval;
static double kSessionInterval;
static double kSubSessionInterval;
static const int kiAdRetriesCount = 3;
static const int kAdServicesdRetriesCount = 1;

@implementation ADJInternalState
Expand Down Expand Up @@ -86,7 +84,6 @@ @interface ADJActivityHandler()
@property (nonatomic, strong) ADJActivityState *activityState;
@property (nonatomic, strong) ADJTimerCycle *foregroundTimer;
@property (nonatomic, strong) ADJTimerOnce *backgroundTimer;
@property (nonatomic, assign) NSInteger iAdRetriesLeft;
@property (nonatomic, assign) NSInteger adServicesRetriesLeft;
@property (nonatomic, strong) ADJInternalState *internalState;
@property (nonatomic, strong) ADJPackageParams *packageParams;
Expand All @@ -108,19 +105,6 @@ - (void)prepareDeeplinkI:(ADJActivityHandler *_Nullable)selfI

@end

// copy from ADClientError
typedef NS_ENUM(NSInteger, AdjADClientError) {
AdjADClientErrorUnknown = 0,
AdjADClientErrorTrackingRestrictedOrDenied = 1,
AdjADClientErrorMissingData = 2,
AdjADClientErrorCorruptResponse = 3,
AdjADClientErrorRequestClientError = 4,
AdjADClientErrorRequestServerError = 5,
AdjADClientErrorRequestNetworkError = 6,
AdjADClientErrorUnsupportedPlatform = 7,
AdjCustomErrorTimeout = 100,
};

#pragma mark -
@implementation ADJActivityHandler

Expand All @@ -147,9 +131,6 @@ - (id)initWithConfig:(ADJConfig *)adjustConfig
if (adjustConfig.allowIdfaReading == NO) {
[ADJAdjustFactory.logger warn:@"IDFA reading has been switched off"];
}
if (adjustConfig.allowiAdInfoReading == NO) {
[ADJAdjustFactory.logger warn:@"iAd info reading has been switched off"];
}
if (adjustConfig.allowAdServicesInfoReading == NO) {
[ADJAdjustFactory.logger warn:@"AdServices info reading has been switched off"];
}
Expand Down Expand Up @@ -217,7 +198,6 @@ - (id)initWithConfig:(ADJConfig *)adjustConfig
// does not have the session response by default
self.internalState.sessionResponseProcessed = NO;

self.iAdRetriesLeft = kiAdRetriesCount;
self.adServicesRetriesLeft = kAdServicesdRetriesCount;

self.trackingStatusManager = [[ADJTrackingStatusManager alloc] initWithActivityHandler:self];
Expand Down Expand Up @@ -438,154 +418,6 @@ - (void)setAdServicesAttributionToken:(NSString *)token
}
}

- (void)setAttributionDetails:(NSDictionary *)attributionDetails
error:(NSError *)error
{
if (![ADJUtil isNull:error]) {
[self.logger warn:@"Unable to read iAd details"];

if (self.iAdRetriesLeft < 0) {
[self.logger warn:@"Number of retries to get iAd information surpassed"];
return;
}

switch (error.code) {
// if first request was unsuccessful and ended up with one of the following error codes:
// apply following retry logic:
// - 1st retry after 5 seconds
// - 2nd retry after 2 seconds
// - 3rd retry after 2 seconds
case AdjADClientErrorUnknown:
case AdjADClientErrorMissingData:
case AdjADClientErrorCorruptResponse:
case AdjADClientErrorRequestClientError:
case AdjADClientErrorRequestServerError:
case AdjADClientErrorRequestNetworkError:
case AdjCustomErrorTimeout: {

[self saveiAdErrorCode:error.code];

int64_t iAdRetryDelay = 0;
switch (self.iAdRetriesLeft) {
case 2:
iAdRetryDelay = 5 * NSEC_PER_SEC;
break;
default:
iAdRetryDelay = 2 * NSEC_PER_SEC;
break;
}
self.iAdRetriesLeft = self.iAdRetriesLeft - 1;
dispatch_time_t retryTime = dispatch_time(DISPATCH_TIME_NOW, iAdRetryDelay);
dispatch_after(retryTime, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[self checkForiAdI:self];
});
return;
}
case AdjADClientErrorTrackingRestrictedOrDenied:
case AdjADClientErrorUnsupportedPlatform:
return;
default:
return;
}
}

// check if it's a valid attribution details
if (![ADJUtil checkAttributionDetails:attributionDetails]) {
return;
}

// send immediately if there is no previous attribution details
if (self.activityState == nil ||
self.activityState.attributionDetails == nil)
{
// send immediately
[self sendIad3ClickPackage:self attributionDetails:attributionDetails];
// save in the background queue
[ADJUtil launchInQueue:self.internalQueue
selfInject:self
block:^(ADJActivityHandler * selfI) {
[selfI saveAttributionDetailsI:selfI
attributionDetails:attributionDetails];

}];
return;
}

// check if new updates previous written one
[ADJUtil launchInQueue:self.internalQueue
selfInject:self
block:^(ADJActivityHandler * selfI) {
if ([attributionDetails isEqualToDictionary:selfI.activityState.attributionDetails]) {
return;
}

[selfI sendIad3ClickPackage:selfI attributionDetails:attributionDetails];

// save new iAd details
[selfI saveAttributionDetailsI:selfI
attributionDetails:attributionDetails];
}];
}

- (void)saveiAdErrorCode:(NSInteger)code {
NSString *codeKey;
switch (code) {
case AdjADClientErrorUnknown:
codeKey = @"AdjADClientErrorUnknown";
break;
case AdjADClientErrorMissingData:
codeKey = @"AdjADClientErrorMissingData";
break;
case AdjADClientErrorCorruptResponse:
codeKey = @"AdjADClientErrorCorruptResponse";
break;
case AdjCustomErrorTimeout:
codeKey = @"AdjCustomErrorTimeout";
break;
default:
codeKey = @"";
break;
}

if (![codeKey isEqualToString:@""]) {
[ADJUserDefaults saveiAdErrorKey:codeKey];
}
}

- (void)sendIad3ClickPackage:(ADJActivityHandler *)selfI
attributionDetails:(NSDictionary *)attributionDetails
{
if (![selfI isEnabledI:selfI]) {
return;
}

if (ADJAdjustFactory.iAdFrameworkEnabled == NO) {
[self.logger verbose:@"Sending iAd details to server suppressed."];
return;
}

double now = [NSDate.date timeIntervalSince1970];
if (selfI.activityState != nil) {
[ADJUtil launchSynchronisedWithObject:[ADJActivityState class]
block:^{
double lastInterval = now - selfI.activityState.lastActivity;
selfI.activityState.lastInterval = lastInterval;
}];
}
ADJPackageBuilder *clickBuilder = [[ADJPackageBuilder alloc]
initWithPackageParams:selfI.packageParams
activityState:selfI.activityState
config:selfI.adjustConfig
sessionParameters:self.sessionParameters
trackingStatusManager:self.trackingStatusManager
createdAt:now];

clickBuilder.attributionDetails = attributionDetails;

ADJActivityPackage *clickPackage = [clickBuilder buildClickPackage:ADJiAdPackageKey];
[selfI.sdkClickHandler sendSdkClick:clickPackage];
}

- (void)sendAdServicesClickPackage:(ADJActivityHandler *)selfI
token:(NSString *)token
errorCodeNumber:(NSNumber *)errorCodeNumber
Expand Down Expand Up @@ -622,17 +454,6 @@ - (void)sendAdServicesClickPackage:(ADJActivityHandler *)selfI
[selfI.sdkClickHandler sendSdkClick:clickPackage];
}

- (void)saveAttributionDetailsI:(ADJActivityHandler *)selfI
attributionDetails:(NSDictionary *)attributionDetails
{
// save new iAd details
[ADJUtil launchSynchronisedWithObject:[ADJActivityState class]
block:^{
selfI.activityState.attributionDetails = attributionDetails;
}];
[selfI writeAttributionI:selfI];
}

- (void)setAskingAttribution:(BOOL)askingAttribution {
[ADJUtil launchInQueue:self.internalQueue
selfInject:self
Expand Down Expand Up @@ -1117,9 +938,6 @@ - (void)processSessionI:(ADJActivityHandler *)selfI {
selfI.activityState.updatePackages = [selfI.internalState itHasToUpdatePackages];
}];

if (selfI.adjustConfig.allowiAdInfoReading == YES) {
[selfI checkForiAdI:selfI];
}
if (selfI.adjustConfig.allowAdServicesInfoReading == YES) {
[selfI checkForAdServicesAttributionI:selfI];
}
Expand Down Expand Up @@ -1789,9 +1607,6 @@ - (void)setEnabledI:(ADJActivityHandler *)selfI enabled:(BOOL)enabled {
if (pushToken != nil && ![selfI.activityState.deviceToken isEqualToString:pushToken]) {
[self setPushToken:pushToken];
}
if (selfI.adjustConfig.allowiAdInfoReading == YES) {
[selfI checkForiAdI:selfI];
}
if (selfI.adjustConfig.allowAdServicesInfoReading == YES) {
[selfI checkForAdServicesAttributionI:selfI];
}
Expand All @@ -1804,10 +1619,6 @@ - (void)setEnabledI:(ADJActivityHandler *)selfI enabled:(BOOL)enabled {
unPausingMessage:@"Resuming handlers due to SDK being enabled"];
}

- (void)checkForiAdI:(ADJActivityHandler *)selfI {
[ADJUtil checkForiAd:selfI queue:selfI.internalQueue];
}

- (BOOL)shouldFetchAdServicesI:(ADJActivityHandler *)selfI {
if (selfI.adjustConfig.allowAdServicesInfoReading == NO) {
return NO;
Expand Down
2 changes: 0 additions & 2 deletions Adjust/ADJAdjustFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
+ (NSString *)baseUrl;
+ (NSString *)gdprUrl;
+ (NSString *)subscriptionUrl;
+ (BOOL)iAdFrameworkEnabled;
+ (BOOL)adServicesFrameworkEnabled;

+ (void)setLogger:(id<ADJLogger>)logger;
Expand All @@ -41,7 +40,6 @@
+ (void)setPackageHandlerBackoffStrategy:(ADJBackoffStrategy *)backoffStrategy;
+ (void)setSdkClickHandlerBackoffStrategy:(ADJBackoffStrategy *)backoffStrategy;
+ (void)setTesting:(BOOL)testing;
+ (void)setiAdFrameworkEnabled:(BOOL)iAdFrameworkEnabled;
+ (void)setAdServicesFrameworkEnabled:(BOOL)adServicesFrameworkEnabled;
+ (void)setMaxDelayStart:(NSTimeInterval)maxDelayStart;
+ (void)setBaseUrl:(NSString *)baseUrl;
Expand Down
10 changes: 0 additions & 10 deletions Adjust/ADJAdjustFactory.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
static ADJBackoffStrategy * installSessionBackoffStrategy = nil;
static BOOL internalTesting = NO;
static NSTimeInterval internalMaxDelayStart = -1;
static BOOL internaliAdFrameworkEnabled = YES;
static BOOL internalAdServicesFrameworkEnabled = YES;

static NSString * internalBaseUrl = nil;
Expand Down Expand Up @@ -99,10 +98,6 @@ + (BOOL)testing {
return internalTesting;
}

+ (BOOL)iAdFrameworkEnabled {
return internaliAdFrameworkEnabled;
}

+ (BOOL)adServicesFrameworkEnabled {
return internalAdServicesFrameworkEnabled;
}
Expand Down Expand Up @@ -162,10 +157,6 @@ + (void)setTesting:(BOOL)testing {
internalTesting = testing;
}

+ (void)setiAdFrameworkEnabled:(BOOL)iAdFrameworkEnabled {
internaliAdFrameworkEnabled = iAdFrameworkEnabled;
}

+ (void)setAdServicesFrameworkEnabled:(BOOL)adServicesFrameworkEnabled {
internalAdServicesFrameworkEnabled = adServicesFrameworkEnabled;
}
Expand Down Expand Up @@ -248,7 +239,6 @@ + (void)teardown:(BOOL)deleteState {
internalBaseUrl = nil;
internalGdprUrl = nil;
internalSubscriptionUrl = nil;
internaliAdFrameworkEnabled = YES;
internalAdServicesFrameworkEnabled = YES;
}
@end
2 changes: 1 addition & 1 deletion Adjust/ADJConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
/**
* @brief Enables/disables reading of iAd framework data needed for ASA tracking.
*/
@property (nonatomic, assign) BOOL allowiAdInfoReading;
@property (nonatomic, assign) BOOL allowiAdInfoReading DEPRECATED_MSG_ATTRIBUTE("Apple Search Ads attribution with usage of iAd.framework has been sunset by Apple as of February 7th 2023");

/**
* @brief Enables/disables reading of AdServices framework data needed for attribution.
Expand Down
Loading

0 comments on commit 6ae0388

Please sign in to comment.