Skip to content

Commit a3462b4

Browse files
authored
Merge pull request #279 from adjust/v4112
Version 4.11.2
2 parents d147292 + 0778d19 commit a3462b4

16 files changed

+88
-22
lines changed

Adjust.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Pod::Spec.new do |s|
22
s.name = "Adjust"
3-
s.version = "4.11.1"
3+
s.version = "4.11.2"
44
s.summary = "This is the iOS SDK of adjust. You can read more about it at http://adjust.com."
55
s.homepage = "https://github.com/adjust/ios_sdk"
66
s.license = { :type => 'MIT', :file => 'MIT-LICENSE' }
77
s.author = { "Christian Wellenbrock" => "[email protected]" }
8-
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.11.1" }
8+
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.11.2" }
99
s.ios.deployment_target = '6.0'
1010
s.tvos.deployment_target = '9.0'
1111
s.framework = 'SystemConfiguration'

Adjust/ADJActivityHandler.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ - (id)initWithConfig:(ADJConfig *)adjustConfig
135135

136136
[self.logger lockLogLevel];
137137

138+
// inject app token be available in activity state
139+
[ADJActivityState saveAppToken:adjustConfig.appToken];
140+
138141
// read files to have sync values available
139142
[self readAttribution];
140143
[self readActivityState];

Adjust/ADJActivityState.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141

4242
- (void)resetSessionAttributes:(double)now;
4343

44+
+ (void)saveAppToken:(NSString *)appTokenToSave;
45+
4446
// Transaction ID management
4547
- (void)addTransactionId:(NSString *)transactionId;
4648
- (BOOL)findTransactionId:(NSString *)transactionId;

Adjust/ADJActivityState.m

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
#import "ADJAdjustFactory.h"
1111
#import "ADJActivityState.h"
1212
#import "UIDevice+ADJAdditions.h"
13+
#import "NSString+ADJAdditions.h"
1314

1415
static const int kTransactionIdCount = 10;
16+
static NSString *appToken = nil;
1517

1618
@implementation ADJActivityState
1719

