Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
649cf7b
filePath nil check
uerceg Apr 1, 2020
46ab49a
refac style to avoid IDE unclosed parentisis
nonelse Apr 1, 2020
e9afd74
refac write object valid path
nonelse Apr 1, 2020
089f22b
Refac extract keys
nonelse Apr 1, 2020
ec6d048
Add native version of signature lib
nonelse Apr 1, 2020
575e7ca
@available replace proposal
uerceg Apr 1, 2020
2be163e
Xcode 11.4
uerceg Apr 1, 2020
f2515c7
Fix for different data types comparison warning
uerceg Apr 1, 2020
54b37ab
Xcode 11.4 support
rchatfield-atlassian Apr 2, 2020
8454d6d
Add Mac Catalyst support to ObjC example app
uerceg Apr 2, 2020
82a2602
Add missing TARGET_OS_MACCATALYST macros
uerceg Apr 2, 2020
3f83c1d
Adding source for the macro
uerceg Apr 2, 2020
5003a82
Sync object read/write
nonelse Apr 3, 2020
9b2a587
Replace retry count from package to handler
nonelse Apr 3, 2020
2bcf3e1
iAd information reading update
uerceg Apr 3, 2020
dae1213
iAd request timeout handling
uerceg Apr 6, 2020
436583e
Handling of native_version nil string
uerceg Apr 6, 2020
47865c8
Use updated FB API
uerceg Apr 6, 2020
69b3c1f
Minor logic refac
uerceg Apr 6, 2020
cb848ef
Read algorithm field from package payload
uerceg Apr 7, 2020
934894b
Refac iad timeout
nonelse Apr 8, 2020
9814186
Fix for iAd timeout timer initialisation
uerceg Apr 9, 2020
9721373
Minor iAd naming unification
uerceg Apr 9, 2020
509e3ec
Add missing stuff to web bridge
uerceg Apr 9, 2020
c943f8a
New version 4.21.1
uerceg Apr 9, 2020
075f2c7
Fix for web bridge command executor
uerceg Apr 9, 2020
36f8352
CHANGELOG.md update
uerceg Apr 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Adjust.podspec
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Pod::Spec.new do |s|
s.name = "Adjust"
s.version = "4.21.0"
s.version = "4.21.1"
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 = { "Christian Wellenbrock" => "welle@adjust.com" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.21.0" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.21.1" }
s.ios.deployment_target = '6.0'
s.tvos.deployment_target = '9.0'
s.framework = 'SystemConfiguration'
Expand Down
2 changes: 1 addition & 1 deletion Adjust.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2197,7 +2197,7 @@
9679920518BBAE2800394606 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1130;
LastUpgradeCheck = 1140;
ORGANIZATIONNAME = "adjust GmbH";
TargetAttributes = {
9615158E1CD2CB2C0022D336 = {
Expand Down
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 = "1130"
LastUpgradeVersion = "1140"
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 = "1130"
LastUpgradeVersion = "1140"
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 = "1130"
LastUpgradeVersion = "1140"
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 = "1130"
LastUpgradeVersion = "1140"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
3 changes: 1 addition & 2 deletions Adjust/ADJActivityHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@

- (BOOL)updateAttributionI:(id<ADJActivityHandler>)selfI attribution:(ADJAttribution *)attribution;
- (void)setAttributionDetails:(NSDictionary *)attributionDetails
error:(NSError *)error
retriesLeft:(int)retriesLeft;
error:(NSError *)error;

- (void)setOfflineMode:(BOOL)offline;
- (void)sendFirstPackages;
Expand Down
86 changes: 71 additions & 15 deletions Adjust/ADJActivityHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@
static NSTimeInterval kBackgroundTimerInterval;
static double kSessionInterval;
static double kSubSessionInterval;

// number of tries
static const int kTryIadV3 = 2;
static const uint64_t kDelayRetryIad = 2 * NSEC_PER_SEC; // 1 second
static const int kiAdRetriesCount = 3;

@implementation ADJInternalState

Expand Down Expand Up @@ -89,6 +86,8 @@ @interface ADJActivityHandler()
@property (nonatomic, strong) ADJActivityState *activityState;
@property (nonatomic, strong) ADJTimerCycle *foregroundTimer;
@property (nonatomic, strong) ADJTimerOnce *backgroundTimer;
@property (nonatomic, strong) ADJTimerOnce *iAdTimeoutTimer;
@property (nonatomic, assign) NSInteger iAdRetriesLeft;
@property (nonatomic, strong) ADJInternalState *internalState;
@property (nonatomic, strong) ADJDeviceInfo *deviceInfo;
@property (nonatomic, strong) ADJTimerOnce *delayStartTimer;
Expand All @@ -108,6 +107,9 @@ @interface ADJActivityHandler()
typedef NS_ENUM(NSInteger, AdjADClientError) {
AdjADClientErrorUnknown = 0,
AdjADClientErrorLimitAdTracking = 1,
AdjADClientErrorMissingData = 2,
AdjADClientErrorCorruptResponse = 3,
AdjCustomErrorTimeout = 100,
};

#pragma mark -
Expand Down Expand Up @@ -202,6 +204,8 @@ - (id)initWithConfig:(ADJConfig *)adjustConfig
self.gdprPath = savedPreLaunch.gdprPath;
}

self.iAdRetriesLeft = kiAdRetriesCount;

self.internalQueue = dispatch_queue_create(kInternalQueueName, DISPATCH_QUEUE_SERIAL);
[ADJUtil launchInQueue:self.internalQueue
selfInject:self
Expand Down Expand Up @@ -394,23 +398,52 @@ - (void)setTrackingStateOptedOut {

- (void)setAttributionDetails:(NSDictionary *)attributionDetails
error:(NSError *)error
retriesLeft:(int)retriesLeft
{
[self.iAdTimeoutTimer cancel];

if (![ADJUtil isNull:error]) {
[self.logger warn:@"Unable to read iAd details"];

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

if (error.code == AdjADClientErrorUnknown) {
dispatch_time_t retryTime = dispatch_time(DISPATCH_TIME_NOW, kDelayRetryIad);
dispatch_after(retryTime, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[[UIDevice currentDevice] adjSetIad:self triesV3Left:retriesLeft];
});
// if first request was unsuccessful and ended up with one of the following error codes:
// - AdjADClientErrorUnknown
// - AdjADClientErrorMissingData
// - AdjADClientErrorCorruptResponse
// - AdjCustomErrorTimeout
// apply following retry logic:
// - 1st retry after 5 seconds
// - 2nd retry after 2 seconds
// - 3rd retry after 2 seconds
switch (error.code) {
case AdjADClientErrorUnknown:
case AdjADClientErrorMissingData:
case AdjADClientErrorCorruptResponse:
case AdjCustomErrorTimeout: {
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 checkForIad];
});
return;
}
case AdjADClientErrorLimitAdTracking:
return;
default:
return;
}
return;
}

// check if it's a valid attribution details
Expand Down Expand Up @@ -603,6 +636,9 @@ - (void)teardown
if (self.backgroundTimer != nil) {
[self.backgroundTimer cancel];
}
if (self.iAdTimeoutTimer != nil) {
[self.iAdTimeoutTimer cancel];
}
if (self.foregroundTimer != nil) {
[self.foregroundTimer cancel];
}
Expand Down Expand Up @@ -630,6 +666,7 @@ - (void)teardown
self.sdkClickHandler = nil;
self.foregroundTimer = nil;
self.backgroundTimer = nil;
self.iAdTimeoutTimer = nil;
self.adjustDelegate = nil;
self.adjustConfig = nil;
self.internalState = nil;
Expand Down Expand Up @@ -757,7 +794,7 @@ - (void)initI:(ADJActivityHandler *)selfI
sdkClickHandlerOnly:YES]];

