Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 4.21.2 #422

Merged
merged 6 commits into from
Apr 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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.1"
s.version = "4.21.2"
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.1" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.21.2" }
s.ios.deployment_target = '6.0'
s.tvos.deployment_target = '9.0'
s.framework = 'SystemConfiguration'
Expand Down
45 changes: 27 additions & 18 deletions Adjust/ADJActivityHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
static NSString * const kForegroundTimerName = @"Foreground timer";
static NSString * const kBackgroundTimerName = @"Background timer";
static NSString * const kDelayStartTimerName = @"Delay Start timer";
static NSString * const kiAdTimeoutTimerName = @"iAd Timeout timer";

static NSTimeInterval kForegroundTimerInterval;
static NSTimeInterval kForegroundTimerStart;
Expand Down Expand Up @@ -399,8 +400,9 @@ - (void)setTrackingStateOptedOut {
- (void)setAttributionDetails:(NSDictionary *)attributionDetails
error:(NSError *)error
{
[self.iAdTimeoutTimer cancel];

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

Expand Down Expand Up @@ -435,7 +437,7 @@ - (void)setAttributionDetails:(NSDictionary *)attributionDetails
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];
[self checkForiAd];
});
return;
}
Expand Down Expand Up @@ -793,8 +795,8 @@ - (void)initI:(ADJActivityHandler *)selfI
startsSending:[selfI toSendI:selfI
sdkClickHandlerOnly:YES]];

if (self.adjustConfig.allowiAdInfoReading == YES) {
[self checkForIad];
if (selfI.adjustConfig.allowiAdInfoReading == YES) {
[selfI checkForiAdI:selfI];
}

[selfI preLaunchActionsI:selfI preLaunchActionsArray:preLaunchActionsArray];
Expand Down Expand Up @@ -1297,8 +1299,8 @@ - (void)setEnabledI:(ADJActivityHandler *)selfI enabled:(BOOL)enabled {
} else if ([ADJUserDefaults getDisableThirdPartySharing]) {
[selfI disableThirdPartySharing];
}
if (self.adjustConfig.allowiAdInfoReading == YES) {
[self checkForIad];
if (selfI.adjustConfig.allowiAdInfoReading == YES) {
[selfI checkForiAdI:selfI];
}
}

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

- (void)checkForIad {
if (self.iAdTimeoutTimer == nil) {
self.iAdTimeoutTimer =
- (void)checkForiAd {
[ADJUtil launchInQueue:self.internalQueue
selfInject:self
block:^(ADJActivityHandler *selfI) {
[selfI checkForiAdI:selfI];
}];
}

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

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

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

- (void)setOfflineModeI:(ADJActivityHandler *)selfI
Expand Down
5 changes: 3 additions & 2 deletions Adjust/ADJAdditions/UIDevice+ADJAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,9 @@ - (BOOL)setiAdWithDetails:(ADJActivityHandler *)activityHandler
error:error];
}];
#pragma clang diagnostic pop
[iAdTimeoutTimer startIn:5.0];

if (iAdTimeoutTimer) {
[iAdTimeoutTimer startIn:5.0];
}
return YES;
}

Expand Down
9 changes: 9 additions & 0 deletions Adjust/ADJTimerOnce.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ - (void)startIn:(NSTimeInterval)startIn {

self.source = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, self.internalQueue);

if (!self.source) {
[self.logger error:@"%@ could not start witouth source", self.name];
return;
}
if (!self.block) {
[self.logger error:@"%@ could not start witouth block", self.name];
return;
}