@@ -44,6 +46,12 @@ - (id)init {
4446

4547
#pragma mark - Public methods
4648

49+
+ (void)saveAppToken:(NSString *)appTokenToSave {
50+
@synchronized (self) {
51+
appToken = appTokenToSave;
52+
}
53+
}
54+
4755
- (void)resetSessionAttributes:(double)now {
4856
self.subsessionCount = 1;
4957
self.sessionLength = 0;
@@ -120,31 +128,50 @@ - (void)assignUuidOldMethod:(NSString *)uuid {
120128
self.isPersisted = [ADJKeychain setValue:self.uuid forKeychainKey:@"adjust_persisted_uuid" inService:@"deviceInfo"];
121129
}
122130

123-
- (void)assignUuidNewMethod:(NSString *)uuid {
124-
NSString *persistedUuidNew = [ADJKeychain valueForKeychainKeyNew:@"adjust_persisted_uuid" service:@"deviceInfo"];
131+
- (NSString *)generateUniqueKey {
132+
if (appToken == nil) {
133+
return nil;
134+
}
125135

126-
// Check if value exists in keychain.
127-
if (persistedUuidNew != nil) {
136+
NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
137+
138+
if (bundleIdentifier == nil) {
139+
return nil;
140+
}
141+
142+
NSString *joinedKey = [NSString stringWithFormat:@"%@%@", bundleIdentifier, appToken];
143+
144+
return [joinedKey adjSha1];
145+
}
146+
147+
- (void)assignUuidNewMethod:(NSString *)uuid {
148+
// First check if we have the key written with app's unique key name.
149+
NSString *uniqueKey = [self generateUniqueKey];
150+
NSString *persistedUuidUnique = [ADJKeychain valueForKeychainKeyNew:uniqueKey service:@"deviceInfo"];
151+
152+
if (persistedUuidUnique != nil) {
128153
// Check if value has UUID format.
129-
if ((bool)[[NSUUID alloc] initWithUUIDString:persistedUuidNew]) {
154+
if ((bool)[[NSUUID alloc] initWithUUIDString:persistedUuidUnique]) {
130155
[[ADJAdjustFactory logger] verbose:@"Value found and read from the keychain new way"];
131-
156+
132157
// Value written in keychain seems to have UUID format.
133-
self.uuid = persistedUuidNew;
158+
self.uuid = persistedUuidUnique;
134159
self.isPersisted = YES;
135-
160+
136161
return;
137162
}
138163
}
139164

140-
// At this point, UUID was not persisted with new method or if persisted, didn't have proper UUID format.
165+
// At this point, UUID was not persisted with unique key or if persisted, didn't have proper UUID format.
141166

142167
// Check if it's still saved in the keychain with old writing method.
143168
NSString *persistedUuidOld = [ADJKeychain valueForKeychainKeyOld:@"adjust_persisted_uuid" service:@"deviceInfo"];
144169

145170
if (persistedUuidOld != nil) {
146171
// Check if value has UUID format.
147172
if ((bool)[[NSUUID alloc] initWithUUIDString:persistedUuidOld]) {
173+
[[ADJAdjustFactory logger] verbose:@"Value found and read from the keychain old way"];
174+
148175
// Since we have the value in the keychain written with old method, we'll use it to save it with new one.
149176
self.uuid = persistedUuidOld;
150177
} else {
@@ -157,7 +184,7 @@ - (void)assignUuidNewMethod:(NSString *)uuid {
157184
}
158185

159186
// Try to save that value to the keychain and flag if successfully written.
160-
self.isPersisted = [ADJKeychain setValue:self.uuid forKeychainKey:@"adjust_persisted_uuid" inService:@"deviceInfo"];
187+
self.isPersisted = [ADJKeychain setValue:self.uuid forKeychainKey:uniqueKey inService:@"deviceInfo"];
161188
}
162189

163190
- (NSString *)description {

Adjust/ADJAdditions/NSString+ADJAdditions.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
@interface NSString(ADJAdditions)
1111

12+
- (NSString *)adjSha1;
1213
- (NSString *)adjTrim;
1314
- (NSString *)adjUrlEncode;
1415
- (NSString *)adjUrlDecode;

Adjust/ADJAdditions/NSString+ADJAdditions.m

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
// Copyright (c) 2012-2014 adjust GmbH. All rights reserved.
77
//
88

9+
#import <CommonCrypto/CommonDigest.h>
10+
911
#import "NSString+ADJAdditions.h"
1012

1113
@implementation NSString(ADJAdditions)
@@ -41,6 +43,21 @@ - (NSString *)adjRemoveColons {
4143
return [self stringByReplacingOccurrencesOfString:@":" withString:@""];
4244
}
4345

46+
- (NSString *)adjSha1 {
47+
NSData *data = [self dataUsingEncoding:NSUTF8StringEncoding];
48+
uint8_t digest[CC_SHA1_DIGEST_LENGTH];
49+
50+
CC_SHA1(data.bytes, (CC_LONG)data.length, digest);
51+
52+
NSMutableString *output = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2];
53+
54+
for (int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++) {
55+
[output appendFormat:@"%02x", digest[i]];
56+
}
57+
58+
return output;
59+
}
60+
4461
+ (NSString *)adjJoin:(NSString *)first, ... {
4562
NSString *iter, *result = first;
4663
va_list strings;
@@ -52,10 +69,11 @@ + (NSString *)adjJoin:(NSString *)first, ... {
5269
}
5370

5471
va_end(strings);
72+
5573
return result;
5674
}
5775

58-
+ (BOOL) adjIsEqual:(NSString *)first toString:(NSString *)second {
76+
+ (BOOL)adjIsEqual:(NSString *)first toString:(NSString *)second {
5977
if (first == nil && second == nil) {
6078
return YES;
6179
}

Adjust/ADJKeychain.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,23 @@ - (id)init {
3838
#pragma mark - Public methods
3939

4040
+ (BOOL)setValue:(NSString *)value forKeychainKey:(NSString *)key inService:(NSString *)service {
41+
if (key == nil) {
42+
return NO;
43+
}
4144
return [[ADJKeychain getInstance] setValue:value forKeychainKey:key inService:service];
4245
}
4346

4447
+ (NSString *)valueForKeychainKeyOld:(NSString *)key service:(NSString *)service {
48+
if (key == nil) {
49+
return nil;
50+
}
4551
return [[ADJKeychain getInstance] valueForKeychainKeyOld:key service:service];
4652
}
4753

4854
+ (NSString *)valueForKeychainKeyNew:(NSString *)key service:(NSString *)service {
55+
if (key == nil) {
56+
return nil;
57+
}
4958
return [[ADJKeychain getInstance] valueForKeychainKeyNew:key service:service];
5059
}
5160

Adjust/ADJUtil.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
static NSString *userAgent = nil;
3535

36-
static NSString * const kClientSdk = @"ios4.11.1";
36+
static NSString * const kClientSdk = @"ios4.11.2";
3737
static NSString * const kDeeplinkParam = @"deep_link=";
3838
static NSString * const kSchemeDelimiter = @"://";
3939
static NSString * const kDefaultScheme = @"AdjustUniversalScheme";

Adjust/Adjust.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Adjust.h
33
// Adjust
44
//
5-
// V4.11.1
5+
// V4.11.2
66
// Created by Christian Wellenbrock on 2012-07-23.
77
// Copyright (c) 2012-2014 adjust GmbH. All rights reserved.
88
//

AdjustTests/ADJPackageFields.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ - (id) init {
1616

1717
// default values
1818
self.appToken = @"qwerty123456";
19-
self.clientSdk = @"ios4.11.1";
19+
self.clientSdk = @"ios4.11.2";
2020
self.suffix = @"";
2121
self.environment = @"sandbox";
2222

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### Version 4.11.2 (14th March 2017)
2+
#### Changed
3+
- Changed key name used to save persistent UUID to be unique per app.
4+
5+
---
6+
17
### Version 4.11.1 (13th March 2017)
28
#### Added
39
- Added sending of the app's install time.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ In the dialog `Choose options for adding these files` make sure to check the che
8181
If you're using [CocoaPods][cocoapods], you can add the following line to your `Podfile` and continue from [this step](#sdk-integrate):
8282

8383
```ruby
84-
pod 'Adjust', '~> 4.11.1'
84+
pod 'Adjust', '~> 4.11.2'
8585
```
8686

8787
or:
8888

8989
```ruby
90-
pod 'Adjust', :git => 'https://github.com/adjust/ios_sdk.git', :tag => 'v4.11.1'
90+
pod 'Adjust', :git => 'https://github.com/adjust/ios_sdk.git', :tag => 'v4.11.2'
9191
```
9292

9393
--

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.11.1
1+
4.11.2

doc/english/migrate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Migrate your adjust SDK for iOS to v4.11.1 from v3.4.0
1+
## Migrate your adjust SDK for iOS to v4.11.2 from v3.4.0
22

33
### Initial setup
44

doc/japanese/migrate_ja.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## iOS用adjust SDKのv3.4.0からv.4.11.1への移行
1+
## iOS用adjust SDKのv3.4.0からv.4.11.2への移行
22

33
### 初期設定
44

doc/migrate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Migrate your adjust SDK for iOS to v4.11.1 from v3.4.0
1+
## Migrate your adjust SDK for iOS to v4.11.2 from v3.4.0
22

33
### Initial setup
44

0 commit comments

Comments
 (0)