if (self.adjustConfig.allowiAdInfoReading == YES) {
[[UIDevice currentDevice] adjSetIad:selfI triesV3Left:kTryIadV3];
[self checkForIad];
}

[selfI preLaunchActionsI:selfI preLaunchActionsArray:preLaunchActionsArray];
Expand Down Expand Up @@ -1261,7 +1298,7 @@ - (void)setEnabledI:(ADJActivityHandler *)selfI enabled:(BOOL)enabled {
[selfI disableThirdPartySharing];
}
if (self.adjustConfig.allowiAdInfoReading == YES) {
[[UIDevice currentDevice] adjSetIad:selfI triesV3Left:kTryIadV3];
[self checkForIad];
}
}

Expand All @@ -1272,6 +1309,25 @@ - (void)setEnabledI:(ADJActivityHandler *)selfI enabled:(BOOL)enabled {
unPausingMessage:@"Resuming handlers due to SDK being enabled"];
}

- (void)checkForIad {
if (self.iAdTimeoutTimer == nil) {
self.iAdTimeoutTimer =
[ADJTimerOnce
timerWithBlock:^{
[self
setAttributionDetails:nil
error:[NSError errorWithDomain:@"com.adjust.sdk.iAd"
code:100
userInfo:@{@"Error reason": @"iAd request timed out"}]];

}
queue:self.internalQueue
name:@"iAdTimeoutTimer"];
}

[[UIDevice currentDevice] adjCheckForiAd:self iAdTimeoutTimer:self.iAdTimeoutTimer];
}

