Skip to content

Commit

Permalink
Merge pull request #306 from adjust/v4115_web
Browse files Browse the repository at this point in the history
Version 4.11.5
  • Loading branch information
uerceg authored Sep 21, 2017
2 parents 5ab7701 + a116582 commit c067e82
Show file tree
Hide file tree
Showing 30 changed files with 112 additions and 335 deletions.
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.11.4"
s.version = "4.11.5"
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" => "[email protected]" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.11.4" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.11.5" }
s.ios.deployment_target = '6.0'
s.tvos.deployment_target = '9.0'
s.framework = 'SystemConfiguration'
Expand Down
24 changes: 0 additions & 24 deletions Adjust.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,6 @@
9D7431F81EB9F9B700969F14 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9D7431F61EB9F9B700969F14 /* LaunchScreen.storyboard */; };
9DB457B01D743704004D69E8 /* ADJBackoffStrategy.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DF9C8DF1D6F3CA5008E362F /* ADJBackoffStrategy.m */; };
9DB457B11D743704004D69E8 /* ADJSdkClickHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DF9C8F71D6F3CA5008E362F /* ADJSdkClickHandler.m */; };
9DCAE04B1E5334F4009DD542 /* ADJConnectionValidator.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DCAE0491E5334F4009DD542 /* ADJConnectionValidator.h */; };
9DCAE04C1E5334F4009DD542 /* ADJConnectionValidator.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DCAE04A1E5334F4009DD542 /* ADJConnectionValidator.m */; };
9DCAE04F1E535134009DD542 /* ADJConnectionValidator.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DCAE04D1E535134009DD542 /* ADJConnectionValidator.h */; };
9DCAE0501E535134009DD542 /* ADJConnectionValidator.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DCAE04E1E535134009DD542 /* ADJConnectionValidator.m */; };
9DCAE0531E535147009DD542 /* ADJConnectionValidator.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DCAE0511E535147009DD542 /* ADJConnectionValidator.h */; };
9DCAE0541E535147009DD542 /* ADJConnectionValidator.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DCAE0521E535147009DD542 /* ADJConnectionValidator.m */; };
9DE7C8FD1AE688DA001556E5 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9DE7C8FC1AE688DA001556E5 /* UIKit.framework */; };
9DF9C8B31D6ED228008E362F /* ADJKeychain.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DF9C8B11D6ED228008E362F /* ADJKeychain.h */; };
9DF9C8B41D6ED228008E362F /* ADJKeychain.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DF9C8B21D6ED228008E362F /* ADJKeychain.m */; };
Expand Down Expand Up @@ -518,12 +512,6 @@
9D75F1841D07460600E5D222 /* adjust_config.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = adjust_config.js; sourceTree = "<group>"; };
9D75F1851D07460600E5D222 /* adjust_event.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = adjust_event.js; sourceTree = "<group>"; };
9D75F1861D07460600E5D222 /* adjust.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = adjust.js; sourceTree = "<group>"; };
9DCAE0491E5334F4009DD542 /* ADJConnectionValidator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJConnectionValidator.h; sourceTree = "<group>"; };
9DCAE04A1E5334F4009DD542 /* ADJConnectionValidator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJConnectionValidator.m; sourceTree = "<group>"; };
9DCAE04D1E535134009DD542 /* ADJConnectionValidator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJConnectionValidator.h; sourceTree = "<group>"; };
9DCAE04E1E535134009DD542 /* ADJConnectionValidator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJConnectionValidator.m; sourceTree = "<group>"; };
9DCAE0511E535147009DD542 /* ADJConnectionValidator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJConnectionValidator.h; sourceTree = "<group>"; };
9DCAE0521E535147009DD542 /* ADJConnectionValidator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJConnectionValidator.m; sourceTree = "<group>"; };
9DE7C8FC1AE688DA001556E5 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
9DF9C8B11D6ED228008E362F /* ADJKeychain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJKeychain.h; sourceTree = "<group>"; };
9DF9C8B21D6ED228008E362F /* ADJKeychain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJKeychain.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -860,8 +848,6 @@
9DF9C8B21D6ED228008E362F /* ADJKeychain.m */,
96B6710E1D788EEC0090A023 /* ADJSessionParameters.h */,
96B6710F1D788EEC0090A023 /* ADJSessionParameters.m */,
9DCAE0491E5334F4009DD542 /* ADJConnectionValidator.h */,
9DCAE04A1E5334F4009DD542 /* ADJConnectionValidator.m */,
);
path = Adjust;
sourceTree = "<group>";
Expand Down Expand Up @@ -1059,8 +1045,6 @@
9DF9C9071D6F3CA5008E362F /* ADJUtil.m */,
96B671121D788F4A0090A023 /* ADJSessionParameters.h */,
96B671131D788F4A0090A023 /* ADJSessionParameters.m */,
9DCAE04D1E535134009DD542 /* ADJConnectionValidator.h */,
9DCAE04E1E535134009DD542 /* ADJConnectionValidator.m */,
9DF9C9081D6F3CA5008E362F /* Info.plist */,
);
path = Adjust;
Expand Down Expand Up @@ -1159,8 +1143,6 @@
9DFB06581D7470C0006D48FC /* ADJUtil.m */,
96B671161D788F7A0090A023 /* ADJSessionParameters.h */,
96B671171D788F7A0090A023 /* ADJSessionParameters.m */,
9DCAE0511E535147009DD542 /* ADJConnectionValidator.h */,
9DCAE0521E535147009DD542 /* ADJConnectionValidator.m */,
9DFB06591D7470C0006D48FC /* Info.plist */,
);
path = Adjust;
Expand Down Expand Up @@ -1205,7 +1187,6 @@
96BCFBD91AC9934E005A65C5 /* ADJAdjustFactory.h in Headers */,
96BCFBDA1AC99353005A65C5 /* ADJPackageBuilder.h in Headers */,
96BCFBDB1AC99355005A65C5 /* ADJPackageHandler.h in Headers */,
9DCAE04B1E5334F4009DD542 /* ADJConnectionValidator.h in Headers */,
96BCFBDC1AC99360005A65C5 /* ADJRequestHandler.h in Headers */,
96BCFBDE1AC99365005A65C5 /* ADJUtil.h in Headers */,
96BCFBDF1AC99368005A65C5 /* ADJDeviceInfo.h in Headers */,
Expand Down Expand Up @@ -1246,7 +1227,6 @@
9DF9C92D1D6F3CA5008E362F /* ADJPackageBuilder.h in Headers */,
9DF9C92F1D6F3CA5008E362F /* ADJPackageHandler.h in Headers */,
9DF9C9311D6F3CA5008E362F /* ADJRequestHandler.h in Headers */,
9DCAE04F1E535134009DD542 /* ADJConnectionValidator.h in Headers */,
9DF9C9451D6F3CA5008E362F /* ADJUtil.h in Headers */,
9DF9C9211D6F3CA5008E362F /* ADJDeviceInfo.h in Headers */,
9DF9C91B1D6F3CA5008E362F /* ADJAttributionHandler.h in Headers */,
Expand Down Expand Up @@ -1286,7 +1266,6 @@
9DFB067E1D7470C0006D48FC /* ADJPackageBuilder.h in Headers */,
9DFB06801D7470C0006D48FC /* ADJPackageHandler.h in Headers */,
9DFB06821D7470C0006D48FC /* ADJRequestHandler.h in Headers */,
9DCAE0531E535147009DD542 /* ADJConnectionValidator.h in Headers */,
9DFB06961D7470C0006D48FC /* ADJUtil.h in Headers */,
9DFB06721D7470C0006D48FC /* ADJDeviceInfo.h in Headers */,
9DFB066C1D7470C0006D48FC /* ADJAttributionHandler.h in Headers */,
Expand Down Expand Up @@ -1681,7 +1660,6 @@
96FCC53B1C186426007BBFE1 /* ADJResponseData.m in Sources */,
968173841C3C2D07002AE1DE /* ADJSessionSuccess.m in Sources */,
968173881C3C2D36002AE1DE /* ADJSessionFailure.m in Sources */,
9DCAE04C1E5334F4009DD542 /* ADJConnectionValidator.m in Sources */,
9601CAE51C74B70600670879 /* ADJEventSuccess.m in Sources */,
9601CAE91C74BAAE00670879 /* ADJEventFailure.m in Sources */,
96164D8D1CCA4DEA009431AB /* ADJSystemProfile.m in Sources */,
Expand Down Expand Up @@ -1764,7 +1742,6 @@
9DF9C9341D6F3CA5008E362F /* ADJResponseData.m in Sources */,
9DF9C93A1D6F3CA5008E362F /* ADJSessionSuccess.m in Sources */,
9DF9C9381D6F3CA5008E362F /* ADJSessionFailure.m in Sources */,
9DCAE0501E535134009DD542 /* ADJConnectionValidator.m in Sources */,
9DF9C9281D6F3CA5008E362F /* ADJEventSuccess.m in Sources */,
9DF9C9261D6F3CA5008E362F /* ADJEventFailure.m in Sources */,
9DF9C93C1D6F3CA5008E362F /* ADJSystemProfile.m in Sources */,
Expand Down Expand Up @@ -1803,7 +1780,6 @@
9DFB06851D7470C0006D48FC /* ADJResponseData.m in Sources */,
9DFB068B1D7470C0006D48FC /* ADJSessionSuccess.m in Sources */,
9DFB06891D7470C0006D48FC /* ADJSessionFailure.m in Sources */,
9DCAE0541E535147009DD542 /* ADJConnectionValidator.m in Sources */,
9DFB06791D7470C0006D48FC /* ADJEventSuccess.m in Sources */,
9DFB06771D7470C0006D48FC /* ADJEventFailure.m in Sources */,
9DFB068D1D7470C0006D48FC /* ADJSystemProfile.m in Sources */,
Expand Down
92 changes: 27 additions & 65 deletions Adjust/ADJActivityState.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,35 +82,40 @@ - (BOOL)findTransactionId:(NSString *)transactionId {
#pragma mark - Private & helper methods

- (void)assignUuid:(NSString *)uuid {
// First check if there's any UUID written in keychain.
// If yes, use keychain value and flag it.
// If not, use given UUID and store it to keychain.
// If successfully written, flag it.
// If writing failed, don't flat it.
// Small addition as of iOS 10.3:
// Keychain needs to be written in different way in order to persist value between (un)installs.

// Check if device supports new writing method.
// kSecAttrAccessGroupToken available since iOS 10.0.
if (NULL == &kSecAttrAccessGroupToken) {
// This device's iOS version doesn't support new writing method.
[self assignUuidOldMethod:uuid];
return;
} else {
// This device's iOS version supports new writing method.
[self assignUuidNewMethod:uuid];
return;
// 1. Check if UUID is written to keychain in v2 way.
// 1.1 If yes, take stored UUID and send it to v1 check.
// 1.2 If not, take given UUID and send it to v1 check.
// v1 check:
// 2.1 If given UUID is found in v1 way, use it.
// 2.2 If given UUID is not found in v1 way, write it in v1 way and use it.

// First check if we have the key written with app's unique key name.
NSString *uniqueKey = [self generateUniqueKey];
NSString *persistedUuidUnique = [ADJKeychain valueForKeychainKeyV2:uniqueKey service:@"deviceInfo"];

if (persistedUuidUnique != nil) {
// Check if value has UUID format.
if ((bool)[[NSUUID alloc] initWithUUIDString:persistedUuidUnique]) {
[[ADJAdjustFactory logger] verbose:@"Value found and read from the keychain v2 way"];

// If we read the key with v2 way, write it back in v1 way since in iOS 11, that's the only one that it works.
[self assignUuidOldMethod:persistedUuidUnique];
}
}

// At this point, UUID was not persisted in v2 way or if persisted, didn't have proper UUID format.
// Try the v1 way with given UUID.
[self assignUuidOldMethod:uuid];
}

- (void)assignUuidOldMethod:(NSString *)uuid {
NSString *persistedUuid = [ADJKeychain valueForKeychainKeyOld:@"adjust_persisted_uuid" service:@"deviceInfo"];
NSString *persistedUuid = [ADJKeychain valueForKeychainKeyV1:@"adjust_persisted_uuid" service:@"deviceInfo"];

// Check if value exists in keychain.
if (persistedUuid != nil) {
// Check if value has UUID format.
if ((bool)[[NSUUID alloc] initWithUUIDString:persistedUuid]) {
[[ADJAdjustFactory logger] verbose:@"Value found and read from the keychain old way"];
[[ADJAdjustFactory logger] verbose:@"Value found and read from the keychain v1 way"];

// Value written in keychain seems to have UUID format.
self.uuid = persistedUuid;
Expand All @@ -120,10 +125,10 @@ - (void)assignUuidOldMethod:(NSString *)uuid {
}
}

// At this point, UUID was not persisted or if persisted, didn't have proper UUID format.
// At this point, UUID was not persisted in v1 way or if persisted, didn't have proper UUID format.

// Since we don't have anything in the keychain, we'll use the passed UUID value.
// Try to save that value to the keychain and flag if successfully written.
// Try to save that value to the keychain in v1 way and flag if successfully written.
self.uuid = uuid;
self.isPersisted = [ADJKeychain setValue:self.uuid forKeychainKey:@"adjust_persisted_uuid" inService:@"deviceInfo"];
}
Expand All @@ -144,49 +149,6 @@ - (NSString *)generateUniqueKey {
return [joinedKey adjSha1];
}

- (void)assignUuidNewMethod:(NSString *)uuid {
// First check if we have the key written with app's unique key name.
NSString *uniqueKey = [self generateUniqueKey];
NSString *persistedUuidUnique = [ADJKeychain valueForKeychainKeyNew:uniqueKey service:@"deviceInfo"];

if (persistedUuidUnique != nil) {
// Check if value has UUID format.
if ((bool)[[NSUUID alloc] initWithUUIDString:persistedUuidUnique]) {
[[ADJAdjustFactory logger] verbose:@"Value found and read from the keychain new way"];

// Value written in keychain seems to have UUID format.
self.uuid = persistedUuidUnique;
self.isPersisted = YES;

return;
}
}

// At this point, UUID was not persisted with unique key or if persisted, didn't have proper UUID format.

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

if (persistedUuidOld != nil) {
// Check if value has UUID format.
if ((bool)[[NSUUID alloc] initWithUUIDString:persistedUuidOld]) {
[[ADJAdjustFactory logger] verbose:@"Value found and read from the keychain old way"];

// Since we have the value in the keychain written with old method, we'll use it to save it with new one.
self.uuid = persistedUuidOld;
} else {
// Since found value in the keychain doesn't have propper UUID format, we'll use passed UUID value.
self.uuid = uuid;
}
} else {
// Since we didn't find anything in the keychain with old method as well, we'll use the passed UUID value.
self.uuid = uuid;
}

// Try to save that value to the keychain and flag if successfully written.
self.isPersisted = [ADJKeychain setValue:self.uuid forKeychainKey:uniqueKey inService:@"deviceInfo"];
}

- (NSString *)description {
return [NSString stringWithFormat:@"ec:%d sc:%d ssc:%d ask:%d sl:%.1f ts:%.1f la:%.1f dt:%@",
self.eventCount, self.sessionCount, self.subsessionCount, self.askingAttribution, self.sessionLength,
Expand Down
19 changes: 0 additions & 19 deletions Adjust/ADJConnectionValidator.h

This file was deleted.

88 changes: 0 additions & 88 deletions Adjust/ADJConnectionValidator.m

This file was deleted.

4 changes: 2 additions & 2 deletions Adjust/ADJKeychain.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

@interface ADJKeychain : NSObject

+ (NSString *)valueForKeychainKeyOld:(NSString *)key service:(NSString *)service;
+ (NSString *)valueForKeychainKeyNew:(NSString *)key service:(NSString *)service;
+ (NSString *)valueForKeychainKeyV1:(NSString *)key service:(NSString *)service;
+ (NSString *)valueForKeychainKeyV2:(NSString *)key service:(NSString *)service;
+ (BOOL)setValue:(NSString *)value forKeychainKey:(NSString *)key inService:(NSString *)service;

@end
Loading

0 comments on commit c067e82

Please sign in to comment.