dispatch_source_set_timer(self.source,
dispatch_walltime(NULL, startIn * NSEC_PER_SEC),
DISPATCH_TIME_FOREVER,
Expand Down
59 changes: 30 additions & 29 deletions Adjust/ADJUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
static CTTelephonyNetworkInfo *networkInfo = nil;
#endif

static NSString * const kClientSdk = @"ios4.21.1";
static NSString * const kClientSdk = @"ios4.21.2";
static NSString * const kDeeplinkParam = @"deep_link=";
static NSString * const kSchemeDelimiter = @"://";
static NSString * const kDefaultScheme = @"AdjustUniversalScheme";
Expand Down Expand Up @@ -370,44 +370,45 @@ + (id)readObject:(NSString *)fileName

+ (void)writeObject:(id)object
fileName:(NSString *)fileName
objectName:(NSString *)objectName
{
objectName:(NSString *)objectName {
@synchronized([ADJUtil class]) {
BOOL result;
NSString *filePath = [ADJUtil getFilePathInAppSupportDir:fileName];

if (!filePath) {
[[ADJAdjustFactory logger] error:@"Cannot get filepath from filename: %@, to write %@ file", fileName, objectName];
return;
}
@try {
BOOL result;
NSString *filePath = [ADJUtil getFilePathInAppSupportDir:fileName];
if (!filePath) {
[[ADJAdjustFactory logger] error:@"Cannot get filepath from filename: %@, to write %@ file", fileName, objectName];
return;
}

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) {
NSError *errorArchiving = nil;
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) {
NSError *errorArchiving = nil;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunguarded-availability"
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:object requiringSecureCoding:NO error:&errorArchiving];
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:object requiringSecureCoding:NO error:&errorArchiving];
#pragma clang diagnostic pop
if (data && errorArchiving == nil) {
NSError *errorWriting = nil;
result = [data writeToFile:filePath options:NSDataWritingAtomic error:&errorWriting];
result = result && (errorWriting == nil);
if (data && errorArchiving == nil) {
NSError *errorWriting = nil;
result = [data writeToFile:filePath options:NSDataWritingAtomic error:&errorWriting];
result = result && (errorWriting == nil);
} else {
result = NO;
}
} else {
result = NO;
result = [NSKeyedArchiver archiveRootObject:object toFile:filePath];
}
} else {
result = [NSKeyedArchiver archiveRootObject:object toFile:filePath];
}
if (result == YES) {
[ADJUtil excludeFromBackup:filePath];
if ([object isKindOfClass:[NSArray class]]) {
[[ADJAdjustFactory logger] debug:@"Package handler wrote %d packages", [object count]];
if (result == YES) {
[ADJUtil excludeFromBackup:filePath];
if ([object isKindOfClass:[NSArray class]]) {
[[ADJAdjustFactory logger] debug:@"Package handler wrote %d packages", [object count]];
} else {
[[ADJAdjustFactory logger] debug:@"Wrote %@: %@", objectName, object];
}
} else {
[[ADJAdjustFactory logger] debug:@"Wrote %@: %@", objectName, object];
[[ADJAdjustFactory logger] error:@"Failed to write %@ file", objectName];
}
} else {
[[ADJAdjustFactory logger] error:@"Failed to write %@ file", objectName];
} @catch (NSException *exception) {
[[ADJAdjustFactory logger] error:@"Failed to write %@ file (%@)", objectName, exception];
}

}
}

Expand Down
2 changes: 1 addition & 1 deletion Adjust/Adjust.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Adjust.h
// Adjust
//
// V4.21.1
// V4.21.2
// Created by Christian Wellenbrock (wellle) on 23rd July 2013.
// Copyright © 2012-2017 Adjust GmbH. All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion AdjustBridge/AdjustBridgeRegister.m
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ + (NSString *)adjust_js {
if (this.sdkPrefix) {
return this.sdkPrefix;
} else {
return 'web-bridge4.21.1';
return 'web-bridge4.21.2';
}
},
setTestOptions: function(testOptions) {
Expand Down
2 changes: 1 addition & 1 deletion AdjustTests/AdjustUnitTests/ADJPackageFields.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ - (id) init {

// default values
self.appToken = @"qwerty123456";
self.clientSdk = @"ios4.21.1";
self.clientSdk = @"ios4.21.2";
self.suffix = @"";
self.environment = @"sandbox";

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### Version 4.21.2 (15th April 2020)
#### Fixed
- Added check for timer source and block existence prior to starting it.

---

### Version 4.21.1 (9th April 2020)
#### Added
- Added support for Mac Catalyst (thanks to @rjchatfield).
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ We will describe the steps to integrate the Adjust SDK into your iOS project. We
If you're using [CocoaPods][cocoapods], you can add the following line to your `Podfile` and continue from [this step](#sdk-integrate):

```ruby
pod 'Adjust', '~> 4.21.1'
pod 'Adjust', '~> 4.21.2'
```

or:

```ruby
pod 'Adjust', :git => 'https://github.com/adjust/ios_sdk.git', :tag => 'v4.21.1'
pod 'Adjust', :git => 'https://github.com/adjust/ios_sdk.git', :tag => 'v4.21.2'
```

---
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.21.1
4.21.2
4 changes: 2 additions & 2 deletions doc/chinese/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ Read this in other languages: [English][en-readme], [中文][zh-readme], [日本
如果您正在使用[CocoaPods][cocoapods],您可以将以下代码行添加至 `Podfile`,然后继续进行[此步骤](#sdk-integrate):

```ruby
pod 'Adjust', '~> 4.21.1'
pod 'Adjust', '~> 4.21.2'
```

或:

```ruby
pod 'Adjust', :git => 'https://github.com/adjust/ios_sdk.git', :tag => 'v4.21.1'
pod 'Adjust', :git => 'https://github.com/adjust/ios_sdk.git', :tag => 'v4.21.2'
```

---
Expand Down
2 changes: 1 addition & 1 deletion doc/english/migrate.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Migrate your adjust SDK for iOS to v4.21.1 from v3.4.0
## Migrate your Adjust SDK for iOS to v4.21.2 from v3.4.0

### Initial setup

Expand Down
2 changes: 1 addition & 1 deletion doc/english/web_views.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ We will describe the steps to integrate the Adjust SDK into your iOS project. We
If you're using [CocoaPods][cocoapods], you can add the following line to your `Podfile` and continue from [this step](#sdk-integrate):

```ruby
pod 'Adjust/WebBridge', '~> 4.21.1'
pod 'Adjust/WebBridge', '~> 4.21.2'
```

---
Expand Down
4 changes: 2 additions & 2 deletions doc/japanese/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ adjust SDKをiOSプロジェクトに連携する手順を説明します。
[こちらの手順](#sdk-integrate)に進んでください。

```ruby
pod 'Adjust', '~> 4.21.1'
pod 'Adjust', '~> 4.21.2'
```

または

```ruby
pod 'Adjust', :git => 'https://github.com/adjust/ios_sdk.git', :tag => 'v4.21.1'
pod 'Adjust', :git => 'https://github.com/adjust/ios_sdk.git', :tag => 'v4.21.2'
```

---
Expand Down
4 changes: 2 additions & 2 deletions doc/korean/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ iOS 개발용 Xcode를 사용한다는 가정하에 iOS 프로젝트에 Adjust S
[CocoaPods][cocoapods]를 사용하는 경우, 다음 내용을 `Podfile`에 추가한 후 [해당 단계](#sdk-integrate)를 완료하세요.

```ruby
pod 'Adjust', '~> 4.21.1'
pod 'Adjust', '~> 4.21.2'
```

또는:

```ruby
pod 'Adjust', :git => 'https://github.com/adjust/ios_sdk.git', :tag => 'v4.21.1'
pod 'Adjust', :git => 'https://github.com/adjust/ios_sdk.git', :tag => 'v4.21.2'
```

---
Expand Down
2 changes: 1 addition & 1 deletion doc/korean/web_views.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ iOS 개발용 Xcode를 사용한다는 가정하에 iOS 프로젝트에 Adjust S
[CocoaPods][cocoapods]를 사용하는 경우, 다음 내용을 'Podfile'에 추가한 후 [해당 단계](#sdk-integrate)를 완료하세요.

```ruby
pod 'Adjust/WebBridge', '~> 4.21.1'
pod 'Adjust/WebBridge', '~> 4.21.2'
```

---
Expand Down
2 changes: 1 addition & 1 deletion doc/migrate.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Migrate your Adjust SDK for iOS to v4.21.1 from v3.4.0
## Migrate your Adjust SDK for iOS to v4.21.2 from v3.4.0

### Initial setup

Expand Down