- (void)setOfflineModeI:(ADJActivityHandler *)selfI
offline:(BOOL)offline {
// compare with the internal state
Expand Down
6 changes: 0 additions & 6 deletions Adjust/ADJActivityPackage.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

@property (nonatomic, copy) NSString *clientSdk;

@property (nonatomic, assign) NSInteger retries;

@property (nonatomic, strong) NSMutableDictionary *parameters;

@property (nonatomic, strong) NSDictionary *partnerParameters;
Expand All @@ -36,8 +34,4 @@

- (NSString *)failureMessage;

- (NSInteger)getRetries;

- (NSInteger)increaseRetries;

@end
12 changes: 1 addition & 11 deletions Adjust/ADJActivityPackage.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ @implementation ADJActivityPackage

- (NSString *)extendedString {
NSMutableString *builder = [NSMutableString string];
NSArray *excludedKeys = @[@"secret_id", @"app_secret", @"event_callback_id"];
NSArray *excludedKeys = @[@"secret_id", @"app_secret", @"signature", @"headers_id", @"native_version", @"event_callback_id"];

[builder appendFormat:@"Path: %@\n", self.path];
[builder appendFormat:@"ClientSdk: %@\n", self.clientSdk];
Expand All @@ -42,16 +42,6 @@ - (NSString *)extendedString {
return builder;
}

- (NSInteger)getRetries {
return self.retries;
}

- (NSInteger)increaseRetries {
self.retries = self.retries + 1;

return self.retries;
}

- (NSString *)description {
return [NSString stringWithFormat:@"%@%@", [ADJActivityKindUtil activityKindToString:self.activityKind], self.suffix];
}
Expand Down
5 changes: 3 additions & 2 deletions Adjust/ADJAdditions/UIDevice+ADJAdditions.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "ADJActivityHandler.h"
#import "ADJTimerOnce.h"

@interface UIDevice(ADJAdditions)

Expand All @@ -19,6 +20,6 @@
- (NSString *)adjDeviceName;
- (NSString *)adjCreateUuid;
- (NSString *)adjVendorId;
- (void)adjSetIad:(ADJActivityHandler *)activityHandler
triesV3Left:(int)triesV3Left;
- (void)adjCheckForiAd:(ADJActivityHandler *)activityHandler
iAdTimeoutTimer:(ADJTimerOnce *)iAdTimeoutTimer;
@end
Loading