diff --git a/Adjust.podspec b/Adjust.podspec index 12b345f6e..0944652f9 100644 --- a/Adjust.podspec +++ b/Adjust.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |s| s.name = "Adjust" - s.version = "4.12.1" + s.version = "4.12.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.12.1" } + s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.12.2" } s.ios.deployment_target = '6.0' s.tvos.deployment_target = '9.0' s.framework = 'SystemConfiguration' diff --git a/Adjust.xcodeproj/project.pbxproj b/Adjust.xcodeproj/project.pbxproj index 4ca04ea44..e3d70ef4d 100644 --- a/Adjust.xcodeproj/project.pbxproj +++ b/Adjust.xcodeproj/project.pbxproj @@ -281,6 +281,20 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 6F08421C2007766800568A31 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 6F0842182007766700568A31 /* AdjustTestLibrary.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 6F08420C2007766700568A31; + remoteInfo = AdjustTestLibrary; + }; + 6F084244200776A100568A31 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 6F084240200776A000568A31 /* AdjustTestApp.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 6F0842272007769F00568A31; + remoteInfo = AdjustTestApp; + }; 9679922318BBAE2800394606 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9679920518BBAE2800394606 /* Project object */; @@ -376,6 +390,8 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 6F0842182007766700568A31 /* AdjustTestLibrary.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = AdjustTestLibrary.xcodeproj; path = AdjustTestLibrary/AdjustTestLibrary.xcodeproj; sourceTree = ""; }; + 6F084240200776A000568A31 /* AdjustTestApp.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = AdjustTestApp.xcodeproj; path = AdjustTestApp/AdjustTestApp.xcodeproj; sourceTree = ""; }; 6FCC84F71F278CF300D6A0ED /* ADJReachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJReachability.m; sourceTree = ""; }; 6FCC84F81F278CF300D6A0ED /* ADJReachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJReachability.h; sourceTree = ""; }; 6FCC85021F27944600D6A0ED /* ADJReachability.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ADJReachability.h; sourceTree = ""; }; @@ -726,6 +742,76 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 6F0841FB2007749C00568A31 /* AdjustUnitTests */ = { + isa = PBXGroup; + children = ( + 9D7431E71EB9F9B700969F14 /* AdjustExampleTests */, + 96E5E39B18BBB49E008E7B30 /* Adjust-Prefix.pch */, + 96E5E39C18BBB49E008E7B30 /* AdjustTests-Info.plist */, + 96E5E39D18BBB49E008E7B30 /* ADJActivityHandlerMock.h */, + 96E5E39E18BBB49E008E7B30 /* ADJActivityHandlerMock.m */, + 96E5E39F18BBB49E008E7B30 /* ADJActivityHandlerTests.m */, + 96E5E3A018BBB49E008E7B30 /* ADJLoggerMock.h */, + 96E5E3A118BBB49E008E7B30 /* ADJLoggerMock.m */, + 96E5E3A218BBB49E008E7B30 /* ADJPackageHandlerMock.h */, + 96E5E3A318BBB49E008E7B30 /* ADJPackageHandlerMock.m */, + 96E5E3A418BBB49E008E7B30 /* ADJPackageHandlerTests.m */, + 96E5E3A518BBB49E008E7B30 /* ADJRequestHandlerMock.h */, + 96E5E3A618BBB49E008E7B30 /* ADJRequestHandlerMock.m */, + 96A2D2371CEF3B2D00C39DE0 /* ADJRequestHandlerTests.m */, + 96E5E3A818BBB49E008E7B30 /* ADJTestsUtil.h */, + 96E5E3A918BBB49E008E7B30 /* ADJTestsUtil.m */, + 96E5E3AA18BBB49E008E7B30 /* InfoPlist.strings */, + 96E5E3AC18BBB49E008E7B30 /* NSURLConnection+NSURLConnectionSynchronousLoadingMocking.h */, + 96E5E3AD18BBB49E008E7B30 /* NSURLConnection+NSURLConnectionSynchronousLoadingMocking.m */, + 96ED00371A38A4CD00209110 /* ADJAttributionHandlerMock.h */, + 96ED00381A38A4CD00209110 /* ADJAttributionHandlerMock.m */, + 96ED003C1A38A98C00209110 /* ADJAttributionChangedDelegate.h */, + 96ED003D1A38A98C00209110 /* ADJAttributionChangedDelegate.m */, + 9657BF6E1A3B029000CD6853 /* ADJAttributionHandlerTests.m */, + 9620EA431B062D6F009673F1 /* ADJTestActivityPackage.h */, + 9620EA441B062D6F009673F1 /* ADJTestActivityPackage.m */, + 9620EA4C1B06401B009673F1 /* ADJTest.h */, + 9620EA4D1B06401B009673F1 /* ADJTest.m */, + 9620EA4F1B065177009673F1 /* ADJPackageFields.h */, + 9620EA501B065177009673F1 /* ADJPackageFields.m */, + 96FDD75C1C566C38009C402E /* NSURLSession+NSURLDataWithRequestMocking.h */, + 96FDD75D1C566C38009C402E /* NSURLSession+NSURLDataWithRequestMocking.m */, + 96ED74FD1CD81B3E00C073B8 /* ADJSdkClickHandlerMock.h */, + 96ED74FE1CD81B3E00C073B8 /* ADJSdkClickHandlerMock.m */, + 967D06981CE2272500ECFCE3 /* ADJSessionState.h */, + 967D06991CE2272500ECFCE3 /* ADJSessionState.m */, + 96E7689F1CE6267D005D811C /* ADJDeeplinkDelegate.h */, + 96E768A01CE6267D005D811C /* ADJDeeplinkDelegate.m */, + 96E768A81CE6281F005D811C /* ADJTrackingDelegate.h */, + 96E768A91CE6281F005D811C /* ADJTrackingDelegate.m */, + 96A2D2251CEE0E6200C39DE0 /* ADJSdkClickHandlerTests.m */, + 96FC6E4D1D256B81004482D8 /* ADJActivityHandlerConstructorState.h */, + 96FC6E4E1D256B81004482D8 /* ADJActivityHandlerConstructorState.m */, + 96FC6E561D258272004482D8 /* ADJEndSessionState.h */, + 96FC6E571D258272004482D8 /* ADJEndSessionState.m */, + 9D0C7D3D1D79B3FE009DDF4E /* ADJInitState.h */, + 9D0C7D3E1D79B3FE009DDF4E /* ADJInitState.m */, + ); + path = AdjustUnitTests; + sourceTree = ""; + }; + 6F0842192007766700568A31 /* Products */ = { + isa = PBXGroup; + children = ( + 6F08421D2007766800568A31 /* libAdjustTestLibrary.a */, + ); + name = Products; + sourceTree = ""; + }; + 6F084241200776A000568A31 /* Products */ = { + isa = PBXGroup; + children = ( + 6F084245200776A100568A31 /* AdjustTestApp.app */, + ); + name = Products; + sourceTree = ""; + }; 9648C5E41CD1765E00A3B049 /* AdjustBridge */ = { isa = PBXGroup; children = ( @@ -881,53 +967,9 @@ 96E5E39A18BBB49E008E7B30 /* AdjustTests */ = { isa = PBXGroup; children = ( - 9D7431E71EB9F9B700969F14 /* AdjustExampleTests */, - 96E5E39B18BBB49E008E7B30 /* Adjust-Prefix.pch */, - 96E5E39C18BBB49E008E7B30 /* AdjustTests-Info.plist */, - 96E5E39D18BBB49E008E7B30 /* ADJActivityHandlerMock.h */, - 96E5E39E18BBB49E008E7B30 /* ADJActivityHandlerMock.m */, - 96E5E39F18BBB49E008E7B30 /* ADJActivityHandlerTests.m */, - 96E5E3A018BBB49E008E7B30 /* ADJLoggerMock.h */, - 96E5E3A118BBB49E008E7B30 /* ADJLoggerMock.m */, - 96E5E3A218BBB49E008E7B30 /* ADJPackageHandlerMock.h */, - 96E5E3A318BBB49E008E7B30 /* ADJPackageHandlerMock.m */, - 96E5E3A418BBB49E008E7B30 /* ADJPackageHandlerTests.m */, - 96E5E3A518BBB49E008E7B30 /* ADJRequestHandlerMock.h */, - 96E5E3A618BBB49E008E7B30 /* ADJRequestHandlerMock.m */, - 96A2D2371CEF3B2D00C39DE0 /* ADJRequestHandlerTests.m */, - 96E5E3A818BBB49E008E7B30 /* ADJTestsUtil.h */, - 96E5E3A918BBB49E008E7B30 /* ADJTestsUtil.m */, - 96E5E3AA18BBB49E008E7B30 /* InfoPlist.strings */, - 96E5E3AC18BBB49E008E7B30 /* NSURLConnection+NSURLConnectionSynchronousLoadingMocking.h */, - 96E5E3AD18BBB49E008E7B30 /* NSURLConnection+NSURLConnectionSynchronousLoadingMocking.m */, - 96ED00371A38A4CD00209110 /* ADJAttributionHandlerMock.h */, - 96ED00381A38A4CD00209110 /* ADJAttributionHandlerMock.m */, - 96ED003C1A38A98C00209110 /* ADJAttributionChangedDelegate.h */, - 96ED003D1A38A98C00209110 /* ADJAttributionChangedDelegate.m */, - 9657BF6E1A3B029000CD6853 /* ADJAttributionHandlerTests.m */, - 9620EA431B062D6F009673F1 /* ADJTestActivityPackage.h */, - 9620EA441B062D6F009673F1 /* ADJTestActivityPackage.m */, - 9620EA4C1B06401B009673F1 /* ADJTest.h */, - 9620EA4D1B06401B009673F1 /* ADJTest.m */, - 9620EA4F1B065177009673F1 /* ADJPackageFields.h */, - 9620EA501B065177009673F1 /* ADJPackageFields.m */, - 96FDD75C1C566C38009C402E /* NSURLSession+NSURLDataWithRequestMocking.h */, - 96FDD75D1C566C38009C402E /* NSURLSession+NSURLDataWithRequestMocking.m */, - 96ED74FD1CD81B3E00C073B8 /* ADJSdkClickHandlerMock.h */, - 96ED74FE1CD81B3E00C073B8 /* ADJSdkClickHandlerMock.m */, - 967D06981CE2272500ECFCE3 /* ADJSessionState.h */, - 967D06991CE2272500ECFCE3 /* ADJSessionState.m */, - 96E7689F1CE6267D005D811C /* ADJDeeplinkDelegate.h */, - 96E768A01CE6267D005D811C /* ADJDeeplinkDelegate.m */, - 96E768A81CE6281F005D811C /* ADJTrackingDelegate.h */, - 96E768A91CE6281F005D811C /* ADJTrackingDelegate.m */, - 96A2D2251CEE0E6200C39DE0 /* ADJSdkClickHandlerTests.m */, - 96FC6E4D1D256B81004482D8 /* ADJActivityHandlerConstructorState.h */, - 96FC6E4E1D256B81004482D8 /* ADJActivityHandlerConstructorState.m */, - 96FC6E561D258272004482D8 /* ADJEndSessionState.h */, - 96FC6E571D258272004482D8 /* ADJEndSessionState.m */, - 9D0C7D3D1D79B3FE009DDF4E /* ADJInitState.h */, - 9D0C7D3E1D79B3FE009DDF4E /* ADJInitState.m */, + 6F084240200776A000568A31 /* AdjustTestApp.xcodeproj */, + 6F0842182007766700568A31 /* AdjustTestLibrary.xcodeproj */, + 6F0841FB2007749C00568A31 /* AdjustUnitTests */, ); path = AdjustTests; sourceTree = ""; @@ -999,8 +1041,7 @@ 9D7431F91EB9F9B700969F14 /* Info.plist */, 9D7431E81EB9F9B700969F14 /* Supporting Files */, ); - name = AdjustExampleTests; - path = ../AdjustExampleTests; + path = AdjustExampleTests; sourceTree = ""; }; 9D7431E81EB9F9B700969F14 /* Supporting Files */ = { @@ -1492,6 +1533,14 @@ ProductGroup = 9D449DCC1E6ED24400E7E80B /* Products */; ProjectRef = 9D449DCB1E6ED24400E7E80B /* AdjustExample-WebView.xcodeproj */; }, + { + ProductGroup = 6F084241200776A000568A31 /* Products */; + ProjectRef = 6F084240200776A000568A31 /* AdjustTestApp.xcodeproj */; + }, + { + ProductGroup = 6F0842192007766700568A31 /* Products */; + ProjectRef = 6F0842182007766700568A31 /* AdjustTestLibrary.xcodeproj */; + }, ); projectRoot = ""; targets = ( @@ -1507,6 +1556,20 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ + 6F08421D2007766800568A31 /* libAdjustTestLibrary.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libAdjustTestLibrary.a; + remoteRef = 6F08421C2007766800568A31 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 6F084245200776A100568A31 /* AdjustTestApp.app */ = { + isa = PBXReferenceProxy; + fileType = wrapper.application; + path = AdjustTestApp.app; + remoteRef = 6F084244200776A100568A31 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 9D449DB21E6ED22900E7E80B /* AdjustExample-iOS.app */ = { isa = PBXReferenceProxy; fileType = wrapper.application; @@ -2026,7 +2089,7 @@ "$(DEVELOPER_FRAMEWORKS_DIR)", ); GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "AdjustTests/Adjust-Prefix.pch"; + GCC_PREFIX_HEADER = "AdjustTests/AdjustUnitTests/Adjust-Prefix.pch"; GCC_WARN_SIGN_COMPARE = YES; ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = "-ObjC"; @@ -2050,7 +2113,7 @@ "$(DEVELOPER_FRAMEWORKS_DIR)", ); GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "AdjustTests/Adjust-Prefix.pch"; + GCC_PREFIX_HEADER = "AdjustTests/AdjustUnitTests/Adjust-Prefix.pch"; GCC_WARN_SIGN_COMPARE = YES; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2068,12 +2131,12 @@ "$(DEVELOPER_FRAMEWORKS_DIR)", ); GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "AdjustTests/Adjust-Prefix.pch"; + GCC_PREFIX_HEADER = "AdjustTests/AdjustUnitTests/Adjust-Prefix.pch"; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); - INFOPLIST_FILE = "AdjustTests/AdjustTests-Info.plist"; + INFOPLIST_FILE = "AdjustTests/AdjustUnitTests/AdjustTests-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 10.3; ONLY_ACTIVE_ARCH = NO; OTHER_CFLAGS = ""; @@ -2092,8 +2155,8 @@ "$(DEVELOPER_FRAMEWORKS_DIR)", ); GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "AdjustTests/Adjust-Prefix.pch"; - INFOPLIST_FILE = "AdjustTests/AdjustTests-Info.plist"; + GCC_PREFIX_HEADER = "AdjustTests/AdjustUnitTests/Adjust-Prefix.pch"; + INFOPLIST_FILE = "AdjustTests/AdjustUnitTests/AdjustTests-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 10.3; OTHER_CFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = "adjust.${PRODUCT_NAME:rfc1034identifier}"; diff --git a/Adjust/ADJActivityHandler.h b/Adjust/ADJActivityHandler.h index 2d75ea28f..c8e1640a1 100644 --- a/Adjust/ADJActivityHandler.h +++ b/Adjust/ADJActivityHandler.h @@ -41,6 +41,7 @@ @property (nonatomic, copy) NSData *deviceTokenData; @property (nonatomic, copy) NSNumber *enabled; @property (nonatomic, assign) BOOL offline; +@property (nonatomic, copy) NSString *basePath; - (id)init; @@ -89,8 +90,10 @@ - (void)removeSessionPartnerParameter:(NSString *)key; - (void)resetSessionCallbackParameters; - (void)resetSessionPartnerParameters; +- (NSString *)getBasePath; -- (void)teardown:(BOOL)deleteState; +- (void)teardown; ++ (void)deleteState; @end @interface ADJActivityHandler : NSObject diff --git a/Adjust/ADJActivityHandler.m b/Adjust/ADJActivityHandler.m index accae7e50..14d919c74 100644 --- a/Adjust/ADJActivityHandler.m +++ b/Adjust/ADJActivityHandler.m @@ -101,6 +101,7 @@ @interface ADJActivityHandler() // copy for objects shared with the user @property (nonatomic, copy) ADJConfig *adjustConfig; @property (nonatomic, copy) NSData* deviceTokenData; +@property (nonatomic, copy) NSString* basePath; @end @@ -188,6 +189,10 @@ - (id)initWithConfig:(ADJConfig *)adjustConfig // does not have the session response by default self.internalState.sessionResponseProcessed = NO; + if (savedPreLaunch.basePath != nil) { + self.basePath = savedPreLaunch.basePath; + } + self.internalQueue = dispatch_queue_create(kInternalQueueName, DISPATCH_QUEUE_SERIAL); [ADJUtil launchInQueue:self.internalQueue selfInject:self @@ -522,7 +527,11 @@ - (void)resetSessionPartnerParameters { }]; } -- (void)teardown:(BOOL)deleteState +- (NSString *)getBasePath { + return _basePath; +} + +- (void)teardown { [ADJAdjustFactory.logger verbose:@"ADJActivityHandler teardown"]; [self removeNotificationObserver]; @@ -539,18 +548,14 @@ - (void)teardown:(BOOL)deleteState [self.attributionHandler teardown]; } if (self.packageHandler != nil) { - [self.packageHandler teardown:deleteState]; + [self.packageHandler teardown]; } if (self.sdkClickHandler != nil) { [self.sdkClickHandler teardown]; } - [self teardownActivityStateS:deleteState]; - [self teardownAttributionS:deleteState]; - [self teardownAllSessionParametersS:deleteState]; - - if (deleteState) { - [ADJUserDefaults clearAdjustStuff]; - } + [self teardownActivityStateS]; + [self teardownAttributionS]; + [self teardownAllSessionParametersS]; [ADJUtil teardown]; @@ -568,6 +573,33 @@ - (void)teardown:(BOOL)deleteState self.logger = nil; } ++ (void)deleteState +{ + [ADJActivityHandler deleteActivityState]; + [ADJActivityHandler deleteAttribution]; + [ADJActivityHandler deleteSessionCallbackParameter]; + [ADJActivityHandler deleteSessionPartnerParameter]; + + [ADJUserDefaults clearAdjustStuff]; +} + ++ (void)deleteActivityState { + [ADJUtil deleteFileWithName:kActivityStateFilename]; +} + ++ (void)deleteAttribution { + [ADJUtil deleteFileWithName:kAttributionFilename]; +} + ++ (void)deleteSessionCallbackParameter { + [ADJUtil deleteFileWithName:kSessionCallbackParametersFilename]; +} + ++ (void)deleteSessionPartnerParameter { + [ADJUtil deleteFileWithName:kSessionPartnerParametersFilename]; +} + + #pragma mark - internal - (void)initI:(ADJActivityHandler *)selfI preLaunchActionsArray:(NSArray*)preLaunchActionsArray @@ -1309,15 +1341,12 @@ - (void)writeActivityStateI:(ADJActivityHandler *)selfI } } -- (void)teardownActivityStateS:(BOOL)deleteState +- (void)teardownActivityStateS { @synchronized ([ADJActivityState class]) { if (self.activityState == nil) { return; } - if (deleteState) { - [ADJUtil deleteFileWithName:kActivityStateFilename]; - } self.activityState = nil; } } @@ -1331,15 +1360,12 @@ - (void)writeAttributionI:(ADJActivityHandler *)selfI { } } -- (void)teardownAttributionS:(BOOL)deleteState +- (void)teardownAttributionS { @synchronized ([ADJAttribution class]) { if (self.attribution == nil) { return; } - if (deleteState) { - [ADJUtil deleteFileWithName:kAttributionFilename]; - } self.attribution = nil; } } @@ -1379,15 +1405,11 @@ - (void)writeSessionPartnerParametersI:(ADJActivityHandler *)selfI { } } -- (void)teardownAllSessionParametersS:(BOOL)deleteState { +- (void)teardownAllSessionParametersS { @synchronized ([ADJSessionParameters class]) { if (self.sessionParameters == nil) { return; } - if (deleteState) { - [ADJUtil deleteFileWithName:kSessionCallbackParametersFilename]; - [ADJUtil deleteFileWithName:kSessionPartnerParametersFilename]; - } [self.sessionParameters.callbackParameters removeAllObjects]; [self.sessionParameters.partnerParameters removeAllObjects]; self.sessionParameters = nil; diff --git a/Adjust/ADJAdditions/UIDevice+ADJAdditions.h b/Adjust/ADJAdditions/UIDevice+ADJAdditions.h index 69353efa7..99427caf2 100644 --- a/Adjust/ADJAdditions/UIDevice+ADJAdditions.h +++ b/Adjust/ADJAdditions/UIDevice+ADJAdditions.h @@ -2,9 +2,10 @@ // UIDevice+ADJAdditions.h // Adjust // -// Created by Christian Wellenbrock on 23.07.12. -// Copyright (c) 2012-2014 adjust GmbH. All rights reserved. +// Created by Christian Wellenbrock (@wellle) on 23rd July 2012. +// Copyright © 2012-2018 Adjust GmbH. All rights reserved. // + #import #import #import "ADJActivityHandler.h" diff --git a/Adjust/ADJAdditions/UIDevice+ADJAdditions.m b/Adjust/ADJAdditions/UIDevice+ADJAdditions.m index a8296e988..bfb63033d 100644 --- a/Adjust/ADJAdditions/UIDevice+ADJAdditions.m +++ b/Adjust/ADJAdditions/UIDevice+ADJAdditions.m @@ -2,8 +2,8 @@ // UIDevice+ADJAdditions.m // Adjust // -// Created by Christian Wellenbrock on 23.07.12. -// Copyright (c) 2012-2014 adjust GmbH. All rights reserved. +// Created by Christian Wellenbrock (@wellle) on 23rd July 2012. +// Copyright © 2012-2018 Adjust GmbH. All rights reserved. // #import "UIDevice+ADJAdditions.h" @@ -27,17 +27,14 @@ - (BOOL)adjTrackingEnabled { #if ADJUST_NO_IDFA return NO; #else - // return [[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]; NSString *className = [NSString adjJoin:@"A", @"S", @"identifier", @"manager", nil]; Class class = NSClassFromString(className); if (class == nil) { return NO; } - #pragma clang diagnostic push #pragma clang diagnostic ignored "-Warc-performSelector-leaks" - NSString *keyManager = [NSString adjJoin:@"shared", @"manager", nil]; SEL selManager = NSSelectorFromString(keyManager); if (![class respondsToSelector:selManager]) { @@ -52,7 +49,6 @@ - (BOOL)adjTrackingEnabled { } BOOL enabled = (BOOL)[manager performSelector:selEnabled]; return enabled; - #pragma clang diagnostic pop #endif } @@ -61,14 +57,12 @@ - (NSString *)adjIdForAdvertisers { #if ADJUST_NO_IDFA return @""; #else - // return [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]; NSString *className = [NSString adjJoin:@"A", @"S", @"identifier", @"manager", nil]; Class class = NSClassFromString(className); if (class == nil) { return @""; } - #pragma clang diagnostic push #pragma clang diagnostic ignored "-Warc-performSelector-leaks" @@ -109,9 +103,7 @@ - (NSString *)adjFbAttributionId { result = @""; } }; - [NSThread isMainThread] ? - resultRetrievalBlock() : - dispatch_sync(dispatch_get_main_queue(), resultRetrievalBlock); + [NSThread isMainThread] ? resultRetrievalBlock() : dispatch_sync(dispatch_get_main_queue(), resultRetrievalBlock); return result; #endif } @@ -148,10 +140,8 @@ - (NSString *)adjVendorId { } - (void)adjSetIad:(ADJActivityHandler *)activityHandler - triesV3Left:(int)triesV3Left -{ + triesV3Left:(int)triesV3Left { id logger = [ADJAdjustFactory logger]; - [logger debug:@"iAd with %d tries to read v3", triesV3Left]; #if ADJUST_NO_IAD || TARGET_OS_TV [logger debug:@"ADJUST_NO_IAD or TARGET_OS_TV set"]; @@ -162,20 +152,25 @@ - (void)adjSetIad:(ADJActivityHandler *)activityHandler // [[ADClient sharedClient] ...] Class ADClientClass = NSClassFromString(@"ADClient"); if (ADClientClass == nil) { + [logger warn:@"iAd framework not found in user's app (ADClientClass not found)"]; return; } #pragma clang diagnostic push #pragma clang diagnostic ignored "-Warc-performSelector-leaks" SEL sharedClientSelector = NSSelectorFromString(@"sharedClient"); if (![ADClientClass respondsToSelector:sharedClientSelector]) { + [logger warn:@"iAd framework not found in user's app (sharedClient method not found)"]; return; } id ADClientSharedClientInstance = [ADClientClass performSelector:sharedClientSelector]; - if (ADClientSharedClientInstance == nil) { + [logger warn:@"iAd framework not found in user's app (ADClientSharedClientInstance is nil)"]; return; } + [logger debug:@"iAd framework successfully found in user's app"]; + [logger debug:@"iAd with %d tries to read v3", triesV3Left]; + // if no tries for iad v3 left, stop trying if (triesV3Left == 0) { [logger warn:@"Reached limit number of retry for iAd v3"]; @@ -183,8 +178,8 @@ - (void)adjSetIad:(ADJActivityHandler *)activityHandler } BOOL isIadV3Avaliable = [self adjSetIadWithDetails:activityHandler - ADClientSharedClientInstance:ADClientSharedClientInstance - retriesLeft:(triesV3Left - 1)]; + ADClientSharedClientInstance:ADClientSharedClientInstance + retriesLeft:(triesV3Left - 1)]; // if iad v3 not available if (!isIadV3Avaliable) { @@ -197,10 +192,8 @@ - (void)adjSetIad:(ADJActivityHandler *)activityHandler - (BOOL)adjSetIadWithDetails:(ADJActivityHandler *)activityHandler ADClientSharedClientInstance:(id)ADClientSharedClientInstance - retriesLeft:(int)retriesLeft -{ + retriesLeft:(int)retriesLeft { SEL iadDetailsSelector = NSSelectorFromString(@"requestAttributionDetailsWithBlock:"); - if (![ADClientSharedClientInstance respondsToSelector:iadDetailsSelector]) { return NO; } diff --git a/Adjust/ADJAdjustFactory.h b/Adjust/ADJAdjustFactory.h index f134db80b..115d33f27 100644 --- a/Adjust/ADJAdjustFactory.h +++ b/Adjust/ADJAdjustFactory.h @@ -39,6 +39,7 @@ startsSending:(BOOL)startsSending; + (BOOL)testing; + (NSTimeInterval)maxDelayStart; ++ (NSString *)baseUrl; + (void)setPackageHandler:(id)packageHandler; + (void)setRequestHandler:(id)requestHandler; @@ -54,6 +55,7 @@ + (void)setSdkClickHandlerBackoffStrategy:(ADJBackoffStrategy *)backoffStrategy; + (void)setTesting:(BOOL)testing; + (void)setMaxDelayStart:(NSTimeInterval)maxDelayStart; ++ (void)setBaseUrl:(NSString *)baseUrl; -+ (void)teardown; ++ (void)teardown:(BOOL)deleteState; @end diff --git a/Adjust/ADJAdjustFactory.m b/Adjust/ADJAdjustFactory.m index 9ba60bef5..b1e734c1b 100644 --- a/Adjust/ADJAdjustFactory.m +++ b/Adjust/ADJAdjustFactory.m @@ -24,6 +24,9 @@ static BOOL internalTesting = NO; static NSTimeInterval internalMaxDelayStart = -1; +static NSString * const kBaseUrl = @"https://app.adjust.com"; +static NSString * internalBaseUrl = @"https://app.adjust.com"; + @implementation ADJAdjustFactory + (id)packageHandlerForActivityHandler:(id)activityHandler @@ -63,7 +66,7 @@ @implementation ADJAdjustFactory } + (double)sessionInterval { - if (internalSessionInterval == -1) { + if (internalSessionInterval < 0) { return 30 * 60; // 30 minutes } return internalSessionInterval; @@ -77,14 +80,14 @@ + (double)subsessionInterval { } + (NSTimeInterval)timerInterval { - if (internalTimerInterval == -1) { + if (internalTimerInterval < 0) { return 60; // 1 minute } return internalTimerInterval; } + (NSTimeInterval)timerStart { - if (intervalTimerStart == -1) { + if (intervalTimerStart < 0) { return 60; // 1 minute } return intervalTimerStart; @@ -134,12 +137,16 @@ + (BOOL)testing { } + (NSTimeInterval)maxDelayStart { - if (internalMaxDelayStart == -1) { + if (internalMaxDelayStart < 0) { return 10.0; // 10 seconds } return internalMaxDelayStart; } ++ (NSString *)baseUrl { + return internalBaseUrl; +} + + (void)setPackageHandler:(id)packageHandler { internalPackageHandler = packageHandler; } @@ -196,7 +203,15 @@ + (void)setMaxDelayStart:(NSTimeInterval)maxDelayStart { internalMaxDelayStart = maxDelayStart; } -+ (void)teardown { ++ (void)setBaseUrl:(NSString *)baseUrl { + internalBaseUrl = baseUrl; +} + ++ (void)teardown:(BOOL)deleteState { + if (deleteState) { + [ADJActivityHandler deleteState]; + [ADJPackageHandler deleteState]; + } internalPackageHandler = nil; internalRequestHandler = nil; internalActivityHandler = nil; @@ -210,6 +225,8 @@ + (void)teardown { intervalTimerStart = -1; packageHandlerBackoffStrategy = nil; sdkClickHandlerBackoffStrategy = nil; + internalTesting = NO; internalMaxDelayStart = -1; + internalBaseUrl = kBaseUrl; } @end diff --git a/Adjust/ADJAttributionHandler.m b/Adjust/ADJAttributionHandler.m index 1a9544c4f..98f309385 100644 --- a/Adjust/ADJAttributionHandler.m +++ b/Adjust/ADJAttributionHandler.m @@ -24,6 +24,7 @@ @interface ADJAttributionHandler() @property (nonatomic, strong) ADJTimerOnce *attributionTimer; @property (nonatomic, strong) ADJActivityPackage * attributionPackage; @property (atomic, assign) BOOL paused; +@property (nonatomic, copy) NSString *basePath; @end @@ -50,6 +51,7 @@ - (id)initWithActivityHandler:(id) activityHandler self.logger = ADJAdjustFactory.logger; self.attributionPackage = attributionPackage; self.paused = !startsSending; + self.basePath = [activityHandler getBasePath]; __weak __typeof__(self) weakSelf = self; self.attributionTimer = [ADJTimerOnce timerWithBlock:^{ __typeof__(self) strongSelf = weakSelf; @@ -182,7 +184,10 @@ - (void)requestAttributionI:(ADJAttributionHandler*)selfI { } [selfI.logger verbose:@"%@", selfI.attributionPackage.extendedString]; - [ADJUtil sendGetRequest:[NSURL URLWithString:ADJUtil.baseUrl] + NSURL * baseUrl = [NSURL URLWithString:[ADJAdjustFactory baseUrl]]; + + [ADJUtil sendGetRequest:baseUrl + basePath:selfI.basePath prefixErrorMessage:@"Failed to get attribution" activityPackage:selfI.attributionPackage responseDataHandler:^(ADJResponseData * responseData) diff --git a/Adjust/ADJPackageHandler.h b/Adjust/ADJPackageHandler.h index a18d6c206..66c3b871a 100644 --- a/Adjust/ADJPackageHandler.h +++ b/Adjust/ADJPackageHandler.h @@ -26,7 +26,10 @@ - (void)pauseSending; - (void)resumeSending; - (void)updatePackages:(ADJSessionParameters *)sessionParameters; -- (void)teardown:(BOOL)deleteState; +- (NSString *)getBasePath; + +- (void)teardown; ++ (void)deleteState; @end @interface ADJPackageHandler : NSObject diff --git a/Adjust/ADJPackageHandler.m b/Adjust/ADJPackageHandler.m index d7e163cdb..6d6f2c49f 100644 --- a/Adjust/ADJPackageHandler.m +++ b/Adjust/ADJPackageHandler.m @@ -29,6 +29,7 @@ @interface ADJPackageHandler() @property (nonatomic, assign) BOOL paused; @property (nonatomic, weak) id activityHandler; @property (nonatomic, weak) id logger; +@property (nonatomic, copy) NSString *basePath; @end @@ -49,6 +50,7 @@ - (id)initWithActivityHandler:(id)activityHandler self.internalQueue = dispatch_queue_create(kInternalQueueName, DISPATCH_QUEUE_SERIAL); self.backoffStrategy = [ADJAdjustFactory packageHandlerBackoffStrategy]; + self.basePath = [activityHandler getBasePath]; [ADJUtil launchInQueue:self.internalQueue selfInject:self @@ -133,7 +135,11 @@ - (void)updatePackages:(ADJSessionParameters *)sessionParameters }]; } -- (void)teardown:(BOOL)deleteState { +- (NSString *)getBasePath { + return _basePath; +} + +- (void)teardown { [ADJAdjustFactory.logger verbose:@"ADJPackageHandler teardown"]; if (self.sendingSemaphore != nil) { dispatch_semaphore_signal(self.sendingSemaphore); @@ -141,7 +147,7 @@ - (void)teardown:(BOOL)deleteState { if (self.requestHandler != nil) { [self.requestHandler teardown]; } - [self teardownPackageQueueS:deleteState]; + [self teardownPackageQueueS]; self.internalQueue = nil; self.sendingSemaphore = nil; self.requestHandler = nil; @@ -150,6 +156,14 @@ - (void)teardown:(BOOL)deleteState { self.logger = nil; } ++ (void)deleteState { + [ADJPackageHandler deletePackageQueue]; +} + ++ (void)deletePackageQueue { + [ADJUtil deleteFileWithName:kPackageQueueFilename]; +} + #pragma mark - internal - (void)initI:(ADJPackageHandler *)selfI activityHandler:(id)activityHandler @@ -259,16 +273,12 @@ - (void)writePackageQueueS:(ADJPackageHandler *)selfS { } } -- (void)teardownPackageQueueS:(BOOL)deleteState { +- (void)teardownPackageQueueS { @synchronized ([ADJPackageHandler class]) { if (self.packageQueue == nil) { return; } - if (deleteState) { - [ADJUtil deleteFileWithName:kPackageQueueFilename]; - } - [self.packageQueue removeAllObjects]; self.packageQueue = nil; } diff --git a/Adjust/ADJRequestHandler.m b/Adjust/ADJRequestHandler.m index 80b6ff1e1..30834ca6c 100644 --- a/Adjust/ADJRequestHandler.m +++ b/Adjust/ADJRequestHandler.m @@ -18,14 +18,14 @@ @interface ADJRequestHandler() -@property (nonatomic, strong) NSURL *baseUrl; - @property (nonatomic, strong) dispatch_queue_t internalQueue; @property (nonatomic, weak) id logger; @property (nonatomic, weak) id packageHandler; +@property (nonatomic, copy) NSString *basePath; + @end @implementation ADJRequestHandler @@ -46,8 +46,8 @@ - (id)initWithPackageHandler:(id)packageHandler { self.internalQueue = dispatch_queue_create(kInternalQueueName, DISPATCH_QUEUE_SERIAL); self.packageHandler = packageHandler; self.logger = ADJAdjustFactory.logger; - self.baseUrl = [NSURL URLWithString:ADJUtil.baseUrl]; - + self.basePath = [packageHandler getBasePath]; + return self; } @@ -63,7 +63,6 @@ - (void)teardown { [ADJAdjustFactory.logger verbose:@"ADJRequestHandler teardown"]; self.logger = nil; - self.baseUrl = nil; self.internalQueue = nil; self.packageHandler = nil; } @@ -71,7 +70,15 @@ - (void)teardown { #pragma mark - Private & helper methods - (void)sendI:(ADJRequestHandler *)selfI activityPackage:(ADJActivityPackage *)activityPackage queueSize:(NSUInteger)queueSize { - [ADJUtil sendPostRequest:selfI.baseUrl + NSURL *url; + NSString * baseUrl = [ADJAdjustFactory baseUrl]; + if (selfI.basePath != nil) { + url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", baseUrl, selfI.basePath]]; + } else { + url = [NSURL URLWithString:baseUrl]; + } + + [ADJUtil sendPostRequest:url queueSize:queueSize prefixErrorMessage:activityPackage.failureMessage suffixErrorMessage:@"Will retry later" diff --git a/Adjust/ADJSdkClickHandler.m b/Adjust/ADJSdkClickHandler.m index de38bd59f..8781c9063 100644 --- a/Adjust/ADJSdkClickHandler.m +++ b/Adjust/ADJSdkClickHandler.m @@ -22,8 +22,8 @@ @interface ADJSdkClickHandler() @property (nonatomic, strong) ADJBackoffStrategy * backoffStrategy; @property (nonatomic, assign) BOOL paused; @property (nonatomic, strong) NSMutableArray *packageQueue; -@property (nonatomic, strong) NSURL *baseUrl; @property (nonatomic, weak) id activityHandler; +@property (nonatomic, copy) NSString *basePath; @end @@ -45,6 +45,7 @@ - (id)initWithActivityHandler:(id)activityHandler self.internalQueue = dispatch_queue_create(kInternalQueueName, DISPATCH_QUEUE_SERIAL); self.logger = ADJAdjustFactory.logger; + self.basePath = [activityHandler getBasePath]; [ADJUtil launchInQueue:self.internalQueue selfInject:self @@ -91,7 +92,6 @@ - (void)teardown { self.logger = nil; self.backoffStrategy = nil; self.packageQueue = nil; - self.baseUrl = nil; self.activityHandler = nil; } @@ -104,7 +104,6 @@ - (void)initI:(ADJSdkClickHandler *)selfI selfI.paused = !startsSending; selfI.backoffStrategy = [ADJAdjustFactory sdkClickHandlerBackoffStrategy]; selfI.packageQueue = [NSMutableArray array]; - selfI.baseUrl = [NSURL URLWithString:ADJUtil.baseUrl]; } - (void)sendSdkClickI:(ADJSdkClickHandler *)selfI @@ -135,8 +134,16 @@ - (void)sendNextSdkClickI:(ADJSdkClickHandler *)selfI return; } + NSURL *url; + NSString * baseUrl = [ADJAdjustFactory baseUrl]; + if (selfI.basePath != nil) { + url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", baseUrl, selfI.basePath]]; + } else { + url = [NSURL URLWithString:baseUrl]; + } + dispatch_block_t work = ^{ - [ADJUtil sendPostRequest:selfI.baseUrl + [ADJUtil sendPostRequest:url queueSize:queueSize - 1 prefixErrorMessage:sdkClickPackage.failureMessage suffixErrorMessage:@"Will retry later" diff --git a/Adjust/ADJUtil.h b/Adjust/ADJUtil.h index f1358867a..131c6e43c 100644 --- a/Adjust/ADJUtil.h +++ b/Adjust/ADJUtil.h @@ -46,6 +46,7 @@ typedef void (^selfInjectedBlock)(id); block:(selfInjectedBlock)block; + (void)sendGetRequest:(NSURL *)baseUrl + basePath:(NSString *)basePath prefixErrorMessage:(NSString *)prefixErrorMessage activityPackage:(ADJActivityPackage *)activityPackage responseDataHandler:(void (^)(ADJResponseData *responseData))responseDataHandler; @@ -59,8 +60,6 @@ typedef void (^selfInjectedBlock)(id); + (NSString *)idfa; -+ (NSString *)baseUrl; - + (NSString *)clientSdk; + (NSString *)getUpdateTime; diff --git a/Adjust/ADJUtil.m b/Adjust/ADJUtil.m index 654fb05a0..2f38d2c24 100644 --- a/Adjust/ADJUtil.m +++ b/Adjust/ADJUtil.m @@ -41,15 +41,13 @@ static NSString *userAgent = nil; -static NSString * const kClientSdk = @"ios4.12.1"; +static NSString * const kClientSdk = @"ios4.12.2"; static NSString * const kDeeplinkParam = @"deep_link="; static NSString * const kSchemeDelimiter = @"://"; static NSString * const kDefaultScheme = @"AdjustUniversalScheme"; static NSString * const kUniversalLinkPattern = @"https://[^.]*\\.ulink\\.adjust\\.com/ulink/?(.*)"; static NSString * const kOptionalRedirectPattern = @"adjust_redirect=[^&#]*"; static NSString * const kShortUniversalLinkPattern = @"http[s]?://[a-z0-9]{4}\\.adj\\.st/?(.*)"; - -static NSString * const kBaseUrl = @"https://app.adjust.com"; static NSString * const kDateFormat = @"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'Z"; @implementation ADJUtil @@ -162,10 +160,6 @@ + (void)updateUrlSessionConfiguration:(ADJConfig *)config { userAgent = config.userAgent; } -+ (NSString *)baseUrl { - return kBaseUrl; -} - + (NSString *)clientSdk { return kClientSdk; } @@ -377,7 +371,7 @@ + (void)writeObject:(id)object objectName:(NSString *)objectName { NSString *filePath = [ADJUtil getFilePathInAppSupportDir:fileName]; - BOOL result = [NSKeyedArchiver archiveRootObject:object toFile:filePath]; + BOOL result = (filePath != nil) && [NSKeyedArchiver archiveRootObject:object toFile:filePath]; if (result == YES) { [ADJUtil excludeFromBackup:filePath]; @@ -522,6 +516,7 @@ + (NSString *)formatErrorMessage:(NSString *)prefixErrorMessage } + (void)sendGetRequest:(NSURL *)baseUrl + basePath:(NSString *)basePath prefixErrorMessage:(NSString *)prefixErrorMessage activityPackage:(ADJActivityPackage *)activityPackage responseDataHandler:(void (^)(ADJResponseData *responseData))responseDataHandler { @@ -529,7 +524,7 @@ + (void)sendGetRequest:(NSURL *)baseUrl NSString *appSecret = [ADJUtil extractAppSecret:activityPackage]; NSString *secretId = [ADJUtil extractSecretId:activityPackage]; - NSMutableURLRequest *request = [ADJUtil requestForGetPackage:activityPackage baseUrl:baseUrl]; + NSMutableURLRequest *request = [ADJUtil requestForGetPackage:activityPackage baseUrl:baseUrl basePath:basePath]; [ADJUtil sendRequest:request prefixErrorMessage:prefixErrorMessage @@ -636,9 +631,16 @@ + (NSString *)extractSecretId:(ADJActivityPackage *)activityPackage { } + (NSMutableURLRequest *)requestForGetPackage:(ADJActivityPackage *)activityPackage - baseUrl:(NSURL *)baseUrl{ + baseUrl:(NSURL *)baseUrl + basePath:(NSString *)basePath +{ NSString *parameters = [ADJUtil queryString:activityPackage.parameters]; - NSString *relativePath = [NSString stringWithFormat:@"%@?%@", activityPackage.path, parameters]; + NSString *relativePath; + if (basePath != nil) { + relativePath = [NSString stringWithFormat:@"%@%@?%@", basePath, activityPackage.path, parameters]; + } else { + relativePath = [NSString stringWithFormat:@"%@?%@", activityPackage.path, parameters]; + } NSURL *url = [NSURL URLWithString:relativePath relativeToURL:baseUrl]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; @@ -653,11 +655,10 @@ + (NSMutableURLRequest *)requestForGetPackage:(ADJActivityPackage *)activityPack + (NSMutableURLRequest *)requestForPostPackage:(ADJActivityPackage *)activityPackage baseUrl:(NSURL *)baseUrl queueSize:(NSUInteger)queueSize { - NSURL *url = [NSURL URLWithString:activityPackage.path relativeToURL:baseUrl]; + NSURL *url = [baseUrl URLByAppendingPathComponent:activityPackage.path]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; request.timeoutInterval = kRequestTimeout; request.HTTPMethod = @"POST"; - [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; [request setValue:activityPackage.clientSdk forHTTPHeaderField:@"Client-Sdk"]; @@ -1208,6 +1209,9 @@ + (NSDictionary *)mergeParameters:(NSDictionary *)target + (void)launchInQueue:(dispatch_queue_t)queue selfInject:(id)selfInject block:(selfInjectedBlock)block { + if (queue == nil) { + return; + } __weak __typeof__(selfInject) weakSelf = selfInject; dispatch_async(queue, ^{ diff --git a/Adjust/Adjust.h b/Adjust/Adjust.h index f618a880b..f9e9101dd 100644 --- a/Adjust/Adjust.h +++ b/Adjust/Adjust.h @@ -2,7 +2,7 @@ // Adjust.h // Adjust // -// V4.12.1 +// V4.12.2 // Created by Christian Wellenbrock (wellle) on 23rd July 2013. // Copyright © 2012-2017 Adjust GmbH. All rights reserved. // @@ -11,6 +11,19 @@ #import "ADJConfig.h" #import "ADJAttribution.h" +@interface AdjustTestOptions : NSObject + +@property (nonatomic, copy, nullable) NSString *baseUrl; +@property (nonatomic, copy, nullable) NSString *basePath; +@property (nonatomic, copy, nullable) NSNumber *timerIntervalInMilliseconds; +@property (nonatomic, copy, nullable) NSNumber *timerStartInMilliseconds; +@property (nonatomic, copy, nullable) NSNumber *sessionIntervalInMilliseconds; +@property (nonatomic, copy, nullable) NSNumber *subsessionIntervalInMilliseconds; +@property (nonatomic, assign) BOOL teardown; +@property (nonatomic, assign) BOOL deleteState; + +@end + /** * Constants for our supported tracking environments */ @@ -197,6 +210,7 @@ extern NSString * __nonnull const ADJEnvironmentProduction; */ + (nullable id)getInstance; ++ (void)setTestOptions:(nullable AdjustTestOptions *)testOptions; - (void)appDidLaunch:(nullable ADJConfig *)adjustConfig; @@ -204,7 +218,7 @@ extern NSString * __nonnull const ADJEnvironmentProduction; - (void)setEnabled:(BOOL)enabled; -- (void)teardown:(BOOL)deleteState; +- (void)teardown; - (void)appWillOpenUrl:(nonnull NSURL *)url; diff --git a/Adjust/Adjust.m b/Adjust/Adjust.m index 750b937df..9a4fddaca 100644 --- a/Adjust/Adjust.m +++ b/Adjust/Adjust.m @@ -21,6 +21,9 @@ NSString * const ADJEnvironmentSandbox = @"sandbox"; NSString * const ADJEnvironmentProduction = @"production"; +@implementation AdjustTestOptions +@end + @interface Adjust() @property (nonatomic, weak) id logger; @@ -35,10 +38,10 @@ @implementation Adjust #pragma mark - Object lifecycle methods -+ (id)getInstance { - static Adjust *defaultInstance = nil; - static dispatch_once_t onceToken; +static Adjust *defaultInstance = nil; +static dispatch_once_t onceToken = 0; ++ (id)getInstance { dispatch_once(&onceToken, ^{ defaultInstance = [[self alloc] init]; }); @@ -149,6 +152,18 @@ + (NSString *)adid { return [[Adjust getInstance] adid]; } ++ (void)setTestOptions:(AdjustTestOptions *)testOptions { + if (testOptions.teardown) { + if (defaultInstance != nil) { + [defaultInstance teardown]; + } + defaultInstance = nil; + onceToken = 0; + [ADJAdjustFactory teardown:testOptions.deleteState]; + } + [[Adjust getInstance] setTestOptions:(AdjustTestOptions *)testOptions]; +} + #pragma mark - Public instance methods - (void)appDidLaunch:(ADJConfig *)adjustConfig { @@ -353,16 +368,41 @@ - (NSString *)adid { return [self.activityHandler adid]; } -- (void)teardown:(BOOL)deleteState { +- (void)teardown { if (self.activityHandler == nil) { [self.logger error:@"Adjust already down or not initialized"]; return; } - [self.activityHandler teardown:deleteState]; + [self.activityHandler teardown]; self.activityHandler = nil; } +- (void)setTestOptions:(AdjustTestOptions *)testOptions { + if (testOptions.basePath != nil) { + self.savedPreLaunch.basePath = testOptions.basePath; + } + if (testOptions.baseUrl != nil) { + [ADJAdjustFactory setBaseUrl:testOptions.baseUrl]; + } + if (testOptions.timerIntervalInMilliseconds != nil) { + NSTimeInterval timerIntervalInSeconds = [testOptions.timerIntervalInMilliseconds intValue] / 1000.0; + [ADJAdjustFactory setTimerInterval:timerIntervalInSeconds]; + } + if (testOptions.timerStartInMilliseconds != nil) { + NSTimeInterval timerStartInSeconds = [testOptions.timerStartInMilliseconds intValue] / 1000.0; + [ADJAdjustFactory setTimerStart:timerStartInSeconds]; + } + if (testOptions.sessionIntervalInMilliseconds != nil) { + NSTimeInterval sessionIntervalInSeconds = [testOptions.sessionIntervalInMilliseconds intValue] / 1000.0; + [ADJAdjustFactory setSessionInterval:sessionIntervalInSeconds]; + } + if (testOptions.subsessionIntervalInMilliseconds != nil) { + NSTimeInterval subsessionIntervalInSeconds = [testOptions.subsessionIntervalInMilliseconds intValue] / 1000.0; + [ADJAdjustFactory setSubsessionInterval:subsessionIntervalInSeconds]; + } +} + #pragma mark - Private & helper methods - (BOOL)checkActivityHandler { diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp.xcodeproj/project.pbxproj b/AdjustTests/AdjustTestApp/AdjustTestApp.xcodeproj/project.pbxproj new file mode 100644 index 000000000..377e1b18c --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp.xcodeproj/project.pbxproj @@ -0,0 +1,645 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 48; + objects = { + +/* Begin PBXBuildFile section */ + 6F08422C2007769F00568A31 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F08422B2007769F00568A31 /* AppDelegate.m */; }; + 6F08422F2007769F00568A31 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F08422E2007769F00568A31 /* ViewController.m */; }; + 6F0842322007769F00568A31 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6F0842302007769F00568A31 /* Main.storyboard */; }; + 6F0842342007769F00568A31 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6F0842332007769F00568A31 /* Assets.xcassets */; }; + 6F084237200776A000568A31 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6F084235200776A000568A31 /* LaunchScreen.storyboard */; }; + 6F08423A200776A000568A31 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F084239200776A000568A31 /* main.m */; }; + 6F3A5E6E2018CE14000AACD0 /* ADJDeviceInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E2B2018CE14000AACD0 /* ADJDeviceInfo.m */; }; + 6F3A5E6F2018CE14000AACD0 /* ADJTimerOnce.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E2C2018CE14000AACD0 /* ADJTimerOnce.m */; }; + 6F3A5E702018CE14000AACD0 /* ADJAttributionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E2D2018CE14000AACD0 /* ADJAttributionHandler.m */; }; + 6F3A5E712018CE14000AACD0 /* ADJRequestHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E302018CE14000AACD0 /* ADJRequestHandler.m */; }; + 6F3A5E722018CE14000AACD0 /* ADJKeychain.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E332018CE14000AACD0 /* ADJKeychain.m */; }; + 6F3A5E732018CE14000AACD0 /* ADJSdkClickHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E342018CE14000AACD0 /* ADJSdkClickHandler.m */; }; + 6F3A5E742018CE14000AACD0 /* ADJEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E362018CE14000AACD0 /* ADJEvent.m */; }; + 6F3A5E752018CE14000AACD0 /* ADJSessionSuccess.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E3A2018CE14000AACD0 /* ADJSessionSuccess.m */; }; + 6F3A5E762018CE14000AACD0 /* ADJEventFailure.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E3B2018CE14000AACD0 /* ADJEventFailure.m */; }; + 6F3A5E772018CE14000AACD0 /* ADJEventSuccess.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E3D2018CE14000AACD0 /* ADJEventSuccess.m */; }; + 6F3A5E782018CE14000AACD0 /* ADJActivityState.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E3E2018CE14000AACD0 /* ADJActivityState.m */; }; + 6F3A5E792018CE14000AACD0 /* ADJSessionFailure.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E3F2018CE14000AACD0 /* ADJSessionFailure.m */; }; + 6F3A5E7A2018CE14000AACD0 /* ADJTimerCycle.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E432018CE14000AACD0 /* ADJTimerCycle.m */; }; + 6F3A5E7B2018CE14000AACD0 /* ADJSessionParameters.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E442018CE14000AACD0 /* ADJSessionParameters.m */; }; + 6F3A5E7C2018CE14000AACD0 /* ADJLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E452018CE14000AACD0 /* ADJLogger.m */; }; + 6F3A5E7D2018CE14000AACD0 /* ADJBackoffStrategy.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E462018CE14000AACD0 /* ADJBackoffStrategy.m */; }; + 6F3A5E7E2018CE14000AACD0 /* Adjust.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E482018CE14000AACD0 /* Adjust.m */; }; + 6F3A5E7F2018CE14000AACD0 /* ADJConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E4C2018CE14000AACD0 /* ADJConfig.m */; }; + 6F3A5E802018CE14000AACD0 /* ADJPackageHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E4D2018CE14000AACD0 /* ADJPackageHandler.m */; }; + 6F3A5E812018CE14000AACD0 /* ADJActivityKind.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E502018CE14000AACD0 /* ADJActivityKind.m */; }; + 6F3A5E822018CE14000AACD0 /* NSString+ADJAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E532018CE14000AACD0 /* NSString+ADJAdditions.m */; }; + 6F3A5E832018CE14000AACD0 /* NSData+ADJAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E552018CE14000AACD0 /* NSData+ADJAdditions.m */; }; + 6F3A5E842018CE14000AACD0 /* UIDevice+ADJAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E572018CE14000AACD0 /* UIDevice+ADJAdditions.m */; }; + 6F3A5E852018CE14000AACD0 /* ADJAttribution.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E592018CE14000AACD0 /* ADJAttribution.m */; }; + 6F3A5E862018CE14000AACD0 /* ADJSystemProfile.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E5A2018CE14000AACD0 /* ADJSystemProfile.m */; }; + 6F3A5E872018CE14000AACD0 /* ADJActivityPackage.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E5C2018CE14000AACD0 /* ADJActivityPackage.m */; }; + 6F3A5E882018CE14000AACD0 /* ADJUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E5D2018CE14000AACD0 /* ADJUtil.m */; }; + 6F3A5E892018CE14000AACD0 /* ADJAdjustFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E602018CE14000AACD0 /* ADJAdjustFactory.m */; }; + 6F3A5E8A2018CE14000AACD0 /* ADJResponseData.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E632018CE14000AACD0 /* ADJResponseData.m */; }; + 6F3A5E8B2018CE14000AACD0 /* ADJPackageBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E652018CE14000AACD0 /* ADJPackageBuilder.m */; }; + 6F3A5E8C2018CE14000AACD0 /* ADJUserDefaults.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E662018CE14000AACD0 /* ADJUserDefaults.m */; }; + 6F3A5E8D2018CE14000AACD0 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6F3A5E6A2018CE14000AACD0 /* Info.plist */; }; + 6F3A5E8E2018CE14000AACD0 /* ADJActivityHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E6C2018CE14000AACD0 /* ADJActivityHandler.m */; }; + 6F3A5E8F2018CE14000AACD0 /* ADJReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E6D2018CE14000AACD0 /* ADJReachability.m */; }; + 6F3A5E9E2018CE3A000AACD0 /* ATLTestInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E912018CE3A000AACD0 /* ATLTestInfo.m */; }; + 6F3A5E9F2018CE3A000AACD0 /* ATLUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E982018CE3A000AACD0 /* ATLUtil.m */; }; + 6F3A5EA02018CE3A000AACD0 /* ATLControlChannel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E9A2018CE3A000AACD0 /* ATLControlChannel.m */; }; + 6F3A5EA12018CE3A000AACD0 /* ATLUtilNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E9B2018CE3A000AACD0 /* ATLUtilNetworking.m */; }; + 6F3A5EA22018CE3A000AACD0 /* ATLTestLibrary.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E9C2018CE3A000AACD0 /* ATLTestLibrary.m */; }; + 6F3A5EA32018CE3A000AACD0 /* ATLBlockingQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F3A5E9D2018CE3A000AACD0 /* ATLBlockingQueue.m */; }; + 6FFCFE5F2007978300467F01 /* ATAAdjustCommandExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 6FFCFE5D2007978300467F01 /* ATAAdjustCommandExecutor.m */; }; + 6FFCFE6D200797D100467F01 /* ATAAdjustDelegateAttribution.m in Sources */ = {isa = PBXBuildFile; fileRef = 6FFCFE61200797D000467F01 /* ATAAdjustDelegateAttribution.m */; }; + 6FFCFE6E200797D100467F01 /* ATAAdjustDelegateEventFailure.m in Sources */ = {isa = PBXBuildFile; fileRef = 6FFCFE63200797D000467F01 /* ATAAdjustDelegateEventFailure.m */; }; + 6FFCFE6F200797D100467F01 /* ATAAdjustDelegateSessionFailure.m in Sources */ = {isa = PBXBuildFile; fileRef = 6FFCFE65200797D000467F01 /* ATAAdjustDelegateSessionFailure.m */; }; + 6FFCFE70200797D100467F01 /* ATAAdjustDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6FFCFE66200797D000467F01 /* ATAAdjustDelegate.m */; }; + 6FFCFE71200797D100467F01 /* ATAAdjustDelegateEventSuccess.m in Sources */ = {isa = PBXBuildFile; fileRef = 6FFCFE69200797D000467F01 /* ATAAdjustDelegateEventSuccess.m */; }; + 6FFCFE72200797D100467F01 /* ATAAdjustDelegateSessionSuccess.m in Sources */ = {isa = PBXBuildFile; fileRef = 6FFCFE6A200797D000467F01 /* ATAAdjustDelegateSessionSuccess.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 6F0842272007769F00568A31 /* AdjustTestApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AdjustTestApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 6F08422A2007769F00568A31 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 6F08422B2007769F00568A31 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 6F08422D2007769F00568A31 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 6F08422E2007769F00568A31 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 6F0842312007769F00568A31 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 6F0842332007769F00568A31 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 6F084236200776A000568A31 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 6F084238200776A000568A31 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 6F084239200776A000568A31 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 6F3A5E2A2018CE14000AACD0 /* ADJConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJConfig.h; sourceTree = ""; }; + 6F3A5E2B2018CE14000AACD0 /* ADJDeviceInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJDeviceInfo.m; sourceTree = ""; }; + 6F3A5E2C2018CE14000AACD0 /* ADJTimerOnce.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJTimerOnce.m; sourceTree = ""; }; + 6F3A5E2D2018CE14000AACD0 /* ADJAttributionHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJAttributionHandler.m; sourceTree = ""; }; + 6F3A5E2E2018CE14000AACD0 /* Adjust.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Adjust.h; sourceTree = ""; }; + 6F3A5E2F2018CE14000AACD0 /* ADJActivityPackage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJActivityPackage.h; sourceTree = ""; }; + 6F3A5E302018CE14000AACD0 /* ADJRequestHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJRequestHandler.m; sourceTree = ""; }; + 6F3A5E312018CE14000AACD0 /* ADJSystemProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJSystemProfile.h; sourceTree = ""; }; + 6F3A5E322018CE14000AACD0 /* ADJAttribution.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJAttribution.h; sourceTree = ""; }; + 6F3A5E332018CE14000AACD0 /* ADJKeychain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJKeychain.m; sourceTree = ""; }; + 6F3A5E342018CE14000AACD0 /* ADJSdkClickHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJSdkClickHandler.m; sourceTree = ""; }; + 6F3A5E352018CE14000AACD0 /* ADJActivityKind.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJActivityKind.h; sourceTree = ""; }; + 6F3A5E362018CE14000AACD0 /* ADJEvent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJEvent.m; sourceTree = ""; }; + 6F3A5E372018CE14000AACD0 /* ADJPackageHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJPackageHandler.h; sourceTree = ""; }; + 6F3A5E382018CE14000AACD0 /* ADJPackageBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJPackageBuilder.h; sourceTree = ""; }; + 6F3A5E392018CE14000AACD0 /* ADJResponseData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJResponseData.h; sourceTree = ""; }; + 6F3A5E3A2018CE14000AACD0 /* ADJSessionSuccess.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJSessionSuccess.m; sourceTree = ""; }; + 6F3A5E3B2018CE14000AACD0 /* ADJEventFailure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJEventFailure.m; sourceTree = ""; }; + 6F3A5E3C2018CE14000AACD0 /* ADJAdjustFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJAdjustFactory.h; sourceTree = ""; }; + 6F3A5E3D2018CE14000AACD0 /* ADJEventSuccess.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJEventSuccess.m; sourceTree = ""; }; + 6F3A5E3E2018CE14000AACD0 /* ADJActivityState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJActivityState.m; sourceTree = ""; }; + 6F3A5E3F2018CE14000AACD0 /* ADJSessionFailure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJSessionFailure.m; sourceTree = ""; }; + 6F3A5E402018CE14000AACD0 /* ADJUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJUtil.h; sourceTree = ""; }; + 6F3A5E412018CE14000AACD0 /* ADJReachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJReachability.h; sourceTree = ""; }; + 6F3A5E422018CE14000AACD0 /* ADJActivityHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJActivityHandler.h; sourceTree = ""; }; + 6F3A5E432018CE14000AACD0 /* ADJTimerCycle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJTimerCycle.m; sourceTree = ""; }; + 6F3A5E442018CE14000AACD0 /* ADJSessionParameters.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJSessionParameters.m; sourceTree = ""; }; + 6F3A5E452018CE14000AACD0 /* ADJLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJLogger.m; sourceTree = ""; }; + 6F3A5E462018CE14000AACD0 /* ADJBackoffStrategy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJBackoffStrategy.m; sourceTree = ""; }; + 6F3A5E472018CE14000AACD0 /* ADJUserDefaults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJUserDefaults.h; sourceTree = ""; }; + 6F3A5E482018CE14000AACD0 /* Adjust.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Adjust.m; sourceTree = ""; }; + 6F3A5E492018CE14000AACD0 /* ADJAttributionHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJAttributionHandler.h; sourceTree = ""; }; + 6F3A5E4A2018CE14000AACD0 /* ADJTimerOnce.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJTimerOnce.h; sourceTree = ""; }; + 6F3A5E4B2018CE14000AACD0 /* ADJDeviceInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJDeviceInfo.h; sourceTree = ""; }; + 6F3A5E4C2018CE14000AACD0 /* ADJConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJConfig.m; sourceTree = ""; }; + 6F3A5E4D2018CE14000AACD0 /* ADJPackageHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJPackageHandler.m; sourceTree = ""; }; + 6F3A5E4E2018CE14000AACD0 /* ADJEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJEvent.h; sourceTree = ""; }; + 6F3A5E4F2018CE14000AACD0 /* ADJSdkClickHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJSdkClickHandler.h; sourceTree = ""; }; + 6F3A5E502018CE14000AACD0 /* ADJActivityKind.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJActivityKind.m; sourceTree = ""; }; + 6F3A5E512018CE14000AACD0 /* ADJKeychain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJKeychain.h; sourceTree = ""; }; + 6F3A5E532018CE14000AACD0 /* NSString+ADJAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+ADJAdditions.m"; sourceTree = ""; }; + 6F3A5E542018CE14000AACD0 /* UIDevice+ADJAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIDevice+ADJAdditions.h"; sourceTree = ""; }; + 6F3A5E552018CE14000AACD0 /* NSData+ADJAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+ADJAdditions.m"; sourceTree = ""; }; + 6F3A5E562018CE14000AACD0 /* NSData+ADJAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+ADJAdditions.h"; sourceTree = ""; }; + 6F3A5E572018CE14000AACD0 /* UIDevice+ADJAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIDevice+ADJAdditions.m"; sourceTree = ""; }; + 6F3A5E582018CE14000AACD0 /* NSString+ADJAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+ADJAdditions.h"; sourceTree = ""; }; + 6F3A5E592018CE14000AACD0 /* ADJAttribution.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJAttribution.m; sourceTree = ""; }; + 6F3A5E5A2018CE14000AACD0 /* ADJSystemProfile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJSystemProfile.m; sourceTree = ""; }; + 6F3A5E5B2018CE14000AACD0 /* ADJRequestHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJRequestHandler.h; sourceTree = ""; }; + 6F3A5E5C2018CE14000AACD0 /* ADJActivityPackage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJActivityPackage.m; sourceTree = ""; }; + 6F3A5E5D2018CE14000AACD0 /* ADJUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJUtil.m; sourceTree = ""; }; + 6F3A5E5E2018CE14000AACD0 /* ADJSessionFailure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJSessionFailure.h; sourceTree = ""; }; + 6F3A5E5F2018CE14000AACD0 /* ADJActivityState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJActivityState.h; sourceTree = ""; }; + 6F3A5E602018CE14000AACD0 /* ADJAdjustFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJAdjustFactory.m; sourceTree = ""; }; + 6F3A5E612018CE14000AACD0 /* ADJEventSuccess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJEventSuccess.h; sourceTree = ""; }; + 6F3A5E622018CE14000AACD0 /* ADJEventFailure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJEventFailure.h; sourceTree = ""; }; + 6F3A5E632018CE14000AACD0 /* ADJResponseData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJResponseData.m; sourceTree = ""; }; + 6F3A5E642018CE14000AACD0 /* ADJSessionSuccess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJSessionSuccess.h; sourceTree = ""; }; + 6F3A5E652018CE14000AACD0 /* ADJPackageBuilder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJPackageBuilder.m; sourceTree = ""; }; + 6F3A5E662018CE14000AACD0 /* ADJUserDefaults.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJUserDefaults.m; sourceTree = ""; }; + 6F3A5E672018CE14000AACD0 /* ADJBackoffStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJBackoffStrategy.h; sourceTree = ""; }; + 6F3A5E682018CE14000AACD0 /* ADJLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJLogger.h; sourceTree = ""; }; + 6F3A5E692018CE14000AACD0 /* ADJSessionParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJSessionParameters.h; sourceTree = ""; }; + 6F3A5E6A2018CE14000AACD0 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 6F3A5E6B2018CE14000AACD0 /* ADJTimerCycle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADJTimerCycle.h; sourceTree = ""; }; + 6F3A5E6C2018CE14000AACD0 /* ADJActivityHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJActivityHandler.m; sourceTree = ""; }; + 6F3A5E6D2018CE14000AACD0 /* ADJReachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADJReachability.m; sourceTree = ""; }; + 6F3A5E912018CE3A000AACD0 /* ATLTestInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATLTestInfo.m; sourceTree = ""; }; + 6F3A5E922018CE3A000AACD0 /* ATLUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATLUtil.h; sourceTree = ""; }; + 6F3A5E932018CE3A000AACD0 /* ATLControlChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATLControlChannel.h; sourceTree = ""; }; + 6F3A5E942018CE3A000AACD0 /* ATLConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATLConstants.h; sourceTree = ""; }; + 6F3A5E952018CE3A000AACD0 /* ATLTestLibrary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATLTestLibrary.h; sourceTree = ""; }; + 6F3A5E962018CE3A000AACD0 /* ATLUtilNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATLUtilNetworking.h; sourceTree = ""; }; + 6F3A5E972018CE3A000AACD0 /* ATLBlockingQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATLBlockingQueue.h; sourceTree = ""; }; + 6F3A5E982018CE3A000AACD0 /* ATLUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATLUtil.m; sourceTree = ""; }; + 6F3A5E992018CE3A000AACD0 /* ATLTestInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATLTestInfo.h; sourceTree = ""; }; + 6F3A5E9A2018CE3A000AACD0 /* ATLControlChannel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATLControlChannel.m; sourceTree = ""; }; + 6F3A5E9B2018CE3A000AACD0 /* ATLUtilNetworking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATLUtilNetworking.m; sourceTree = ""; }; + 6F3A5E9C2018CE3A000AACD0 /* ATLTestLibrary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATLTestLibrary.m; sourceTree = ""; }; + 6F3A5E9D2018CE3A000AACD0 /* ATLBlockingQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATLBlockingQueue.m; sourceTree = ""; }; + 6FFCFE5D2007978300467F01 /* ATAAdjustCommandExecutor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATAAdjustCommandExecutor.m; sourceTree = ""; }; + 6FFCFE5E2007978300467F01 /* ATAAdjustCommandExecutor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATAAdjustCommandExecutor.h; sourceTree = ""; }; + 6FFCFE61200797D000467F01 /* ATAAdjustDelegateAttribution.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATAAdjustDelegateAttribution.m; sourceTree = ""; }; + 6FFCFE62200797D000467F01 /* ATAAdjustDelegateSessionFailure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATAAdjustDelegateSessionFailure.h; sourceTree = ""; }; + 6FFCFE63200797D000467F01 /* ATAAdjustDelegateEventFailure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATAAdjustDelegateEventFailure.m; sourceTree = ""; }; + 6FFCFE64200797D000467F01 /* ATAAdjustDelegateEventFailure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATAAdjustDelegateEventFailure.h; sourceTree = ""; }; + 6FFCFE65200797D000467F01 /* ATAAdjustDelegateSessionFailure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATAAdjustDelegateSessionFailure.m; sourceTree = ""; }; + 6FFCFE66200797D000467F01 /* ATAAdjustDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATAAdjustDelegate.m; sourceTree = ""; }; + 6FFCFE67200797D000467F01 /* ATAAdjustDelegateSessionSuccess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATAAdjustDelegateSessionSuccess.h; sourceTree = ""; }; + 6FFCFE68200797D000467F01 /* ATAAdjustDelegateAttribution.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATAAdjustDelegateAttribution.h; sourceTree = ""; }; + 6FFCFE69200797D000467F01 /* ATAAdjustDelegateEventSuccess.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATAAdjustDelegateEventSuccess.m; sourceTree = ""; }; + 6FFCFE6A200797D000467F01 /* ATAAdjustDelegateSessionSuccess.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATAAdjustDelegateSessionSuccess.m; sourceTree = ""; }; + 6FFCFE6B200797D000467F01 /* ATAAdjustDelegateEventSuccess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATAAdjustDelegateEventSuccess.h; sourceTree = ""; }; + 6FFCFE6C200797D000467F01 /* ATAAdjustDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATAAdjustDelegate.h; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 6F0842242007769F00568A31 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 6F08421E2007769F00568A31 = { + isa = PBXGroup; + children = ( + 6F0842292007769F00568A31 /* AdjustTestApp */, + 6F0842282007769F00568A31 /* Products */, + ); + sourceTree = ""; + }; + 6F0842282007769F00568A31 /* Products */ = { + isa = PBXGroup; + children = ( + 6F0842272007769F00568A31 /* AdjustTestApp.app */, + ); + name = Products; + sourceTree = ""; + }; + 6F0842292007769F00568A31 /* AdjustTestApp */ = { + isa = PBXGroup; + children = ( + 6FFCFE602007978800467F01 /* Delegates */, + 6FFCFE5E2007978300467F01 /* ATAAdjustCommandExecutor.h */, + 6FFCFE5D2007978300467F01 /* ATAAdjustCommandExecutor.m */, + 6F08422A2007769F00568A31 /* AppDelegate.h */, + 6F08422B2007769F00568A31 /* AppDelegate.m */, + 6F08422D2007769F00568A31 /* ViewController.h */, + 6F08422E2007769F00568A31 /* ViewController.m */, + 6F0842302007769F00568A31 /* Main.storyboard */, + 6F0842332007769F00568A31 /* Assets.xcassets */, + 6F084235200776A000568A31 /* LaunchScreen.storyboard */, + 6F084238200776A000568A31 /* Info.plist */, + 6F084239200776A000568A31 /* main.m */, + 6F3A5E902018CE3A000AACD0 /* AdjustTestLibrary */, + 6F3A5E292018CE14000AACD0 /* Adjust */, + ); + path = AdjustTestApp; + sourceTree = ""; + }; + 6F3A5E292018CE14000AACD0 /* Adjust */ = { + isa = PBXGroup; + children = ( + 6F3A5E2A2018CE14000AACD0 /* ADJConfig.h */, + 6F3A5E2B2018CE14000AACD0 /* ADJDeviceInfo.m */, + 6F3A5E2C2018CE14000AACD0 /* ADJTimerOnce.m */, + 6F3A5E2D2018CE14000AACD0 /* ADJAttributionHandler.m */, + 6F3A5E2E2018CE14000AACD0 /* Adjust.h */, + 6F3A5E2F2018CE14000AACD0 /* ADJActivityPackage.h */, + 6F3A5E302018CE14000AACD0 /* ADJRequestHandler.m */, + 6F3A5E312018CE14000AACD0 /* ADJSystemProfile.h */, + 6F3A5E322018CE14000AACD0 /* ADJAttribution.h */, + 6F3A5E332018CE14000AACD0 /* ADJKeychain.m */, + 6F3A5E342018CE14000AACD0 /* ADJSdkClickHandler.m */, + 6F3A5E352018CE14000AACD0 /* ADJActivityKind.h */, + 6F3A5E362018CE14000AACD0 /* ADJEvent.m */, + 6F3A5E372018CE14000AACD0 /* ADJPackageHandler.h */, + 6F3A5E382018CE14000AACD0 /* ADJPackageBuilder.h */, + 6F3A5E392018CE14000AACD0 /* ADJResponseData.h */, + 6F3A5E3A2018CE14000AACD0 /* ADJSessionSuccess.m */, + 6F3A5E3B2018CE14000AACD0 /* ADJEventFailure.m */, + 6F3A5E3C2018CE14000AACD0 /* ADJAdjustFactory.h */, + 6F3A5E3D2018CE14000AACD0 /* ADJEventSuccess.m */, + 6F3A5E3E2018CE14000AACD0 /* ADJActivityState.m */, + 6F3A5E3F2018CE14000AACD0 /* ADJSessionFailure.m */, + 6F3A5E402018CE14000AACD0 /* ADJUtil.h */, + 6F3A5E412018CE14000AACD0 /* ADJReachability.h */, + 6F3A5E422018CE14000AACD0 /* ADJActivityHandler.h */, + 6F3A5E432018CE14000AACD0 /* ADJTimerCycle.m */, + 6F3A5E442018CE14000AACD0 /* ADJSessionParameters.m */, + 6F3A5E452018CE14000AACD0 /* ADJLogger.m */, + 6F3A5E462018CE14000AACD0 /* ADJBackoffStrategy.m */, + 6F3A5E472018CE14000AACD0 /* ADJUserDefaults.h */, + 6F3A5E482018CE14000AACD0 /* Adjust.m */, + 6F3A5E492018CE14000AACD0 /* ADJAttributionHandler.h */, + 6F3A5E4A2018CE14000AACD0 /* ADJTimerOnce.h */, + 6F3A5E4B2018CE14000AACD0 /* ADJDeviceInfo.h */, + 6F3A5E4C2018CE14000AACD0 /* ADJConfig.m */, + 6F3A5E4D2018CE14000AACD0 /* ADJPackageHandler.m */, + 6F3A5E4E2018CE14000AACD0 /* ADJEvent.h */, + 6F3A5E4F2018CE14000AACD0 /* ADJSdkClickHandler.h */, + 6F3A5E502018CE14000AACD0 /* ADJActivityKind.m */, + 6F3A5E512018CE14000AACD0 /* ADJKeychain.h */, + 6F3A5E522018CE14000AACD0 /* ADJAdditions */, + 6F3A5E592018CE14000AACD0 /* ADJAttribution.m */, + 6F3A5E5A2018CE14000AACD0 /* ADJSystemProfile.m */, + 6F3A5E5B2018CE14000AACD0 /* ADJRequestHandler.h */, + 6F3A5E5C2018CE14000AACD0 /* ADJActivityPackage.m */, + 6F3A5E5D2018CE14000AACD0 /* ADJUtil.m */, + 6F3A5E5E2018CE14000AACD0 /* ADJSessionFailure.h */, + 6F3A5E5F2018CE14000AACD0 /* ADJActivityState.h */, + 6F3A5E602018CE14000AACD0 /* ADJAdjustFactory.m */, + 6F3A5E612018CE14000AACD0 /* ADJEventSuccess.h */, + 6F3A5E622018CE14000AACD0 /* ADJEventFailure.h */, + 6F3A5E632018CE14000AACD0 /* ADJResponseData.m */, + 6F3A5E642018CE14000AACD0 /* ADJSessionSuccess.h */, + 6F3A5E652018CE14000AACD0 /* ADJPackageBuilder.m */, + 6F3A5E662018CE14000AACD0 /* ADJUserDefaults.m */, + 6F3A5E672018CE14000AACD0 /* ADJBackoffStrategy.h */, + 6F3A5E682018CE14000AACD0 /* ADJLogger.h */, + 6F3A5E692018CE14000AACD0 /* ADJSessionParameters.h */, + 6F3A5E6A2018CE14000AACD0 /* Info.plist */, + 6F3A5E6B2018CE14000AACD0 /* ADJTimerCycle.h */, + 6F3A5E6C2018CE14000AACD0 /* ADJActivityHandler.m */, + 6F3A5E6D2018CE14000AACD0 /* ADJReachability.m */, + ); + name = Adjust; + path = ../../../Adjust; + sourceTree = ""; + }; + 6F3A5E522018CE14000AACD0 /* ADJAdditions */ = { + isa = PBXGroup; + children = ( + 6F3A5E532018CE14000AACD0 /* NSString+ADJAdditions.m */, + 6F3A5E542018CE14000AACD0 /* UIDevice+ADJAdditions.h */, + 6F3A5E552018CE14000AACD0 /* NSData+ADJAdditions.m */, + 6F3A5E562018CE14000AACD0 /* NSData+ADJAdditions.h */, + 6F3A5E572018CE14000AACD0 /* UIDevice+ADJAdditions.m */, + 6F3A5E582018CE14000AACD0 /* NSString+ADJAdditions.h */, + ); + path = ADJAdditions; + sourceTree = ""; + }; + 6F3A5E902018CE3A000AACD0 /* AdjustTestLibrary */ = { + isa = PBXGroup; + children = ( + 6F3A5E912018CE3A000AACD0 /* ATLTestInfo.m */, + 6F3A5E922018CE3A000AACD0 /* ATLUtil.h */, + 6F3A5E932018CE3A000AACD0 /* ATLControlChannel.h */, + 6F3A5E942018CE3A000AACD0 /* ATLConstants.h */, + 6F3A5E952018CE3A000AACD0 /* ATLTestLibrary.h */, + 6F3A5E962018CE3A000AACD0 /* ATLUtilNetworking.h */, + 6F3A5E972018CE3A000AACD0 /* ATLBlockingQueue.h */, + 6F3A5E982018CE3A000AACD0 /* ATLUtil.m */, + 6F3A5E992018CE3A000AACD0 /* ATLTestInfo.h */, + 6F3A5E9A2018CE3A000AACD0 /* ATLControlChannel.m */, + 6F3A5E9B2018CE3A000AACD0 /* ATLUtilNetworking.m */, + 6F3A5E9C2018CE3A000AACD0 /* ATLTestLibrary.m */, + 6F3A5E9D2018CE3A000AACD0 /* ATLBlockingQueue.m */, + ); + name = AdjustTestLibrary; + path = ../../AdjustTestLibrary/AdjustTestLibrary; + sourceTree = ""; + }; + 6FFCFE602007978800467F01 /* Delegates */ = { + isa = PBXGroup; + children = ( + 6FFCFE6C200797D000467F01 /* ATAAdjustDelegate.h */, + 6FFCFE66200797D000467F01 /* ATAAdjustDelegate.m */, + 6FFCFE68200797D000467F01 /* ATAAdjustDelegateAttribution.h */, + 6FFCFE61200797D000467F01 /* ATAAdjustDelegateAttribution.m */, + 6FFCFE64200797D000467F01 /* ATAAdjustDelegateEventFailure.h */, + 6FFCFE63200797D000467F01 /* ATAAdjustDelegateEventFailure.m */, + 6FFCFE6B200797D000467F01 /* ATAAdjustDelegateEventSuccess.h */, + 6FFCFE69200797D000467F01 /* ATAAdjustDelegateEventSuccess.m */, + 6FFCFE62200797D000467F01 /* ATAAdjustDelegateSessionFailure.h */, + 6FFCFE65200797D000467F01 /* ATAAdjustDelegateSessionFailure.m */, + 6FFCFE67200797D000467F01 /* ATAAdjustDelegateSessionSuccess.h */, + 6FFCFE6A200797D000467F01 /* ATAAdjustDelegateSessionSuccess.m */, + ); + path = Delegates; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 6F0842262007769F00568A31 /* AdjustTestApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6F08423D200776A000568A31 /* Build configuration list for PBXNativeTarget "AdjustTestApp" */; + buildPhases = ( + 6F0842232007769F00568A31 /* Sources */, + 6F0842242007769F00568A31 /* Frameworks */, + 6F0842252007769F00568A31 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = AdjustTestApp; + productName = AdjustTestApp; + productReference = 6F0842272007769F00568A31 /* AdjustTestApp.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 6F08421F2007769F00568A31 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0920; + ORGANIZATIONNAME = adjust; + TargetAttributes = { + 6F0842262007769F00568A31 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 6F0842222007769F00568A31 /* Build configuration list for PBXProject "AdjustTestApp" */; + compatibilityVersion = "Xcode 8.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 6F08421E2007769F00568A31; + productRefGroup = 6F0842282007769F00568A31 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 6F0842262007769F00568A31 /* AdjustTestApp */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 6F0842252007769F00568A31 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6F3A5E8D2018CE14000AACD0 /* Info.plist in Resources */, + 6F084237200776A000568A31 /* LaunchScreen.storyboard in Resources */, + 6F0842342007769F00568A31 /* Assets.xcassets in Resources */, + 6F0842322007769F00568A31 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 6F0842232007769F00568A31 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6F3A5E722018CE14000AACD0 /* ADJKeychain.m in Sources */, + 6F3A5E702018CE14000AACD0 /* ADJAttributionHandler.m in Sources */, + 6F3A5E7A2018CE14000AACD0 /* ADJTimerCycle.m in Sources */, + 6FFCFE6E200797D100467F01 /* ATAAdjustDelegateEventFailure.m in Sources */, + 6F3A5E832018CE14000AACD0 /* NSData+ADJAdditions.m in Sources */, + 6F3A5EA32018CE3A000AACD0 /* ATLBlockingQueue.m in Sources */, + 6F3A5E712018CE14000AACD0 /* ADJRequestHandler.m in Sources */, + 6F3A5E732018CE14000AACD0 /* ADJSdkClickHandler.m in Sources */, + 6F3A5E892018CE14000AACD0 /* ADJAdjustFactory.m in Sources */, + 6F3A5E862018CE14000AACD0 /* ADJSystemProfile.m in Sources */, + 6F3A5E9F2018CE3A000AACD0 /* ATLUtil.m in Sources */, + 6F3A5E852018CE14000AACD0 /* ADJAttribution.m in Sources */, + 6FFCFE72200797D100467F01 /* ATAAdjustDelegateSessionSuccess.m in Sources */, + 6F3A5E7E2018CE14000AACD0 /* Adjust.m in Sources */, + 6FFCFE6D200797D100467F01 /* ATAAdjustDelegateAttribution.m in Sources */, + 6F3A5E7B2018CE14000AACD0 /* ADJSessionParameters.m in Sources */, + 6F3A5E882018CE14000AACD0 /* ADJUtil.m in Sources */, + 6F3A5E812018CE14000AACD0 /* ADJActivityKind.m in Sources */, + 6F3A5E8B2018CE14000AACD0 /* ADJPackageBuilder.m in Sources */, + 6F3A5E8C2018CE14000AACD0 /* ADJUserDefaults.m in Sources */, + 6F3A5E7C2018CE14000AACD0 /* ADJLogger.m in Sources */, + 6F3A5E742018CE14000AACD0 /* ADJEvent.m in Sources */, + 6F3A5E822018CE14000AACD0 /* NSString+ADJAdditions.m in Sources */, + 6F3A5E752018CE14000AACD0 /* ADJSessionSuccess.m in Sources */, + 6FFCFE70200797D100467F01 /* ATAAdjustDelegate.m in Sources */, + 6F3A5E772018CE14000AACD0 /* ADJEventSuccess.m in Sources */, + 6F3A5E6E2018CE14000AACD0 /* ADJDeviceInfo.m in Sources */, + 6FFCFE5F2007978300467F01 /* ATAAdjustCommandExecutor.m in Sources */, + 6F08422F2007769F00568A31 /* ViewController.m in Sources */, + 6F3A5E8A2018CE14000AACD0 /* ADJResponseData.m in Sources */, + 6F08423A200776A000568A31 /* main.m in Sources */, + 6F3A5E9E2018CE3A000AACD0 /* ATLTestInfo.m in Sources */, + 6F3A5E802018CE14000AACD0 /* ADJPackageHandler.m in Sources */, + 6F3A5E792018CE14000AACD0 /* ADJSessionFailure.m in Sources */, + 6F3A5EA22018CE3A000AACD0 /* ATLTestLibrary.m in Sources */, + 6F3A5EA02018CE3A000AACD0 /* ATLControlChannel.m in Sources */, + 6F3A5E842018CE14000AACD0 /* UIDevice+ADJAdditions.m in Sources */, + 6F3A5EA12018CE3A000AACD0 /* ATLUtilNetworking.m in Sources */, + 6F3A5E782018CE14000AACD0 /* ADJActivityState.m in Sources */, + 6F3A5E8E2018CE14000AACD0 /* ADJActivityHandler.m in Sources */, + 6F08422C2007769F00568A31 /* AppDelegate.m in Sources */, + 6F3A5E762018CE14000AACD0 /* ADJEventFailure.m in Sources */, + 6F3A5E7F2018CE14000AACD0 /* ADJConfig.m in Sources */, + 6F3A5E872018CE14000AACD0 /* ADJActivityPackage.m in Sources */, + 6FFCFE71200797D100467F01 /* ATAAdjustDelegateEventSuccess.m in Sources */, + 6F3A5E6F2018CE14000AACD0 /* ADJTimerOnce.m in Sources */, + 6FFCFE6F200797D100467F01 /* ATAAdjustDelegateSessionFailure.m in Sources */, + 6F3A5E7D2018CE14000AACD0 /* ADJBackoffStrategy.m in Sources */, + 6F3A5E8F2018CE14000AACD0 /* ADJReachability.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 6F0842302007769F00568A31 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 6F0842312007769F00568A31 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 6F084235200776A000568A31 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 6F084236200776A000568A31 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 6F08423B200776A000568A31 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 6F08423C200776A000568A31 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 6F08423E200776A000568A31 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = QGUGW9AUMK; + INFOPLIST_FILE = AdjustTestApp/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.adjust.AdjustTestApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 6F08423F200776A000568A31 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = QGUGW9AUMK; + INFOPLIST_FILE = AdjustTestApp/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.adjust.AdjustTestApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 6F0842222007769F00568A31 /* Build configuration list for PBXProject "AdjustTestApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6F08423B200776A000568A31 /* Debug */, + 6F08423C200776A000568A31 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 6F08423D200776A000568A31 /* Build configuration list for PBXNativeTarget "AdjustTestApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6F08423E200776A000568A31 /* Debug */, + 6F08423F200776A000568A31 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 6F08421F2007769F00568A31 /* Project object */; +} diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/ATAAdjustCommandExecutor.h b/AdjustTests/AdjustTestApp/AdjustTestApp/ATAAdjustCommandExecutor.h new file mode 100644 index 000000000..c3282565d --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/ATAAdjustCommandExecutor.h @@ -0,0 +1,16 @@ +// +// ATAAdjustCommandExecutor.h +// AdjustTestApp +// +// Created by Pedro da Silva (@nonelse) on 23rd August 2017. +// Copyright © 2017 Adjust GmbH. All rights reserved. +// + +#import +#import "ATLTestLibrary.h" + +@interface ATAAdjustCommandExecutor : NSObject + +@property (nonatomic, strong) ATLTestLibrary *testLibrary; + +@end diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/ATAAdjustCommandExecutor.m b/AdjustTests/AdjustTestApp/AdjustTestApp/ATAAdjustCommandExecutor.m new file mode 100644 index 000000000..67f58bed7 --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/ATAAdjustCommandExecutor.m @@ -0,0 +1,469 @@ +// +// ATAAdjustCommandExecutor.m +// AdjustTestApp +// +// Created by Pedro da Silva (@nonelse) on 23rd August 2017. +// Copyright © 2017 Adjust GmbH. All rights reserved. +// + +#import "Adjust.h" +#import "ADJAdjustFactory.h" +#import "ATAAdjustDelegate.h" +#import "ATAAdjustDelegateAttribution.h" +#import "ATAAdjustDelegateEventFailure.h" +#import "ATAAdjustDelegateEventSuccess.h" +#import "ATAAdjustDelegateSessionSuccess.h" +#import "ATAAdjustDelegateSessionFailure.h" +#import "ATAAdjustCommandExecutor.h" +#import "ViewController.h" + +@interface ATAAdjustCommandExecutor () + +@property (nonatomic, strong) NSMutableDictionary *savedConfigs; +@property (nonatomic, strong) NSMutableDictionary *savedEvents; +@property (nonatomic, strong) NSObject *adjustDelegate; +@property (nonatomic, copy) NSString *basePath; + +@end + +@implementation ATAAdjustCommandExecutor + +- (id)init { + self = [super init]; + + if (self == nil) { + return nil; + } + + self.savedConfigs = [NSMutableDictionary dictionary]; + self.savedEvents = [NSMutableDictionary dictionary]; + self.adjustDelegate = nil; + self.basePath = nil; + + return self; +} + +- (void)executeCommand:(NSString *)className + methodName:(NSString *)methodName + parameters:(NSDictionary *)parameters { + NSLog(@"executeCommand className: %@, methodName: %@, parameters: %@", className, methodName, parameters); + + if ([methodName isEqualToString:@"testOptions"]) { + [self testOptions:parameters]; + } else if ([methodName isEqualToString:@"config"]) { + [self config:parameters]; + } else if ([methodName isEqualToString:@"start"]) { + [self start:parameters]; + } else if ([methodName isEqualToString:@"event"]) { + [self event:parameters]; + } else if ([methodName isEqualToString:@"trackEvent"]) { + [self trackEvent:parameters]; + } else if ([methodName isEqualToString:@"resume"]) { + [self resume:parameters]; + } else if ([methodName isEqualToString:@"pause"]) { + [self pause:parameters]; + } else if ([methodName isEqualToString:@"setEnabled"]) { + [self setEnabled:parameters]; + } else if ([methodName isEqualToString:@"setOfflineMode"]) { + [self setOfflineMode:parameters]; + } else if ([methodName isEqualToString:@"sendFirstPackages"]) { + [self sendFirstPackages:parameters]; + } else if ([methodName isEqualToString:@"addSessionCallbackParameter"]) { + [self addSessionCallbackParameter:parameters]; + } else if ([methodName isEqualToString:@"addSessionPartnerParameter"]) { + [self addSessionPartnerParameter:parameters]; + } else if ([methodName isEqualToString:@"removeSessionCallbackParameter"]) { + [self removeSessionCallbackParameter:parameters]; + } else if ([methodName isEqualToString:@"removeSessionPartnerParameter"]) { + [self removeSessionPartnerParameter:parameters]; + } else if ([methodName isEqualToString:@"resetSessionCallbackParameters"]) { + [self resetSessionCallbackParameters:parameters]; + } else if ([methodName isEqualToString:@"resetSessionPartnerParameters"]) { + [self resetSessionPartnerParameters:parameters]; + } else if ([methodName isEqualToString:@"setPushToken"]) { + [self setPushToken:parameters]; + } else if ([methodName isEqualToString:@"openDeeplink"]) { + [self openDeeplink:parameters]; + } +} + +- (void)testOptions:(NSDictionary *)parameters { + AdjustTestOptions * testOptions = [[AdjustTestOptions alloc] init]; + testOptions.baseUrl = baseUrl; + if ([parameters objectForKey:@"basePath"]) { + self.basePath = [parameters objectForKey:@"basePath"][0]; + } + if ([parameters objectForKey:@"timerInterval"]) { + NSString *timerIntervalMilliS = [parameters objectForKey:@"timerInterval"][0]; + testOptions.timerIntervalInMilliseconds = [ATAAdjustCommandExecutor convertMilliStringToNumber:timerIntervalMilliS]; + } + if ([parameters objectForKey:@"timerStart"]) { + NSString *timerStartMilliS = [parameters objectForKey:@"timerStart"][0]; + testOptions.timerStartInMilliseconds = [ATAAdjustCommandExecutor convertMilliStringToNumber:timerStartMilliS]; + } + if ([parameters objectForKey:@"sessionInterval"]) { + NSString *sessionIntervalMilliS = [parameters objectForKey:@"sessionInterval"][0]; + testOptions.sessionIntervalInMilliseconds = [ATAAdjustCommandExecutor convertMilliStringToNumber:sessionIntervalMilliS]; + } + if ([parameters objectForKey:@"subsessionInterval"]) { + NSString *subsessionIntervalMilliS = [parameters objectForKey:@"subsessionInterval"][0]; + testOptions.subsessionIntervalInMilliseconds = [ATAAdjustCommandExecutor convertMilliStringToNumber:subsessionIntervalMilliS]; + } + if ([parameters objectForKey:@"teardown"]) { + NSArray *teardownOptions = [parameters objectForKey:@"teardown"]; + for (int i = 0; i < teardownOptions.count; i = i + 1) { + NSString *teardownOption = teardownOptions[i]; + if ([teardownOption isEqualToString:@"resetSdk"]) { + testOptions.teardown = YES; + testOptions.basePath = self.basePath; + } + if ([teardownOption isEqualToString:@"deleteState"]) { + testOptions.deleteState = YES; + } + if ([teardownOption isEqualToString:@"resetTest"]) { + self.savedConfigs = [NSMutableDictionary dictionary]; + self.savedEvents = [NSMutableDictionary dictionary]; + testOptions.timerIntervalInMilliseconds = [NSNumber numberWithInt:-1000]; + testOptions.timerStartInMilliseconds = [NSNumber numberWithInt:-1000]; + testOptions.sessionIntervalInMilliseconds = [NSNumber numberWithInt:-1000]; + testOptions.subsessionIntervalInMilliseconds = [NSNumber numberWithInt:-1000]; + } + if ([teardownOption isEqualToString:@"sdk"]) { + testOptions.teardown = YES; + testOptions.basePath = nil; + } + if ([teardownOption isEqualToString:@"test"]) { + self.savedConfigs = nil; + self.savedEvents = nil; + self.adjustDelegate = nil; + self.basePath = nil; + testOptions.timerIntervalInMilliseconds = [NSNumber numberWithInt:-1000]; + testOptions.timerStartInMilliseconds = [NSNumber numberWithInt:-1000]; + testOptions.sessionIntervalInMilliseconds = [NSNumber numberWithInt:-1000]; + testOptions.subsessionIntervalInMilliseconds = [NSNumber numberWithInt:-1000]; + } + } + } + [Adjust setTestOptions:testOptions]; +} + ++ (NSNumber *)convertMilliStringToNumber:(NSString *)milliS { + NSNumber * number = [NSNumber numberWithInt:[milliS intValue]]; + return number; +} + +- (void)config:(NSDictionary *)parameters { + NSNumber *configNumber = [NSNumber numberWithInt:0]; + + if ([parameters objectForKey:@"configName"]) { + NSString *configName = [parameters objectForKey:@"configName"][0]; + NSString *configNumberS = [configName substringFromIndex:[configName length] - 1]; + configNumber = [NSNumber numberWithInt:[configNumberS intValue]]; + } + + ADJConfig *adjustConfig = nil; + + if ([self.savedConfigs objectForKey:configNumber]) { + adjustConfig = [self.savedConfigs objectForKey:configNumber]; + } else { + NSString *environment = [parameters objectForKey:@"environment"][0]; + NSString *appToken = [parameters objectForKey:@"appToken"][0]; + + adjustConfig = [ADJConfig configWithAppToken:appToken environment:environment]; + [self.savedConfigs setObject:adjustConfig forKey:configNumber]; + } + + if ([parameters objectForKey:@"logLevel"]) { + NSString *logLevelS = [parameters objectForKey:@"logLevel"][0]; + ADJLogLevel logLevel = [ADJLogger logLevelFromString:logLevelS]; + [adjustConfig setLogLevel:logLevel]; + } + + if ([parameters objectForKey:@"sdkPrefix"]) { + NSString *sdkPrefix = [parameters objectForKey:@"sdkPrefix"][0]; + if (sdkPrefix == (id)[NSNull null]) { + sdkPrefix = nil; + } + [adjustConfig setSdkPrefix:sdkPrefix]; + } + + if ([parameters objectForKey:@"defaultTracker"]) { + NSString *defaultTracker = [parameters objectForKey:@"defaultTracker"][0]; + if (defaultTracker == (id)[NSNull null]) { + defaultTracker = nil; + } + [adjustConfig setDefaultTracker:defaultTracker]; + } + + if ([parameters objectForKey:@"appSecret"]) { + NSArray *appSecretList = [parameters objectForKey:@"appSecret"]; + if ([appSecretList count] == 5 && + [appSecretList[0] length] > 0 && + [appSecretList[1] length] > 0 && + [appSecretList[2] length] > 0 && + [appSecretList[3] length] > 0 && + [appSecretList[4] length] > 0) { + NSUInteger secretId = [appSecretList[0] integerValue]; + NSUInteger part1 = [appSecretList[1] integerValue]; + NSUInteger part2 = [appSecretList[2] integerValue]; + NSUInteger part3 = [appSecretList[3] integerValue]; + NSUInteger part4 = [appSecretList[4] integerValue]; + + [adjustConfig setAppSecret:secretId info1:part1 info2:part2 info3:part3 info4:part4]; + } + } + + if ([parameters objectForKey:@"delayStart"]) { + NSString *delayStartS = [parameters objectForKey:@"delayStart"][0]; + double delayStart = [delayStartS doubleValue]; + [adjustConfig setDelayStart:delayStart]; + } + + if ([parameters objectForKey:@"deviceKnown"]) { + NSString *deviceKnownS = [parameters objectForKey:@"deviceKnown"][0]; + [adjustConfig setIsDeviceKnown:[deviceKnownS boolValue]]; + } + + if ([parameters objectForKey:@"eventBufferingEnabled"]) { + NSString *eventBufferingEnabledS = [parameters objectForKey:@"eventBufferingEnabled"][0]; + [adjustConfig setEventBufferingEnabled:[eventBufferingEnabledS boolValue]]; + } + + if ([parameters objectForKey:@"sendInBackground"]) { + NSString *sendInBackgroundS = [parameters objectForKey:@"sendInBackground"][0]; + [adjustConfig setSendInBackground:[sendInBackgroundS boolValue]]; + } + + if ([parameters objectForKey:@"userAgent"]) { + NSString *userAgent = [parameters objectForKey:@"userAgent"][0]; + [adjustConfig setUserAgent:userAgent]; + } + + /* + self.adjustDelegate = [[ATAAdjustDelegate alloc] initWithTestLibrary:self.testLibrary]; + BOOL swizzleAttributionCallback = NO; + BOOL swizzleSessionSuccessCallback = NO; + BOOL swizzleSessionFailureCallback = NO; + BOOL swizzleEventSuccessCallback = NO; + BOOL swizzleEventFailureCallback = NO; + */ + + if ([parameters objectForKey:@"attributionCallbackSendAll"]) { + NSLog(@"attributionCallbackSendAll detected"); + + self.adjustDelegate = [[ATAAdjustDelegateAttribution alloc] initWithTestLibrary:self.testLibrary andBasePath:self.basePath]; + + // swizzleAttributionCallback = YES; + } + + if ([parameters objectForKey:@"sessionCallbackSendSuccess"]) { + NSLog(@"sessionCallbackSendSuccess detected"); + + self.adjustDelegate = [[ATAAdjustDelegateSessionSuccess alloc] initWithTestLibrary:self.testLibrary andBasePath:self.basePath]; + + // swizzleSessionSuccessCallback = YES; + } + + if ([parameters objectForKey:@"sessionCallbackSendFailure"]) { + NSLog(@"sessionCallbackSendFailure detected"); + + self.adjustDelegate = [[ATAAdjustDelegateSessionFailure alloc] initWithTestLibrary:self.testLibrary andBasePath:self.basePath]; + + // swizzleSessionFailureCallback = YES; + } + + if ([parameters objectForKey:@"eventCallbackSendSuccess"]) { + NSLog(@"eventCallbackSendSuccess detected"); + + self.adjustDelegate = [[ATAAdjustDelegateEventSuccess alloc] initWithTestLibrary:self.testLibrary andBasePath:self.basePath]; + + // swizzleEventSuccessCallback = YES; + } + + if ([parameters objectForKey:@"eventCallbackSendFailure"]) { + NSLog(@"eventCallbackSendFailure detected"); + + self.adjustDelegate = [[ATAAdjustDelegateEventFailure alloc] initWithTestLibrary:self.testLibrary andBasePath:self.basePath]; + + // swizzleEventFailureCallback = YES; + } + + /* + [self.adjustDelegate swizzleAttributionCallback:swizzleAttributionCallback + eventSucceededCallback:swizzleEventSuccessCallback + eventFailedCallback:swizzleEventFailureCallback + sessionSucceededCallback:swizzleSessionSuccessCallback + sessionFailedCallback:swizzleSessionFailureCallback]; + [adjustConfig setDelegate:self.adjustDelegate]; + */ + [adjustConfig setDelegate:self.adjustDelegate]; +} + +- (void)start:(NSDictionary *)parameters { + [self config:parameters]; + + NSNumber *configNumber = [NSNumber numberWithInt:0]; + + if ([parameters objectForKey:@"configName"]) { + NSString *configName = [parameters objectForKey:@"configName"][0]; + NSString *configNumberS = [configName substringFromIndex:[configName length] - 1]; + configNumber = [NSNumber numberWithInt:[configNumberS intValue]]; + } + + ADJConfig *adjustConfig = [self.savedConfigs objectForKey:configNumber]; + + [Adjust appDidLaunch:adjustConfig]; + + [self.savedConfigs removeObjectForKey:[NSNumber numberWithInt:0]]; +} + +- (void)event:(NSDictionary *)parameters { + NSNumber *eventNumber = [NSNumber numberWithInt:0]; + + if ([parameters objectForKey:@"eventName"]) { + NSString *eventName = [parameters objectForKey:@"eventName"][0]; + NSString *eventNumberS = [eventName substringFromIndex:[eventName length] - 1]; + eventNumber = [NSNumber numberWithInt:[eventNumberS intValue]]; + } + + ADJEvent *adjustEvent = nil; + + if ([self.savedEvents objectForKey:eventNumber]) { + adjustEvent = [self.savedEvents objectForKey:eventNumber]; + } else { + NSString *eventToken = [parameters objectForKey:@"eventToken"][0]; + + adjustEvent = [ADJEvent eventWithEventToken:eventToken]; + [self.savedEvents setObject:adjustEvent forKey:eventNumber]; + } + + if ([parameters objectForKey:@"revenue"]) { + NSArray *currencyAndRevenue = [parameters objectForKey:@"revenue"]; + NSString *currency = currencyAndRevenue[0]; + double revenue = [currencyAndRevenue[1] doubleValue]; + + [adjustEvent setRevenue:revenue currency:currency]; + } + + if ([parameters objectForKey:@"callbackParams"]) { + NSArray *callbackParams = [parameters objectForKey:@"callbackParams"]; + for (int i = 0; i < callbackParams.count; i = i + 2) { + NSString *key = callbackParams[i]; + NSString *value = callbackParams[i + 1]; + [adjustEvent addCallbackParameter:key value:value]; + } + } + + if ([parameters objectForKey:@"partnerParams"]) { + NSArray *partnerParams = [parameters objectForKey:@"partnerParams"]; + for (int i = 0; i < partnerParams.count; i = i + 2) { + NSString *key = partnerParams[i]; + NSString *value = partnerParams[i + 1]; + [adjustEvent addPartnerParameter:key value:value]; + } + } + + if ([parameters objectForKey:@"orderId"]) { + NSString *transactionId = [parameters objectForKey:@"orderId"][0]; + if (transactionId == (id)[NSNull null]) { + transactionId = nil; + } + [adjustEvent setTransactionId:transactionId]; + } +} + +- (void)trackEvent:(NSDictionary *)parameters { + [self event:parameters]; + + NSNumber *eventNumber = [NSNumber numberWithInt:0]; + + if ([parameters objectForKey:@"eventName"]) { + NSString *eventName = [parameters objectForKey:@"eventName"][0]; + NSString *eventNumberS = [eventName substringFromIndex:[eventName length] - 1]; + eventNumber = [NSNumber numberWithInt:[eventNumberS intValue]]; + } + + ADJEvent *adjustEvent = [self.savedEvents objectForKey:eventNumber]; + + [Adjust trackEvent:adjustEvent]; + + [self.savedEvents removeObjectForKey:[NSNumber numberWithInt:0]]; +} + +- (void)resume:(NSDictionary *)parameters { + [Adjust trackSubsessionStart]; +} + +- (void)pause:(NSDictionary *)parameters { + [Adjust trackSubsessionEnd]; +} + +- (void)setEnabled:(NSDictionary *)parameters { + NSString *enabledS = [parameters objectForKey:@"enabled"][0]; + [Adjust setEnabled:[enabledS boolValue]]; +} + +- (void)setOfflineMode:(NSDictionary *)parameters { + NSString *enabledS = [parameters objectForKey:@"enabled"][0]; + [Adjust setOfflineMode:[enabledS boolValue]]; +} + +- (void)sendFirstPackages:(NSDictionary *)parameters { + [Adjust sendFirstPackages]; +} + +- (void)addSessionCallbackParameter:(NSDictionary *)parameters { + NSArray *keyValuesPairs = [parameters objectForKey:@"KeyValue"]; + for (int i = 0; i < keyValuesPairs.count; i = i + 2) { + NSString *key = keyValuesPairs[i]; + NSString *value = keyValuesPairs[i + 1]; + [Adjust addSessionCallbackParameter:key value:value]; + } +} + +- (void)addSessionPartnerParameter:(NSDictionary *)parameters { + NSArray *keyValuesPairs = [parameters objectForKey:@"KeyValue"]; + for (int i = 0; i < keyValuesPairs.count; i = i + 2) { + NSString *key = keyValuesPairs[i]; + NSString *value = keyValuesPairs[i + 1]; + [Adjust addSessionPartnerParameter:key value:value]; + } +} + +- (void)removeSessionCallbackParameter:(NSDictionary *)parameters { + NSArray *keys = [parameters objectForKey:@"key"]; + for (int i = 0; i < keys.count; i = i + 1) { + NSString *key = keys[i]; + [Adjust removeSessionCallbackParameter:key]; + } +} + +- (void)removeSessionPartnerParameter:(NSDictionary *)parameters { + NSArray *keys = [parameters objectForKey:@"key"]; + for (int i = 0; i < keys.count; i = i + 1) { + NSString *key = keys[i]; + [Adjust removeSessionPartnerParameter:key]; + } +} + +- (void)resetSessionCallbackParameters:(NSDictionary *)parameters { + [Adjust resetSessionCallbackParameters]; +} + +- (void)resetSessionPartnerParameters:(NSDictionary *)parameters { + [Adjust resetSessionPartnerParameters]; +} + +- (void)setPushToken:(NSDictionary *)parameters { + NSString *deviceTokenS = [parameters objectForKey:@"pushToken"][0]; + NSData *deviceToken = [deviceTokenS dataUsingEncoding:NSUTF8StringEncoding]; + [Adjust setDeviceToken:deviceToken]; +} + +- (void)openDeeplink:(NSDictionary *)parameters { + NSString *deeplinkS = [parameters objectForKey:@"deeplink"][0]; + NSURL *deeplink = [NSURL URLWithString:deeplinkS]; + [Adjust appWillOpenUrl:deeplink]; +} + +@end diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/AppDelegate.h b/AdjustTests/AdjustTestApp/AdjustTestApp/AppDelegate.h new file mode 100644 index 000000000..cd4666705 --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/AppDelegate.h @@ -0,0 +1,17 @@ +// +// AppDelegate.h +// AdjustTestApp +// +// Created by Pedro on 23.08.17. +// Copyright © 2017 adjust. All rights reserved. +// + +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + + +@end + diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/AppDelegate.m b/AdjustTests/AdjustTestApp/AdjustTestApp/AppDelegate.m new file mode 100644 index 000000000..2ca9ff07f --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/AppDelegate.m @@ -0,0 +1,51 @@ +// +// AppDelegate.m +// AdjustTestApp +// +// Created by Pedro on 23.08.17. +// Copyright © 2017 adjust. All rights reserved. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + + +- (void)applicationWillResignActive:(UIApplication *)application { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. +} + + +- (void)applicationDidEnterBackground:(UIApplication *)application { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. +} + + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + + +- (void)applicationWillTerminate:(UIApplication *)application { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + + +@end diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/AdjustTests/AdjustTestApp/AdjustTestApp/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..1d060ed28 --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,93 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/Base.lproj/LaunchScreen.storyboard b/AdjustTests/AdjustTestApp/AdjustTestApp/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 000000000..f83f6fd58 --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/Base.lproj/Main.storyboard b/AdjustTests/AdjustTestApp/AdjustTestApp/Base.lproj/Main.storyboard new file mode 100644 index 000000000..d7c78a125 --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/Base.lproj/Main.storyboard @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegate.h b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegate.h new file mode 100644 index 000000000..e60333914 --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegate.h @@ -0,0 +1,22 @@ +// +// ATAAdjustDelegate.h +// AdjustTestApp +// +// Created by Pedro da Silva (@nonelse) on 26th October 2017. +// Copyright © 2017 Аdjust GmbH. All rights reserved. +// + +#import +#import "Adjust.h" +#import "ATLTestLibrary.h" + +@interface ATAAdjustDelegate : NSObject + +- (id)initWithTestLibrary:(ATLTestLibrary *)testLibrary andBasePath:(NSString *)basePath; + +- (void)swizzleAttributionCallback:(BOOL)swizzleAttributionCallback + eventSucceededCallback:(BOOL)swizzleEventSucceededCallback + eventFailedCallback:(BOOL)swizzleEventFailedCallback + sessionSucceededCallback:(BOOL)swizzleSessionSucceededCallback + sessionFailedCallback:(BOOL)swizzleSessionFailedCallback; +@end diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegate.m b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegate.m new file mode 100644 index 000000000..836206d5b --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegate.m @@ -0,0 +1,240 @@ +// +// ATAAdjustDelegate.m +// AdjustTestApp +// +// Created by Pedro da Silva (@nonelse) on 26th October 2017. +// Copyright © 2017 Аdjust GmbH. All rights reserved. +// + +#import +#import "ATAAdjustDelegate.h" + +@interface ATAAdjustDelegate () + +@property (nonatomic, strong) ATLTestLibrary *testLibrary; +@property (nonatomic, copy) NSString *basePath; + +@end + +@implementation ATAAdjustDelegate + +- (id)initWithTestLibrary:(ATLTestLibrary *)testLibrary andBasePath:(NSString *)basePath { + self = [super init]; + + if (nil == self) { + return nil; + } + + self.testLibrary = testLibrary; + self.basePath = basePath; + + [self swizzleCallbackMethod:@selector(adjustAttributionChanged:) + swizzledSelector:@selector(adjustAttributionChangedWannabeEmpty:)]; + + [self swizzleCallbackMethod:@selector(adjustEventTrackingSucceeded:) + swizzledSelector:@selector(adjustEventTrackingSucceededWannabeEmpty:)]; + + [self swizzleCallbackMethod:@selector(adjustEventTrackingFailed:) + swizzledSelector:@selector(adjustEventTrackingFailedWannabeEmpty:)]; + + [self swizzleCallbackMethod:@selector(adjustSessionTrackingSucceeded:) + swizzledSelector:@selector(adjustSessionTrackingSucceededWannabeEmpty:)]; + + [self swizzleCallbackMethod:@selector(adjustSessionTrackingFailed:) + swizzledSelector:@selector(adjustSessionTrackingFailedWananbeEmpty:)]; + + return self; +} + +- (void)swizzleAttributionCallback:(BOOL)swizzleAttributionCallback + eventSucceededCallback:(BOOL)swizzleEventSucceededCallback + eventFailedCallback:(BOOL)swizzleEventFailedCallback + sessionSucceededCallback:(BOOL)swizzleSessionSucceededCallback + sessionFailedCallback:(BOOL)swizzleSessionFailedCallback { + // Do the swizzling where and if needed. + if (swizzleAttributionCallback) { + [self swizzleCallbackMethod:@selector(adjustAttributionChanged:) + swizzledSelector:@selector(adjustAttributionChangedWannabe:)]; + } + + if (swizzleEventSucceededCallback) { + [self swizzleCallbackMethod:@selector(adjustEventTrackingSucceeded:) + swizzledSelector:@selector(adjustEventTrackingSucceededWannabe:)]; + } + + if (swizzleEventFailedCallback) { + [self swizzleCallbackMethod:@selector(adjustEventTrackingFailed:) + swizzledSelector:@selector(adjustEventTrackingFailedWannabe:)]; + } + + if (swizzleSessionSucceededCallback) { + [self swizzleCallbackMethod:@selector(adjustSessionTrackingSucceeded:) + swizzledSelector:@selector(adjustSessionTrackingSucceededWannabe:)]; + } + + if (swizzleSessionFailedCallback) { + [self swizzleCallbackMethod:@selector(adjustSessionTrackingFailed:) + swizzledSelector:@selector(adjustSessionTrackingFailedWananbe:)]; + } +} + +- (void)swizzleCallbackMethod:(SEL)originalSelector + swizzledSelector:(SEL)swizzledSelector { + Class className = [self class]; + + Method originalMethod = class_getInstanceMethod(className, originalSelector); + Method swizzledMethod = class_getInstanceMethod(className, swizzledSelector); + + BOOL didAddMethod = class_addMethod(className, + originalSelector, + method_getImplementation(swizzledMethod), + method_getTypeEncoding(swizzledMethod)); + + if (didAddMethod) { + class_replaceMethod(className, + swizzledSelector, + method_getImplementation(originalMethod), + method_getTypeEncoding(originalMethod)); + } else { + method_exchangeImplementations(originalMethod, swizzledMethod); + } +} + +- (void)adjustAttributionChangedWannabe:(ADJAttribution *)attribution { + NSLog(@"Attribution callback called!"); + NSLog(@"Attribution: %@", attribution); + + [self.testLibrary addInfoToSend:@"trackerToken" value:attribution.trackerToken]; + [self.testLibrary addInfoToSend:@"trackerName" value:attribution.trackerName]; + [self.testLibrary addInfoToSend:@"network" value:attribution.network]; + [self.testLibrary addInfoToSend:@"campaign" value:attribution.campaign]; + [self.testLibrary addInfoToSend:@"adgroup" value:attribution.adgroup]; + [self.testLibrary addInfoToSend:@"creative" value:attribution.creative]; + [self.testLibrary addInfoToSend:@"clickLabel" value:attribution.clickLabel]; + [self.testLibrary addInfoToSend:@"adid" value:attribution.adid]; + + [self.testLibrary sendInfoToServer:self.basePath]; +} + +- (void)adjustEventTrackingSucceededWannabe:(ADJEventSuccess *)eventSuccessResponseData { + NSLog(@"Event success callback called!"); + NSLog(@"Event success data: %@", eventSuccessResponseData); + + [self.testLibrary addInfoToSend:@"message" value:eventSuccessResponseData.message]; + [self.testLibrary addInfoToSend:@"timestamp" value:eventSuccessResponseData.timeStamp]; + [self.testLibrary addInfoToSend:@"adid" value:eventSuccessResponseData.adid]; + [self.testLibrary addInfoToSend:@"eventToken" value:eventSuccessResponseData.eventToken]; + + NSError *error; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:eventSuccessResponseData.jsonResponse + options:NSJSONWritingPrettyPrinted + error:&error]; + + if (!jsonData) { + NSLog(@"Unable to conver NSDictionary with JSON response to JSON string: %@", error); + } else { + NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + [self.testLibrary addInfoToSend:@"jsonResponse" value:jsonString]; + } + + [self.testLibrary sendInfoToServer:self.basePath]; +} + +- (void)adjustEventTrackingFailedWannabe:(ADJEventFailure *)eventFailureResponseData { + NSLog(@"Event failure callback called!"); + NSLog(@"Event failure data: %@", eventFailureResponseData); + + [self.testLibrary addInfoToSend:@"message" value:eventFailureResponseData.message]; + [self.testLibrary addInfoToSend:@"timestamp" value:eventFailureResponseData.timeStamp]; + [self.testLibrary addInfoToSend:@"adid" value:eventFailureResponseData.adid]; + [self.testLibrary addInfoToSend:@"eventToken" value:eventFailureResponseData.eventToken]; + [self.testLibrary addInfoToSend:@"willRetry" value:(eventFailureResponseData.willRetry ? @"true" : @"false")]; + + NSError *error; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:eventFailureResponseData.jsonResponse + options:NSJSONWritingPrettyPrinted + error:&error]; + + if (!jsonData) { + NSLog(@"Unable to conver NSDictionary with JSON response to JSON string: %@", error); + } else { + NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + [self.testLibrary addInfoToSend:@"jsonResponse" value:jsonString]; + } + + [self.testLibrary sendInfoToServer:self.basePath]; +} + +- (void)adjustSessionTrackingSucceededWannabe:(ADJSessionSuccess *)sessionSuccessResponseData { + NSLog(@"Session success callback called!"); + NSLog(@"Session success data: %@", sessionSuccessResponseData); + + [self.testLibrary addInfoToSend:@"message" value:sessionSuccessResponseData.message]; + [self.testLibrary addInfoToSend:@"timestamp" value:sessionSuccessResponseData.timeStamp]; + [self.testLibrary addInfoToSend:@"adid" value:sessionSuccessResponseData.adid]; + + NSError *error; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:sessionSuccessResponseData.jsonResponse + options:NSJSONWritingPrettyPrinted + error:&error]; + + if (!jsonData) { + NSLog(@"Unable to conver NSDictionary with JSON response to JSON string: %@", error); + } else { + NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + [self.testLibrary addInfoToSend:@"jsonResponse" value:jsonString]; + } + + [self.testLibrary sendInfoToServer:self.basePath]; +} + +- (void)adjustSessionTrackingFailedWananbe:(ADJSessionFailure *)sessionFailureResponseData { + NSLog(@"Session failure callback called!"); + NSLog(@"Session failure data: %@", sessionFailureResponseData); + + [self.testLibrary addInfoToSend:@"message" value:sessionFailureResponseData.message]; + [self.testLibrary addInfoToSend:@"timestamp" value:sessionFailureResponseData.timeStamp]; + [self.testLibrary addInfoToSend:@"adid" value:sessionFailureResponseData.adid]; + [self.testLibrary addInfoToSend:@"willRetry" value:(sessionFailureResponseData.willRetry ? @"true" : @"false")]; + + NSError *error; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:sessionFailureResponseData.jsonResponse + options:NSJSONWritingPrettyPrinted + error:&error]; + + if (!jsonData) { + NSLog(@"Unable to conver NSDictionary with JSON response to JSON string: %@", error); + } else { + NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + [self.testLibrary addInfoToSend:@"jsonResponse" value:jsonString]; + } + + [self.testLibrary sendInfoToServer:self.basePath]; +} + +- (void)adjustAttributionChangedWannabeEmpty:(ADJAttribution *)attribution { + NSLog(@"Attribution callback called!"); + NSLog(@"Attribution: %@", attribution); +} + +- (void)adjustEventTrackingSucceededWannabeEmpty:(ADJEventSuccess *)eventSuccessResponseData { + NSLog(@"Event success callback called!"); + NSLog(@"Event success data: %@", eventSuccessResponseData); +} + +- (void)adjustEventTrackingFailedWannabeEmpty:(ADJEventFailure *)eventFailureResponseData { + NSLog(@"Event failure callback called!"); + NSLog(@"Event failure data: %@", eventFailureResponseData); +} + +- (void)adjustSessionTrackingSucceededWannabeEmpty:(ADJSessionSuccess *)sessionSuccessResponseData { + NSLog(@"Session success callback called!"); + NSLog(@"Session success data: %@", sessionSuccessResponseData); +} + +- (void)adjustSessionTrackingFailedWananbeEmpty:(ADJSessionFailure *)sessionFailureResponseData { + NSLog(@"Session failure callback called!"); + NSLog(@"Session failure data: %@", sessionFailureResponseData); +} + +@end diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateAttribution.h b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateAttribution.h new file mode 100644 index 000000000..0aaf1f8bd --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateAttribution.h @@ -0,0 +1,17 @@ +// +// ATAAdjustDelegateAttribution.h +// AdjustTestApp +// +// Created by Uglješa Erceg (uerceg) on 8th December 2017. +// Copyright © 2017 Adjust GmbH. All rights reserved. +// + +#import +#import "Adjust.h" +#import "ATLTestLibrary.h" + +@interface ATAAdjustDelegateAttribution : NSObject + +- (id)initWithTestLibrary:(ATLTestLibrary *)testLibrary andBasePath:(NSString *)basePath; + +@end diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateAttribution.m b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateAttribution.m new file mode 100644 index 000000000..745a528bb --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateAttribution.m @@ -0,0 +1,49 @@ +// +// ATAAdjustDelegateAttribution.m +// AdjustTestApp +// +// Created by Uglješa Erceg (uerceg) on 8th December 2017. +// Copyright © 2017 Adjust GmbH. All rights reserved. +// + +#import "ATAAdjustDelegateAttribution.h" + +@interface ATAAdjustDelegateAttribution () + +@property (nonatomic, strong) ATLTestLibrary *testLibrary; +@property (nonatomic, copy) NSString *basePath; + +@end + +@implementation ATAAdjustDelegateAttribution + +- (id)initWithTestLibrary:(ATLTestLibrary *)testLibrary andBasePath:(NSString *)basePath { + self = [super init]; + + if (nil == self) { + return nil; + } + + self.testLibrary = testLibrary; + self.basePath = basePath; + + return self; +} + +- (void)adjustAttributionChanged:(ADJAttribution *)attribution { + NSLog(@"Attribution callback called!"); + NSLog(@"Attribution: %@", attribution); + + [self.testLibrary addInfoToSend:@"trackerToken" value:attribution.trackerToken]; + [self.testLibrary addInfoToSend:@"trackerName" value:attribution.trackerName]; + [self.testLibrary addInfoToSend:@"network" value:attribution.network]; + [self.testLibrary addInfoToSend:@"campaign" value:attribution.campaign]; + [self.testLibrary addInfoToSend:@"adgroup" value:attribution.adgroup]; + [self.testLibrary addInfoToSend:@"creative" value:attribution.creative]; + [self.testLibrary addInfoToSend:@"clickLabel" value:attribution.clickLabel]; + [self.testLibrary addInfoToSend:@"adid" value:attribution.adid]; + + [self.testLibrary sendInfoToServer:self.basePath]; +} + +@end diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateEventFailure.h b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateEventFailure.h new file mode 100644 index 000000000..072a88c1a --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateEventFailure.h @@ -0,0 +1,17 @@ +// +// ATAAdjustDelegateEventFailure.h +// AdjustTestApp +// +// Created by Uglješa Erceg (uerceg) on 8th December 2017. +// Copyright © 2017 Adjust GmbH. All rights reserved. +// + +#import +#import "Adjust.h" +#import "ATLTestLibrary.h" + +@interface ATAAdjustDelegateEventFailure : NSObject + +- (id)initWithTestLibrary:(ATLTestLibrary *)testLibrary andBasePath:(NSString *)basePath; + +@end diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateEventFailure.m b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateEventFailure.m new file mode 100644 index 000000000..b394da9d6 --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateEventFailure.m @@ -0,0 +1,58 @@ +// +// ATAAdjustDelegateEventFailure.m +// AdjustTestApp +// +// Created by Uglješa Erceg (uerceg) on 8th December 2017. +// Copyright © 2017 Adjust GmbH. All rights reserved. +// + +#import "ATAAdjustDelegateEventFailure.h" + +@interface ATAAdjustDelegateEventFailure () + +@property (nonatomic, strong) ATLTestLibrary *testLibrary; +@property (nonatomic, copy) NSString *basePath; + +@end + +@implementation ATAAdjustDelegateEventFailure + +- (id)initWithTestLibrary:(ATLTestLibrary *)testLibrary andBasePath:(NSString *)basePath { + self = [super init]; + + if (nil == self) { + return nil; + } + + self.testLibrary = testLibrary; + self.basePath = basePath; + + return self; +} + +- (void)adjustEventTrackingFailed:(ADJEventFailure *)eventFailureResponseData { + NSLog(@"Event failure callback called!"); + NSLog(@"Event failure data: %@", eventFailureResponseData); + + [self.testLibrary addInfoToSend:@"message" value:eventFailureResponseData.message]; + [self.testLibrary addInfoToSend:@"timestamp" value:eventFailureResponseData.timeStamp]; + [self.testLibrary addInfoToSend:@"adid" value:eventFailureResponseData.adid]; + [self.testLibrary addInfoToSend:@"eventToken" value:eventFailureResponseData.eventToken]; + [self.testLibrary addInfoToSend:@"willRetry" value:(eventFailureResponseData.willRetry ? @"true" : @"false")]; + + NSError *error; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:eventFailureResponseData.jsonResponse + options:NSJSONWritingPrettyPrinted + error:&error]; + + if (!jsonData) { + NSLog(@"Unable to conver NSDictionary with JSON response to JSON string: %@", error); + } else { + NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + [self.testLibrary addInfoToSend:@"jsonResponse" value:jsonString]; + } + + [self.testLibrary sendInfoToServer:self.basePath]; +} + +@end diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateEventSuccess.h b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateEventSuccess.h new file mode 100644 index 000000000..129bbece5 --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateEventSuccess.h @@ -0,0 +1,17 @@ +// +// ATAAdjustDelegateEventSuccess.h +// AdjustTestApp +// +// Created by Uglješa Erceg (uerceg) on 8th December 2017. +// Copyright © 2017 Adjust GmbH. All rights reserved. +// + +#import +#import "Adjust.h" +#import "ATLTestLibrary.h" + +@interface ATAAdjustDelegateEventSuccess : NSObject + +- (id)initWithTestLibrary:(ATLTestLibrary *)testLibrary andBasePath:(NSString *)basePath; + +@end diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateEventSuccess.m b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateEventSuccess.m new file mode 100644 index 000000000..bfe2b33d6 --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateEventSuccess.m @@ -0,0 +1,57 @@ +// +// ATAAdjustDelegateEventSuccess.m +// AdjustTestApp +// +// Created by Uglješa Erceg (uerceg) on 8th December 2017. +// Copyright © 2017 Adjust GmbH. All rights reserved. +// + +#import "ATAAdjustDelegateEventSuccess.h" + +@interface ATAAdjustDelegateEventSuccess () + +@property (nonatomic, strong) ATLTestLibrary *testLibrary; +@property (nonatomic, copy) NSString *basePath; + +@end + +@implementation ATAAdjustDelegateEventSuccess + +- (id)initWithTestLibrary:(ATLTestLibrary *)testLibrary andBasePath:(NSString *)basePath { + self = [super init]; + + if (nil == self) { + return nil; + } + + self.testLibrary = testLibrary; + self.basePath = basePath; + + return self; +} + +- (void)adjustEventTrackingSucceeded:(ADJEventSuccess *)eventSuccessResponseData { + NSLog(@"Event success callback called!"); + NSLog(@"Event success data: %@", eventSuccessResponseData); + + [self.testLibrary addInfoToSend:@"message" value:eventSuccessResponseData.message]; + [self.testLibrary addInfoToSend:@"timestamp" value:eventSuccessResponseData.timeStamp]; + [self.testLibrary addInfoToSend:@"adid" value:eventSuccessResponseData.adid]; + [self.testLibrary addInfoToSend:@"eventToken" value:eventSuccessResponseData.eventToken]; + + NSError *error; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:eventSuccessResponseData.jsonResponse + options:NSJSONWritingPrettyPrinted + error:&error]; + + if (!jsonData) { + NSLog(@"Unable to conver NSDictionary with JSON response to JSON string: %@", error); + } else { + NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + [self.testLibrary addInfoToSend:@"jsonResponse" value:jsonString]; + } + + [self.testLibrary sendInfoToServer:self.basePath]; +} + +@end diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateSessionFailure.h b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateSessionFailure.h new file mode 100644 index 000000000..70f1e939b --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateSessionFailure.h @@ -0,0 +1,17 @@ +// +// ATAAdjustDelegateSessionFailure.h +// AdjustTestApp +// +// Created by Uglješa Erceg (uerceg) on 8th December 2017. +// Copyright © 2017 Adjust GmbH. All rights reserved. +// + +#import +#import "Adjust.h" +#import "ATLTestLibrary.h" + +@interface ATAAdjustDelegateSessionFailure : NSObject + +- (id)initWithTestLibrary:(ATLTestLibrary *)testLibrary andBasePath:(NSString *)basePath; + +@end diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateSessionFailure.m b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateSessionFailure.m new file mode 100644 index 000000000..e1008cc7e --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateSessionFailure.m @@ -0,0 +1,57 @@ +// +// ATAAdjustDelegateSessionFailure.m +// AdjustTestApp +// +// Created by Uglješa Erceg (uerceg) on 8th December 2017. +// Copyright © 2017 Adjust GmbH. All rights reserved. +// + +#import "ATAAdjustDelegateSessionFailure.h" + +@interface ATAAdjustDelegateSessionFailure () + +@property (nonatomic, strong) ATLTestLibrary *testLibrary; +@property (nonatomic, copy) NSString *basePath; + +@end + +@implementation ATAAdjustDelegateSessionFailure + +- (id)initWithTestLibrary:(ATLTestLibrary *)testLibrary andBasePath:(NSString *)basePath { + self = [super init]; + + if (nil == self) { + return nil; + } + + self.testLibrary = testLibrary; + self.basePath = basePath; + + return self; +} + +- (void)adjustSessionTrackingFailed:(ADJSessionFailure *)sessionFailureResponseData { + NSLog(@"Session failure callback called!"); + NSLog(@"Session failure data: %@", sessionFailureResponseData); + + [self.testLibrary addInfoToSend:@"message" value:sessionFailureResponseData.message]; + [self.testLibrary addInfoToSend:@"timestamp" value:sessionFailureResponseData.timeStamp]; + [self.testLibrary addInfoToSend:@"adid" value:sessionFailureResponseData.adid]; + [self.testLibrary addInfoToSend:@"willRetry" value:(sessionFailureResponseData.willRetry ? @"true" : @"false")]; + + NSError *error; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:sessionFailureResponseData.jsonResponse + options:NSJSONWritingPrettyPrinted + error:&error]; + + if (!jsonData) { + NSLog(@"Unable to conver NSDictionary with JSON response to JSON string: %@", error); + } else { + NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + [self.testLibrary addInfoToSend:@"jsonResponse" value:jsonString]; + } + + [self.testLibrary sendInfoToServer:self.basePath]; +} + +@end diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateSessionSuccess.h b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateSessionSuccess.h new file mode 100644 index 000000000..134d419b4 --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateSessionSuccess.h @@ -0,0 +1,17 @@ +// +// ATAAdjustDelegateSessionSuccess.h +// AdjustTestApp +// +// Created by Uglješa Erceg (uerceg) on 8th December 2017. +// Copyright © 2017 Adjust GmbH. All rights reserved. +// + +#import +#import "Adjust.h" +#import "ATLTestLibrary.h" + +@interface ATAAdjustDelegateSessionSuccess : NSObject + +- (id)initWithTestLibrary:(ATLTestLibrary *)testLibrary andBasePath:(NSString *)basePath; + +@end diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateSessionSuccess.m b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateSessionSuccess.m new file mode 100644 index 000000000..ef7c717a4 --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/Delegates/ATAAdjustDelegateSessionSuccess.m @@ -0,0 +1,56 @@ +// +// ATAAdjustDelegateSessionSuccess.m +// AdjustTestApp +// +// Created by Uglješa Erceg (uerceg) on 8th December 2017. +// Copyright © 2017 Adjust GmbH. All rights reserved. +// + +#import "ATAAdjustDelegateSessionSuccess.h" + +@interface ATAAdjustDelegateSessionSuccess () + +@property (nonatomic, strong) ATLTestLibrary *testLibrary; +@property (nonatomic, copy) NSString *basePath; + +@end + +@implementation ATAAdjustDelegateSessionSuccess + +- (id)initWithTestLibrary:(ATLTestLibrary *)testLibrary andBasePath:(NSString *)basePath { + self = [super init]; + + if (nil == self) { + return nil; + } + + self.testLibrary = testLibrary; + self.basePath = basePath; + + return self; +} + +- (void)adjustSessionTrackingSucceeded:(ADJSessionSuccess *)sessionSuccessResponseData { + NSLog(@"Session success callback called!"); + NSLog(@"Session success data: %@", sessionSuccessResponseData); + + [self.testLibrary addInfoToSend:@"message" value:sessionSuccessResponseData.message]; + [self.testLibrary addInfoToSend:@"timestamp" value:sessionSuccessResponseData.timeStamp]; + [self.testLibrary addInfoToSend:@"adid" value:sessionSuccessResponseData.adid]; + + NSError *error; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:sessionSuccessResponseData.jsonResponse + options:NSJSONWritingPrettyPrinted + error:&error]; + + if (!jsonData) { + NSLog(@"Unable to conver NSDictionary with JSON response to JSON string: %@", error); + } else { + NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + [self.testLibrary addInfoToSend:@"jsonResponse" value:jsonString]; + } + + [self.testLibrary sendInfoToServer:self.basePath]; +} + +@end diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/Info.plist b/AdjustTests/AdjustTestApp/AdjustTestApp/Info.plist new file mode 100644 index 000000000..16be3b681 --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/ViewController.h b/AdjustTests/AdjustTestApp/AdjustTestApp/ViewController.h new file mode 100644 index 000000000..6dda4cee2 --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/ViewController.h @@ -0,0 +1,15 @@ +// +// ViewController.h +// AdjustTestApp +// +// Created by Pedro on 23.08.17. +// Copyright © 2017 adjust. All rights reserved. +// + +#import + +static NSString * baseUrl = @"http://127.0.0.1:8080"; + +@interface ViewController : UIViewController + +@end diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/ViewController.m b/AdjustTests/AdjustTestApp/AdjustTestApp/ViewController.m new file mode 100644 index 000000000..4be36a6bb --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/ViewController.m @@ -0,0 +1,52 @@ +// +// ViewController.m +// AdjustTestApp +// +// Created by Pedro on 23.08.17. +// Copyright © 2017 adjust. All rights reserved. +// + +#import "ViewController.h" +#import "Adjust.h" +#import "ATLTestLibrary.h" +#import "ATAAdjustCommandExecutor.h" +#import "ADJAdjustFactory.h" + +@interface ViewController () +@property (nonatomic, strong) ATLTestLibrary * testLibrary; +@property (nonatomic, strong) ATAAdjustCommandExecutor * adjustCommandExecutor; + +@end + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. + + self.adjustCommandExecutor = [[ATAAdjustCommandExecutor alloc] init]; + + self.testLibrary = [ATLTestLibrary testLibraryWithBaseUrl:baseUrl andCommandDelegate:self.adjustCommandExecutor]; + + [self.adjustCommandExecutor setTestLibrary:self.testLibrary]; + + // [self.testLibrary addTestDirectory:@"current/sdkInfo"]; + // [self.testLibrary addTest:@"current/appSecret/Test_AppSecret_no_secret"]; + + [self startTestSession]; +} + +- (void)startTestSession { + [self.testLibrary startTestSession:@"ios4.12.2"]; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} +- (IBAction)restartTestClick:(UIButton *)sender { + [self startTestSession]; +} + + +@end diff --git a/AdjustTests/AdjustTestApp/AdjustTestApp/main.m b/AdjustTests/AdjustTestApp/AdjustTestApp/main.m new file mode 100644 index 000000000..0dfcd5617 --- /dev/null +++ b/AdjustTests/AdjustTestApp/AdjustTestApp/main.m @@ -0,0 +1,16 @@ +// +// main.m +// AdjustTestApp +// +// Created by Pedro on 11.01.18. +// Copyright © 2018 adjust. All rights reserved. +// + +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/AdjustTests/AdjustTestLibrary/AdjustTestLibrary.xcodeproj/project.pbxproj b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary.xcodeproj/project.pbxproj new file mode 100644 index 000000000..b217045f1 --- /dev/null +++ b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary.xcodeproj/project.pbxproj @@ -0,0 +1,315 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 48; + objects = { + +/* Begin PBXBuildFile section */ + 6F08425A2007782600568A31 /* ATLControlChannel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F08424D2007782500568A31 /* ATLControlChannel.m */; }; + 6F08425C2007782600568A31 /* ATLTestLibrary.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F08424F2007782500568A31 /* ATLTestLibrary.m */; }; + 6F08425D2007782600568A31 /* ATLTestInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F0842532007782500568A31 /* ATLTestInfo.m */; }; + 6F08425E2007782600568A31 /* ATLUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F0842562007782500568A31 /* ATLUtil.m */; }; + 6F08425F2007782600568A31 /* ATLUtilNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F0842582007782600568A31 /* ATLUtilNetworking.m */; }; + 6FFCFE752007AE0000467F01 /* ATLBlockingQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 6FFCFE742007AE0000467F01 /* ATLBlockingQueue.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 6F08420A2007766700568A31 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/$(PRODUCT_NAME)"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 6F08420C2007766700568A31 /* libAdjustTestLibrary.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libAdjustTestLibrary.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 6F08424D2007782500568A31 /* ATLControlChannel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATLControlChannel.m; sourceTree = ""; }; + 6F08424F2007782500568A31 /* ATLTestLibrary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATLTestLibrary.m; sourceTree = ""; }; + 6F0842502007782500568A31 /* ATLControlChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATLControlChannel.h; sourceTree = ""; }; + 6F0842522007782500568A31 /* ATLTestInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATLTestInfo.h; sourceTree = ""; }; + 6F0842532007782500568A31 /* ATLTestInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATLTestInfo.m; sourceTree = ""; }; + 6F0842542007782500568A31 /* ATLUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATLUtil.h; sourceTree = ""; }; + 6F0842552007782500568A31 /* ATLUtilNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATLUtilNetworking.h; sourceTree = ""; }; + 6F0842562007782500568A31 /* ATLUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATLUtil.m; sourceTree = ""; }; + 6F0842572007782600568A31 /* ATLTestLibrary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATLTestLibrary.h; sourceTree = ""; }; + 6F0842582007782600568A31 /* ATLUtilNetworking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ATLUtilNetworking.m; sourceTree = ""; }; + 6F0842592007782600568A31 /* ATLConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATLConstants.h; sourceTree = ""; }; + 6FFCFE732007AE0000467F01 /* ATLBlockingQueue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ATLBlockingQueue.h; sourceTree = ""; }; + 6FFCFE742007AE0000467F01 /* ATLBlockingQueue.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ATLBlockingQueue.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 6F0842092007766700568A31 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 6F0842032007766700568A31 = { + isa = PBXGroup; + children = ( + 6F08420E2007766700568A31 /* AdjustTestLibrary */, + 6F08420D2007766700568A31 /* Products */, + ); + sourceTree = ""; + }; + 6F08420D2007766700568A31 /* Products */ = { + isa = PBXGroup; + children = ( + 6F08420C2007766700568A31 /* libAdjustTestLibrary.a */, + ); + name = Products; + sourceTree = ""; + }; + 6F08420E2007766700568A31 /* AdjustTestLibrary */ = { + isa = PBXGroup; + children = ( + 6F0842592007782600568A31 /* ATLConstants.h */, + 6F0842502007782500568A31 /* ATLControlChannel.h */, + 6F08424D2007782500568A31 /* ATLControlChannel.m */, + 6F0842522007782500568A31 /* ATLTestInfo.h */, + 6F0842532007782500568A31 /* ATLTestInfo.m */, + 6F0842572007782600568A31 /* ATLTestLibrary.h */, + 6F08424F2007782500568A31 /* ATLTestLibrary.m */, + 6F0842542007782500568A31 /* ATLUtil.h */, + 6F0842562007782500568A31 /* ATLUtil.m */, + 6F0842552007782500568A31 /* ATLUtilNetworking.h */, + 6F0842582007782600568A31 /* ATLUtilNetworking.m */, + 6FFCFE732007AE0000467F01 /* ATLBlockingQueue.h */, + 6FFCFE742007AE0000467F01 /* ATLBlockingQueue.m */, + ); + path = AdjustTestLibrary; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 6F08420B2007766700568A31 /* AdjustTestLibrary */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6F0842152007766700568A31 /* Build configuration list for PBXNativeTarget "AdjustTestLibrary" */; + buildPhases = ( + 6F0842082007766700568A31 /* Sources */, + 6F0842092007766700568A31 /* Frameworks */, + 6F08420A2007766700568A31 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = AdjustTestLibrary; + productName = AdjustTestLibrary; + productReference = 6F08420C2007766700568A31 /* libAdjustTestLibrary.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 6F0842042007766700568A31 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0920; + ORGANIZATIONNAME = adjust; + TargetAttributes = { + 6F08420B2007766700568A31 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 6F0842072007766700568A31 /* Build configuration list for PBXProject "AdjustTestLibrary" */; + compatibilityVersion = "Xcode 8.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 6F0842032007766700568A31; + productRefGroup = 6F08420D2007766700568A31 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 6F08420B2007766700568A31 /* AdjustTestLibrary */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 6F0842082007766700568A31 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6F08425C2007782600568A31 /* ATLTestLibrary.m in Sources */, + 6F08425F2007782600568A31 /* ATLUtilNetworking.m in Sources */, + 6F08425D2007782600568A31 /* ATLTestInfo.m in Sources */, + 6F08425A2007782600568A31 /* ATLControlChannel.m in Sources */, + 6FFCFE752007AE0000467F01 /* ATLBlockingQueue.m in Sources */, + 6F08425E2007782600568A31 /* ATLUtil.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 6F0842132007766700568A31 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 6F0842142007766700568A31 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 6F0842162007766700568A31 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = QGUGW9AUMK; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 6F0842172007766700568A31 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = QGUGW9AUMK; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 6F0842072007766700568A31 /* Build configuration list for PBXProject "AdjustTestLibrary" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6F0842132007766700568A31 /* Debug */, + 6F0842142007766700568A31 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 6F0842152007766700568A31 /* Build configuration list for PBXNativeTarget "AdjustTestLibrary" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6F0842162007766700568A31 /* Debug */, + 6F0842172007766700568A31 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 6F0842042007766700568A31 /* Project object */; +} diff --git a/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLBlockingQueue.h b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLBlockingQueue.h new file mode 100644 index 000000000..d61fddbae --- /dev/null +++ b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLBlockingQueue.h @@ -0,0 +1,27 @@ +// +// ATLBlockingQueue.h +// AdjustTestLibrary +// +// Created by Pedro on 11.01.18. +// Copyright © 2018 adjust. All rights reserved. +// + +#import +#import "ATLUtil.h" + +@interface ATLBlockingQueue : NSObject + +/** + * Enqueues an object to the queue. + * @param object Object to enqueue + */ +- (void)enqueue:(id)object; + +/** + * Dequeues an object from the queue. This method will block. + */ +- (id)dequeue; + +- (void)teardown; + +@end diff --git a/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLBlockingQueue.m b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLBlockingQueue.m new file mode 100644 index 000000000..4d23f8489 --- /dev/null +++ b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLBlockingQueue.m @@ -0,0 +1,85 @@ +// +// ATLBlockingQueue.m +// AdjustTestLibrary +// +// Created by Pedro on 11.01.18. +// Copyright © 2018 adjust. All rights reserved. +// Adapted from https://github.com/adamk77/MKBlockingQueue/blob/master/MKBlockingQueue/MKBlockingQueue.m +// + +#import "ATLBlockingQueue.h" + +@interface ATLBlockingQueue() + +@property (nonatomic, strong) NSMutableArray *queue; +@property (nonatomic, strong) NSCondition *lock; +@property (nonatomic, strong) NSOperationQueue* operationQueue; + +@end + +@implementation ATLBlockingQueue + +- (id)init +{ + self = [super init]; + if (self) + { + self.queue = [[NSMutableArray alloc] init]; + self.lock = [[NSCondition alloc] init]; + self.operationQueue = [[NSOperationQueue alloc] init]; + [self.operationQueue setMaxConcurrentOperationCount:1]; + } + return self; +} + +- (void)enqueue:(id)object +{ + [_lock lock]; + [_queue addObject:object]; + [_lock signal]; + [_lock unlock]; +} + +- (id)dequeue +{ + __block id object; + [ATLUtil addOperationAfterLast:self.operationQueue blockWithOperation:^(NSBlockOperation * operation) { + [_lock lock]; + while (_queue.count == 0) + { + if (operation.cancelled) { + [_lock unlock]; + return; + } + [_lock wait]; + } + if (operation.cancelled) { + [_lock unlock]; + return; + } + object = [_queue objectAtIndex:0]; + [_queue removeObjectAtIndex:0]; + [_lock unlock]; + }]; + [self.operationQueue waitUntilAllOperationsAreFinished]; + + return object; +} + +- (void)teardown { + if (self.lock == nil) { + return; + } + [_lock lock]; + if (self.queue != nil) { + [self.queue removeAllObjects]; + } + self.queue = nil; + if (self.operationQueue != nil) { + [self.operationQueue cancelAllOperations]; + } + [_lock unlock]; + self.lock = nil; +} + +@end diff --git a/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLConstants.h b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLConstants.h new file mode 100644 index 000000000..d4d17ef10 --- /dev/null +++ b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLConstants.h @@ -0,0 +1,23 @@ +// +// ATLConstants.h +// AdjustTestLibrary +// +// Created by Pedro on 20.04.17. +// Copyright © 2017 adjust. All rights reserved. +// + +#ifndef ATLConstants_h +#define ATLConstants_h + +static NSString * const TEST_SCRIPT_HEADER = @"TestScript"; +static NSString * const TEST_SESSION_END_HEADER = @"TestSessionEnd"; +static NSString * const TEST_CANCELTEST_HEADER = @"CancelTest"; +static NSString * const TEST_ENDWAIT_HEADER = @"EndWait"; +static NSString * const TEST_LIBRARY_CLASSNAME = @"TestLibrary"; +static NSString * const ADJUST_CLASSNAME = @"Adjust"; +static NSString * const WAIT_FOR_CONTROL = @"control"; +static NSString * const WAIT_FOR_SLEEP = @"sleep"; +static NSString * const BASE_PATH_PARAM = @"basePath"; +static NSString * const TEST_NAME_PARAM = @"basePath"; + +#endif /* ATLConstants_h */ diff --git a/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLControlChannel.h b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLControlChannel.h new file mode 100644 index 000000000..377f35aa6 --- /dev/null +++ b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLControlChannel.h @@ -0,0 +1,18 @@ +// +// ATLControlChannel.h +// AdjustTestLibrary +// +// Created by Pedro on 23.08.17. +// Copyright © 2017 adjust. All rights reserved. +// + +#import +#import "ATLTestLibrary.h" + +@interface ATLControlChannel : NSObject + +- (id)initWithTestLibrary:(ATLTestLibrary *)testLibrary; + +- (void)teardown; + +@end diff --git a/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLControlChannel.m b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLControlChannel.m new file mode 100644 index 000000000..6df83af57 --- /dev/null +++ b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLControlChannel.m @@ -0,0 +1,112 @@ +// +// ATLControlChannel.m +// AdjustTestLibrary +// +// Created by Pedro on 23.08.17. +// Copyright © 2017 adjust. All rights reserved. +// + +#import "ATLControlChannel.h" +#import "ATLUtil.h" +#import "ATLConstants.h" +#import "ATLUtilNetworking.h" + +static NSString * const CONTROL_START_PATH = @"/control_start"; +static NSString * const CONTROL_CONTINUE_PATH = @"/control_continue"; + +@interface ATLControlChannel() + +@property (nonatomic, strong) NSOperationQueue* operationQueue; +//@property (nonatomic, strong) ATLTestLibrary * testLibrary; +@property (nonatomic, weak) ATLTestLibrary * testLibrary; +@property (nonatomic, assign) BOOL closed; +@end + +@implementation ATLControlChannel + +- (id)initWithTestLibrary:(ATLTestLibrary *)testLibrary { + self = [super init]; + if (self == nil) return nil; + + self.testLibrary = testLibrary; + + self.operationQueue = [[NSOperationQueue alloc] init]; + [self.operationQueue setMaxConcurrentOperationCount:1]; + + self.closed = NO; + + [self sendControlRequest:CONTROL_START_PATH]; + + return self; +} + +- (void)teardown { + self.closed = YES; + if (self.operationQueue != nil) { + [ATLUtil debug:@"queue cancel control channel thread queue"]; + [ATLUtil addOperationAfterLast:self.operationQueue + block:^{ + [ATLUtil debug:@"cancel control channel thread queue"]; + if (self.operationQueue != nil) { + [self.operationQueue cancelAllOperations]; + } + self.operationQueue = nil; + self.testLibrary = nil; + }]; + } else { + self.operationQueue = nil; + self.testLibrary = nil; + } +} + +- (void)sendControlRequest:(NSString *)controlPath { + [ATLUtil addOperationAfterLast:self.operationQueue + block:^{ + NSDate *timeBefore = [NSDate date]; + [ATLUtil debug:@"time before wait: %@", [ATLUtil formatDate:timeBefore]]; + + ATLHttpRequest * requestData = [[ATLHttpRequest alloc] init]; + requestData.path = [ATLUtilNetworking appendBasePath:[self.testLibrary currentBasePath] path:controlPath]; + + [ATLUtilNetworking sendPostRequest:requestData + responseHandler:^(ATLHttpResponse *httpResponse) { + NSDate *timeAfter = [NSDate date]; + [ATLUtil debug:@"time after wait: %@", [ATLUtil formatDate:timeAfter]]; + NSTimeInterval timeElapsedSeconds = [timeAfter timeIntervalSinceDate:timeBefore]; + [ATLUtil debug:@"seconds elapsed waiting %f", timeElapsedSeconds]; + + [self readHeaders:httpResponse]; + }]; + }]; +} +- (void)readHeaders:(ATLHttpResponse *)httpResponse { + [ATLUtil addOperationAfterLast:self.operationQueue blockWithOperation:^(NSBlockOperation * operation) { + [self readHeadersI:httpResponse]; + }]; +} +- (void)readHeadersI:(ATLHttpResponse *)httpResponse { + if (self.closed) { + [ATLUtil debug:@"control channel already closed"]; + return; + } + + if ([httpResponse.headerFields objectForKey:TEST_CANCELTEST_HEADER]) { + [ATLUtil debug:@"Test canceled due to %@", httpResponse.headerFields[TEST_CANCELTEST_HEADER]]; + [self.testLibrary resetTestLibrary]; + [ATLUtil debug:@"control channel send readResponse to test library"]; + [self.testLibrary readResponse:httpResponse]; + } + + if ([httpResponse.headerFields objectForKey:TEST_ENDWAIT_HEADER]) { + NSString * waitEndReason = httpResponse.headerFields[TEST_ENDWAIT_HEADER]; + [self sendControlRequest:CONTROL_CONTINUE_PATH]; + [self endWait:waitEndReason]; + } +} + +- (void)endWait:(NSString *)waitEndReason { + [ATLUtil debug:@"End wait from control channel due to %@", waitEndReason]; + [[self.testLibrary waitControlQueue] enqueue:waitEndReason]; + [ATLUtil debug:@"Wait ended from control channel due to %@", waitEndReason]; +} +@end diff --git a/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLTestInfo.h b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLTestInfo.h new file mode 100644 index 000000000..06ac38a0f --- /dev/null +++ b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLTestInfo.h @@ -0,0 +1,23 @@ +// +// ATLTestInfo.h +// AdjustTestLibrary +// +// Created by Pedro on 01.11.17. +// Copyright © 2017 adjust. All rights reserved. +// + +#import +#import "ATLTestLibrary.h" + +@interface ATLTestInfo : NSObject + +- (id)initWithTestLibrary:(ATLTestLibrary *)testLibrary; + +- (void)teardown; + +- (void)addInfoToSend:(NSString *)key + value:(NSString *)value; + +- (void)sendInfoToServer:(NSString *)currentBasePath; + +@end diff --git a/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLTestInfo.m b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLTestInfo.m new file mode 100644 index 000000000..42717ff34 --- /dev/null +++ b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLTestInfo.m @@ -0,0 +1,105 @@ +// +// ATLTestInfo.m +// AdjustTestLibrary +// +// Created by Pedro on 01.11.17. +// Copyright © 2017 adjust. All rights reserved. +// + +#import "ATLTestInfo.h" +#import "ATLUtil.h" + +static NSString * const TEST_INFO_PATH = @"/test_info"; + +@interface ATLTestInfo() + +@property (nonatomic, strong) NSOperationQueue* operationQueue; +@property (nonatomic, strong) NSMutableDictionary *infoToServer; +@property (nonatomic, weak) ATLTestLibrary * testLibrary; +@property (nonatomic, assign) BOOL closed; + +@end + +@implementation ATLTestInfo + +- (id)initWithTestLibrary:(ATLTestLibrary *)testLibrary { + self = [super init]; + if (self == nil) return nil; + + self.testLibrary = testLibrary; + + self.operationQueue = [[NSOperationQueue alloc] init]; + [self.operationQueue setMaxConcurrentOperationCount:1]; + + self.closed = NO; + + return self; +} + +- (void)teardown { + self.closed = YES; + if (self.operationQueue != nil) { + [ATLUtil debug:@"queue cancel test info thread queue"]; + [ATLUtil addOperationAfterLast:self.operationQueue + block:^{ + [ATLUtil debug:@"cancel test info thread queue"]; + if (self.operationQueue != nil) { + [self.operationQueue cancelAllOperations]; + } + self.operationQueue = nil; + self.testLibrary = nil; + }]; + } else { + self.operationQueue = nil; + self.testLibrary = nil; + } +} + +- (void)addInfoToSend:(NSString *)key + value:(NSString *)value { + [ATLUtil addOperationAfterLast:self.operationQueue + block:^{ + [self addInfoToSendI:key value:value]; + }]; +} + +- (void)addInfoToSendI:(NSString *)key + value:(NSString *)value { + if (key == nil || value == nil) { + return; + } + if (self.infoToServer == nil) { + self.infoToServer = [[NSMutableDictionary alloc] init]; + } + + [self.infoToServer setObject:value forKey:key]; +} + +- (void)sendInfoToServer:(NSString *)currentBasePath { + [ATLUtil addOperationAfterLast:self.operationQueue + block:^{ + [self sendInfoToServerI:currentBasePath]; + }]; +} + + +- (void)sendInfoToServerI:(NSString *)currentBasePath { + [ATLUtil debug:@"sendInfoToServer"]; + + ATLHttpRequest * requestData = [[ATLHttpRequest alloc] init]; + + requestData.path = [ATLUtil appendBasePath:currentBasePath path:TEST_INFO_PATH]; + + if (self.infoToServer) { + requestData.bodyString = [ATLUtil queryString:self.infoToServer]; + } + + [ATLUtilNetworking sendPostRequest:requestData + responseHandler:^(ATLHttpResponse *httpResponse) { + self.infoToServer = nil; + [self.testLibrary readResponse:httpResponse]; + }]; +} + + +@end diff --git a/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLTestLibrary.h b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLTestLibrary.h new file mode 100644 index 000000000..80948937e --- /dev/null +++ b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLTestLibrary.h @@ -0,0 +1,54 @@ +// +// AdjustTestLibrary.h +// AdjustTestLibrary +// +// Created by Pedro on 18.04.17. +// Copyright © 2017 adjust. All rights reserved. +// + +#import +#import "ATLUtilNetworking.h" +#import "ATLBlockingQueue.h" + +@protocol AdjustCommandDelegate +@optional +- (void)executeCommand:(NSString *)className + methodName:(NSString *)methodName + parameters:(NSDictionary *)parameters; + +- (void)executeCommand:(NSString *)className + methodName:(NSString *)methodName + jsonParameters:(NSString *)jsonParameters; + +- (void)executeCommandRawJson:(NSString *)json; +@end + +@interface ATLTestLibrary : NSObject + +- (id)initWithBaseUrl:(NSString *)baseUrl + andCommandDelegate:(NSObject *)commandDelegate; + +- (void)addTest:(NSString *)testName; + +- (void)addTestDirectory:(NSString *)testDirectory; + +- (void)startTestSession:(NSString *)clientSdk; + +- (NSString *)currentBasePath; +- (ATLBlockingQueue *)waitControlQueue; + +- (void)resetTestLibrary; + +- (void)readResponse:(ATLHttpResponse *)httpResponse; + +- (void)addInfoToSend:(NSString *)key + value:(NSString *)value; + +- (void)sendInfoToServer:(NSString *)basePath; + ++ (ATLTestLibrary *)testLibraryWithBaseUrl:(NSString *)baseUrl +andCommandDelegate:(NSObject *)commandDelegate; + ++ (NSURL *)baseUrl; + +@end diff --git a/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLTestLibrary.m b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLTestLibrary.m new file mode 100644 index 000000000..7b6eca729 --- /dev/null +++ b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLTestLibrary.m @@ -0,0 +1,323 @@ +// +// AdjustTestLibrary.m +// AdjustTestLibrary +// +// Created by Pedro on 18.04.17. +// Copyright © 2017 adjust. All rights reserved. +// + +#import "ATLTestLibrary.h" +#import "ATLUtil.h" +#import "ATLConstants.h" +#import "ATLControlChannel.h" +#import "ATLTestInfo.h" +#import "ATLBlockingQueue.h" + +//static const char * const kInternalQueueName = "com.adjust.TestLibrary"; + +@interface ATLTestLibrary() + +@property (nonatomic, weak, nullable) NSObject *commandDelegate; +//@property (nonatomic, strong) dispatch_queue_t internalQueue; +@property (nonatomic, strong) NSOperationQueue* operationQueue; + +@property (nonatomic, copy) NSString *currentBasePath; +@property (nonatomic, copy) NSString *currentTestName; +//@property (nonatomic, copy) NSString *baseUrl; +@property (nonatomic, strong) ATLBlockingQueue *waitControlQueue; +@property (nonatomic, strong) ATLControlChannel *controlChannel; +@property (nonatomic, strong) NSMutableString *testNames; + +@property (nonatomic, strong) ATLTestInfo *infoToServer; + +@end + +@implementation ATLTestLibrary + +static NSURL * _baseUrl = nil; + ++ (NSURL *)baseUrl { + return _baseUrl; +} + ++ (ATLTestLibrary *)testLibraryWithBaseUrl:(NSString *)baseUrl + andCommandDelegate:(NSObject *)commandDelegate { + return [[ATLTestLibrary alloc] initWithBaseUrl:baseUrl + andCommandDelegate:commandDelegate]; +} +- (id)initWithBaseUrl:(NSString *)baseUrl + andCommandDelegate:(NSObject *)commandDelegate; +{ + self = [super init]; + if (self == nil) return nil; + + _baseUrl = [NSURL URLWithString:baseUrl]; + //self.baseUrl = baseUrl; + self.commandDelegate = commandDelegate; + self.testNames = [[NSMutableString alloc] init]; + + return self; +} + +- (void)addTest:(NSString *)testName { + [self.testNames appendString:testName]; + + if (![testName hasSuffix:@";"]) { + [self.testNames appendString:@";"]; + } +} + +- (void)addTestDirectory:(NSString *)testDirectory { + [self.testNames appendString:testDirectory]; + + if (![testDirectory hasSuffix:@"/"] || ![testDirectory hasSuffix:@"/;"]) { + [self.testNames appendString:@"/"]; + } + + if (![testDirectory hasSuffix:@";"]) { + [self.testNames appendString:@";"]; + } +} + +- (void)startTestSession:(NSString *)clientSdk { + [self resetTestLibrary]; + [ATLUtil addOperationAfterLast:self.operationQueue blockWithOperation:^(NSBlockOperation * operation) { + [self sendTestSessionI:clientSdk]; + }]; +} + +- (void)resetTestLibrary { + [self teardown]; + + [self initTestLibrary]; +} + +- (void)teardown { + if (self.operationQueue != nil) { + [ATLUtil debug:@"queue cancel test library thread queue"]; + [ATLUtil addOperationAfterLast:self.operationQueue + block:^{ + [ATLUtil debug:@"cancel test library thread queue"]; + if (self.operationQueue != nil) { + [self.operationQueue cancelAllOperations]; + } + self.operationQueue = nil; + }]; + [self.operationQueue cancelAllOperations]; + } + [self clearTest]; +} + +- (void)clearTest { + if (self.waitControlQueue != nil) { + [self.waitControlQueue teardown]; + } + self.waitControlQueue = nil; + if (self.controlChannel != nil) { + [self.controlChannel teardown]; + } + self.controlChannel = nil; + if (self.infoToServer != nil) { + [self.infoToServer teardown]; + } + self.infoToServer = nil; +} + +- (void) initTestLibrary { + self.waitControlQueue = [[ATLBlockingQueue alloc] init]; + + self.operationQueue = [[NSOperationQueue alloc] init]; + [self.operationQueue setMaxConcurrentOperationCount:1]; +} + +// reset for each test +- (void)resetForNextTest { + [self clearTest]; + + [self initTest]; +} + +- (void)initTest { + self.waitControlQueue = [[ATLBlockingQueue alloc] init]; + self.controlChannel = [[ATLControlChannel alloc] initWithTestLibrary:self]; + self.infoToServer = [[ATLTestInfo alloc] initWithTestLibrary:self]; +} + +- (void)addInfoToSend:(NSString *)key + value:(NSString *)value { + [self.infoToServer addInfoToSend:key value:value]; +} + +- (void)sendInfoToServer:(NSString *)basePath { + [self.infoToServer sendInfoToServer:basePath]; +} + +- (void)sendTestSessionI:(NSString *)clientSdk { + ATLHttpRequest * requestData = [[ATLHttpRequest alloc] init]; + + NSMutableDictionary * headerFields = [NSMutableDictionary dictionaryWithObjectsAndKeys:clientSdk, @"Client-SDK", nil]; + + if (self.testNames != nil) { + [headerFields setObject:self.testNames forKey:@"Test-Names"]; + } + + requestData.headerFields = headerFields; + requestData.path = @"/init_session"; + + [ATLUtilNetworking sendPostRequest:requestData + responseHandler:^(ATLHttpResponse *httpResponse) { + [self readResponse:httpResponse]; + }]; +} + +- (void)readResponse:(ATLHttpResponse *)httpResponse { + [ATLUtil addOperationAfterLast:self.operationQueue blockWithOperation:^(NSBlockOperation * operation) { + [self readResponseI:operation httpResponse:httpResponse]; + }]; +} +- (void)readResponseI:(NSBlockOperation *)operation + httpResponse:(ATLHttpResponse *)httpResponse { + if (httpResponse == nil) { + [ATLUtil debug:@"httpResponse is null"]; + return; + } + [self execTestCommandsI:operation jsonFoundation:httpResponse.jsonFoundation]; +} +- (void)execTestCommandsI:(NSBlockOperation *)operation + jsonFoundation:(id)jsonFoundation { + NSArray * jsonArray = (NSArray *)jsonFoundation; + if (jsonArray == nil) { + [ATLUtil debug:@"jsonArray is nil"]; + return; + } + for (NSDictionary * testCommand in jsonArray) { + if (operation.cancelled) { + [ATLUtil debug:@"command execution cancelled"]; + return; + } + NSString * className = [testCommand objectForKey:@"className"]; + NSString * functionName = [testCommand objectForKey:@"functionName"]; + NSDictionary * params = [testCommand objectForKey:@"params"]; + [ATLUtil debug:@"className: %@, functionName: %@, params: %@", className, functionName, params]; + + NSDate *timeBefore = [NSDate date]; + [ATLUtil debug:@"time before %@", [ATLUtil formatDate:timeBefore]]; + + if ([className isEqualToString:TEST_LIBRARY_CLASSNAME]) { + [self execTestLibraryCommandI:functionName params:params]; + + NSDate *timeAfter = [NSDate date]; + [ATLUtil debug:@"time after %@", [ATLUtil formatDate:timeAfter]]; + NSTimeInterval timeElapsedSeconds = [timeAfter timeIntervalSinceDate:timeBefore]; + [ATLUtil debug:@"seconds elapsed %f", timeElapsedSeconds]; + + continue; + } + + if (![className isEqualToString:ADJUST_CLASSNAME]) { + [ATLUtil debug:@"className %@ is not valid", className]; + continue; + } + + if ([self.commandDelegate respondsToSelector:@selector(executeCommand:methodName:parameters:)]) { + [self.commandDelegate executeCommand:className methodName:functionName parameters:params]; + } else if ([self.commandDelegate respondsToSelector:@selector(executeCommand:methodName:jsonParameters:)]) { + NSString *paramsJsonString = [ATLUtil parseDictionaryToJsonString:params]; + [self.commandDelegate executeCommand:className methodName:functionName jsonParameters:paramsJsonString]; + } else if ([self.commandDelegate respondsToSelector:@selector(executeCommandRawJson:)]) { + NSString *commandJsonString = [ATLUtil parseDictionaryToJsonString:testCommand]; + [self.commandDelegate executeCommandRawJson:commandJsonString]; + } + + NSDate *timeAfter = [NSDate date]; + [ATLUtil debug:@"time after %@", [ATLUtil formatDate:timeAfter]]; + + NSTimeInterval timeElapsedSeconds = [timeAfter timeIntervalSinceDate:timeBefore]; + [ATLUtil debug:@"seconds elapsed %f", timeElapsedSeconds]; + } +} +/* +- (void)sendInfoToServerI { + [ATLUtil debug:@"sendInfoToServer"]; + + ATLHttpRequest * requestData = [[ATLHttpRequest alloc] init]; + + requestData.path = [ATLUtil appendBasePath:self.currentBasePath path:@"/test_info"]; + + if (self.infoToServer) { + requestData.bodyString = [ADJUtil queryString:self.infoToServer]; + } + + [ATLUtilNetworking sendPostRequest:requestData + responseHandler:^(ATLHttpResponse *httpResponse) { + self.infoToServer = nil; + [self readHeaders:httpResponse]; + }]; + +} +*/ + + +- (void)execTestLibraryCommandI:(NSString *)functionName + params:(NSDictionary *)params { + if ([functionName isEqualToString:@"resetTest"]) { + [self resetTestI:params]; + } else if ([functionName isEqualToString:@"endTestReadNext"]) { + [self endTestReadNextI]; + } else if ([functionName isEqualToString:@"endTestSession"]) { + [self endTestSessionI]; + } else if ([functionName isEqualToString:@"wait"]) { + [self waitI:params]; + } +} + +- (void)resetTestI:(NSDictionary *)params { + if ([params objectForKey:BASE_PATH_PARAM]) { + self.currentBasePath = [params objectForKey:BASE_PATH_PARAM][0]; + [ATLUtil debug:@"current base path %@", self.currentBasePath]; + } + + if ([params objectForKey:TEST_NAME_PARAM]) { + self.currentTestName = [params objectForKey:TEST_NAME_PARAM][0]; + [ATLUtil debug:@"current test name %@", self.currentTestName]; + } + + [self resetForNextTest]; +} + +- (void)endTestReadNextI { + ATLHttpRequest * requestData = [[ATLHttpRequest alloc] init]; + // send end test request + requestData.path = [ATLUtilNetworking appendBasePath:self.currentBasePath path:@"/end_test_read_next"]; + + // and process the next in the response + [ATLUtilNetworking sendPostRequest:requestData + responseHandler:^(ATLHttpResponse *httpResponse) { + [self readResponse:httpResponse]; + }]; +} + +- (void)endTestSessionI { + [self teardown]; + // TODO add exit after end +} + +- (void)waitI:(NSDictionary *)params { + if ([params objectForKey:WAIT_FOR_CONTROL]) { + NSString * waitExpectedReason = [params objectForKey:WAIT_FOR_CONTROL][0]; + [ATLUtil debug:@"wait for %@", waitExpectedReason]; + NSString * endReason = [self.waitControlQueue dequeue]; + [ATLUtil debug:@"wait ended due to %@", endReason]; + } + + if ([params objectForKey:WAIT_FOR_SLEEP]) { + NSString * millisToSleepS = [params objectForKey:WAIT_FOR_SLEEP][0]; + [ATLUtil debug:@"sleep for %@", millisToSleepS]; + + double secondsToSleep = [millisToSleepS intValue] / 1000; + [NSThread sleepForTimeInterval:secondsToSleep]; + + [ATLUtil debug:@"sleep ended"]; + } +} +@end diff --git a/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLUtil.h b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLUtil.h new file mode 100644 index 000000000..cffe9467a --- /dev/null +++ b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLUtil.h @@ -0,0 +1,30 @@ +// +// ATLUtil.h +// AdjustTestLibrary +// +// Created by Pedro on 18.04.17. +// Copyright © 2017 adjust. All rights reserved. +// + +#import + +typedef void (^selfInjectedBlock)(id); +typedef void (^operationBlock)(NSBlockOperation *); + +@interface ATLUtil : NSObject + ++ (void)debug:(NSString *)format, ...; ++ (void)launchInQueue:(dispatch_queue_t)queue + selfInject:(id)selfInject + block:(selfInjectedBlock)block; ++ (void)addOperationAfterLast:(NSOperationQueue *)operationQueue + block:(dispatch_block_t)block; ++ (void)addOperationAfterLast:(NSOperationQueue *)operationQueue + blockWithOperation:(operationBlock)blockWithOperation; ++ (BOOL)isNull:(id)value; ++ (NSString *)adjTrim:(NSString *)value; ++ (NSString *)formatDate:(NSDate *)value; ++ (NSString *)parseDictionaryToJsonString:(NSDictionary *) dictionary; ++ (NSString *)appendBasePath:(NSString *)basePath path:(NSString *)path; ++ (NSString *)queryString:(NSDictionary *)parameters; +@end diff --git a/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLUtil.m b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLUtil.m new file mode 100644 index 000000000..3a6e7750a --- /dev/null +++ b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLUtil.m @@ -0,0 +1,203 @@ +// +// ATLUtil.m +// AdjustTestLibrary +// +// Created by Pedro on 18.04.17. +// Copyright © 2017 adjust. All rights reserved. +// + +#import "ATLUtil.h" + +static NSString * const kLogTag = @"AdjustTestLibrary"; +static NSDateFormatter *dateFormat; + +static NSString * const kDateFormat = @"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'Z"; + +@implementation ATLUtil + ++ (void)initialize { + dateFormat = [[NSDateFormatter alloc] init]; + + if ([NSCalendar instancesRespondToSelector:@selector(calendarWithIdentifier:)]) { + // http://stackoverflow.com/a/3339787 + NSString *calendarIdentifier; + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wtautological-pointer-compare" + if (&NSCalendarIdentifierGregorian != NULL) { +#pragma clang diagnostic pop + calendarIdentifier = NSCalendarIdentifierGregorian; + } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunreachable-code" +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + calendarIdentifier = NSGregorianCalendar; +#pragma clang diagnostic pop + } + + dateFormat.calendar = [NSCalendar calendarWithIdentifier:calendarIdentifier]; + } + + dateFormat.locale = [NSLocale systemLocale]; + [dateFormat setDateFormat:kDateFormat]; +} + ++ (void)debug:(NSString *)format, ...{ + va_list parameters; va_start(parameters, format); + NSString *string = [[NSString alloc] initWithFormat:format arguments:parameters]; + va_end(parameters); + NSArray *lines = [string componentsSeparatedByString:@"\n"]; + for (NSString *line in lines) { + NSLog(@"\t[%@]: %@", kLogTag, line); + } +} + ++ (void)launchInQueue:(dispatch_queue_t)queue + selfInject:(id)selfInject + block:(selfInjectedBlock)block { + __weak __typeof__(selfInject) weakSelf = selfInject; + + dispatch_async(queue, ^{ + __typeof__(selfInject) strongSelf = weakSelf; + + if (strongSelf == nil) { + return; + } + + block(strongSelf); + }); +} + ++ (void)addOperationAfterLast:(NSOperationQueue *)operationQueue + blockWithOperation:(operationBlock)blockWithOperation +{ + // https://stackoverflow.com/a/8113307/2393678 + NSBlockOperation *operation = [[NSBlockOperation alloc] init]; + __weak __typeof__(NSBlockOperation *) weakOperation = operation; + + [operation addExecutionBlock:^{ + __typeof__(NSBlockOperation *) strongOperation = weakOperation; + + if (strongOperation == nil) { + return; + } + + if (strongOperation.cancelled) { + return; + } + + blockWithOperation(strongOperation); + }]; + + // https://stackoverflow.com/a/32701781/2393678 + NSOperation *lastOperation = operationQueue.operations.lastObject; + if (lastOperation != nil) { + [operation addDependency: lastOperation]; + } + + [operationQueue addOperation:operation]; +} + + ++ (void)addOperationAfterLast:(NSOperationQueue *)operationQueue + block:(dispatch_block_t)block +{ + // https://stackoverflow.com/a/8113307/2393678 + NSBlockOperation *operation = [[NSBlockOperation alloc] init]; + __weak __typeof__(NSBlockOperation *) weakOperation = operation; + + [operation addExecutionBlock:^{ + __typeof__(NSBlockOperation *) strongOperation = weakOperation; + + if (strongOperation == nil) { + return; + } + + if (strongOperation.cancelled) { + return; + } + + block(); + }]; + + // https://stackoverflow.com/a/32701781/2393678 + NSOperation *lastOperation = operationQueue.operations.lastObject; + if (lastOperation != nil) { + [operation addDependency: lastOperation]; + } + + [operationQueue addOperation:operation]; +} + ++ (BOOL)isNull:(id)value { + return value == nil || value == (id)[NSNull null]; +} + ++ (NSString *)adjTrim:(NSString *)value { + return [value stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; +} + ++ (NSString *)formatDate:(NSDate *)value { + if (dateFormat == nil) { + return nil; + } + return [dateFormat stringFromDate:value]; +} + ++ (NSString *)parseDictionaryToJsonString:(NSDictionary *) dictionary { + NSError *error; + NSData *data = [NSJSONSerialization dataWithJSONObject:dictionary + options:0 + error:&error]; + if (error != nil || data == nil) { + [ATLUtil debug:@"error parsing dictionary to json: %@", error.description]; + return nil; + } + return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; +} + ++ (NSString *)appendBasePath:(NSString *)basePath path:(NSString *)path { + if (basePath == nil) { + return path; + } else { + return [NSString stringWithFormat:@"%@%@", basePath, path]; + } +} + ++ (NSString *)queryString:(NSDictionary *)parameters { + if (parameters == nil) { + return nil; + } + NSMutableArray *pairs = [NSMutableArray array]; + + for (NSString *key in parameters) { + NSString *value = [parameters objectForKey:key]; + NSString *escapedValue = [ATLUtil urlEncode:value ]; + NSString *escapedKey = [ATLUtil urlEncode:key]; + NSString *pair = [NSString stringWithFormat:@"%@=%@", escapedKey, escapedValue]; + + [pairs addObject:pair]; + } + + NSString *queryString = [pairs componentsJoinedByString:@"&"]; + + return queryString; +} + ++ (NSString *)urlEncode:(NSString *)urlString { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + return (NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes( + NULL, + (CFStringRef)urlString, + NULL, + (CFStringRef)@"!*'\"();:@&=+$,/?%#[]% ", + CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding))); +#pragma clang diagnostic pop + + // Alternative: + // return [self stringByAddingPercentEncodingWithAllowedCharacters: + // [NSCharacterSet characterSetWithCharactersInString:@"!*'\"();:@&=+$,/?%#[]% "]]; +} + +@end diff --git a/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLUtilNetworking.h b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLUtilNetworking.h new file mode 100644 index 000000000..d7370b741 --- /dev/null +++ b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLUtilNetworking.h @@ -0,0 +1,37 @@ +// +// ATLUtilNetworking.h +// AdjustTestLibrary +// +// Created by Pedro on 18.04.17. +// Copyright © 2017 adjust. All rights reserved. +// + +#import + +@interface ATLHttpResponse : NSObject + +@property (nonatomic, copy) NSString *responseString; +@property (nonatomic, strong) id jsonFoundation; +@property (nonatomic, strong) NSDictionary *headerFields; +@property (nonatomic, assign) NSInteger statusCode; + +@end + +@interface ATLHttpRequest : NSObject + +@property (nonatomic, copy) NSString *path; +@property (nonatomic, copy) NSString *bodyString; +@property (nonatomic, strong) NSDictionary *headerFields; + +@end + +typedef void (^httpResponseHandler)(ATLHttpResponse* httpResponse); + +@interface ATLUtilNetworking : NSObject + ++ (void)sendPostRequest:(ATLHttpRequest *)requestData + responseHandler:(httpResponseHandler) responseHandler; + ++ (NSString *)appendBasePath:(NSString *)basePath + path:(NSString *)path; +@end diff --git a/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLUtilNetworking.m b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLUtilNetworking.m new file mode 100644 index 000000000..8bfa95cc9 --- /dev/null +++ b/AdjustTests/AdjustTestLibrary/AdjustTestLibrary/ATLUtilNetworking.m @@ -0,0 +1,206 @@ +// +// ATLUtilNetworking.m +// AdjustTestLibrary +// +// Created by Pedro on 18.04.17. +// Copyright © 2017 adjust. All rights reserved. +// + +#import "ATLUtilNetworking.h" +#import "ATLUtil.h" +#import "ATLTestLibrary.h" + +static const double kRequestTimeout = 60; // 60 seconds +static NSURLSessionConfiguration *urlSessionConfiguration = nil; + +@implementation ATLHttpResponse +@end + +@implementation ATLHttpRequest +@end + +@implementation ATLUtilNetworking + ++ (void)initialize { + if (self != [ATLUtilNetworking class]) { + return; + } + + [self initializeUrlSessionConfiguration]; +} + ++ (void)initializeUrlSessionConfiguration { + urlSessionConfiguration = [NSURLSessionConfiguration defaultSessionConfiguration]; +} + ++ (NSString *)appendBasePath:(NSString *)basePath + path:(NSString *)path { + if (basePath == nil) { + return path; + } + return [NSString stringWithFormat:@"%@%@", basePath, path]; +} + ++ (void)sendPostRequest:(ATLHttpRequest *)requestData + responseHandler:(httpResponseHandler)responseHandler +{ + NSMutableURLRequest *request = [ATLUtilNetworking requestForPackage:requestData]; + + [ATLUtilNetworking sendRequest:request + responseHandler:responseHandler]; +} + ++ (NSMutableURLRequest *)requestForPackage:(ATLHttpRequest *)requestData +{ + NSURL *url = [NSURL URLWithString:requestData.path relativeToURL:[ATLTestLibrary baseUrl]]; + NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; + request.timeoutInterval = kRequestTimeout; + request.HTTPMethod = @"POST"; + + [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; + + if (requestData.headerFields != nil) { + for (NSString *key in requestData.headerFields) { + [request setValue:requestData.headerFields[key] forHTTPHeaderField:key]; + } + } + + if (requestData.bodyString != nil) { + NSData *body = [NSData dataWithBytes:requestData.bodyString.UTF8String length:requestData.bodyString.length]; + [request setHTTPBody:body]; + } + + return request; +} + ++ (void)sendRequest:(NSMutableURLRequest *)request + responseHandler:(httpResponseHandler)responseHandler +{ + Class NSURLSessionClass = NSClassFromString(@"NSURLSession"); + + if (NSURLSessionClass != nil) { + [ATLUtilNetworking sendNSURLSessionRequest:request + responseHandler:responseHandler]; + } else { + [ATLUtilNetworking sendNSURLConnectionRequest:request + responseHandler:responseHandler]; + } +} + ++ (void)sendNSURLSessionRequest:(NSMutableURLRequest *)request + responseHandler:(httpResponseHandler)responseHandler +{ + NSURLSession *session = [NSURLSession sessionWithConfiguration:urlSessionConfiguration + delegate:nil + delegateQueue:nil]; + + NSURLSessionDataTask *task = [session dataTaskWithRequest:request + completionHandler: + ^(NSData *data, NSURLResponse *response, NSError *error) { + ATLHttpResponse *httpResponseData = + [ATLUtilNetworking completionHandler:data + response:(NSHTTPURLResponse *)response + error:error]; + responseHandler(httpResponseData); + }]; + + [task resume]; + [session finishTasksAndInvalidate]; +} + ++ (void)sendNSURLConnectionRequest:(NSMutableURLRequest *)request + responseHandler:(httpResponseHandler)responseHandler +{ + NSError *responseError = nil; + NSHTTPURLResponse *urlResponse = nil; + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + NSData *data = [NSURLConnection sendSynchronousRequest:request + returningResponse:&urlResponse + error:&responseError]; +#pragma clang diagnostic pop + + ATLHttpResponse *httpResponseData = [ATLUtilNetworking completionHandler:data + response:(NSHTTPURLResponse *)urlResponse + error:responseError]; + + responseHandler(httpResponseData); +} + ++ (ATLHttpResponse *)completionHandler:(NSData *)data + response:(NSHTTPURLResponse *)urlResponse + error:(NSError *)responseError +{ + ATLHttpResponse *httpResponseData = [[ATLHttpResponse alloc] init]; + + // Connection error + if (responseError != nil) { + [ATLUtil debug:@"responseError %@", responseError.localizedDescription]; + + return httpResponseData; + } + + if ([ATLUtil isNull:data]) { + [ATLUtil debug:@"data is null %@"]; + + return httpResponseData; + } + + httpResponseData.responseString = [ATLUtil adjTrim:[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]]; + [ATLUtil debug:@"Response: %@", httpResponseData.responseString]; + + httpResponseData.statusCode = urlResponse.statusCode; + + httpResponseData.headerFields = urlResponse.allHeaderFields; + [ATLUtil debug:@"header fields: %@", httpResponseData.headerFields]; + + httpResponseData.jsonFoundation = [ATLUtilNetworking saveJsonResponse:data]; + [ATLUtil debug:@"json response: %@", httpResponseData.jsonFoundation]; + + [ATLUtil debug:@"json response class: %@", NSStringFromClass([httpResponseData.jsonFoundation class])]; + //2const char * cStringClassName = object_getClassName(httpResponseData.jsonFoundation); + + return httpResponseData; +} + ++ (id)saveJsonResponse:(NSData *)jsonData { + NSError *error = nil; + NSException *exception = nil; + id jsonFoundation = [ATLUtilNetworking buildJsonFoundation:jsonData exceptionPtr:&exception errorPtr:&error]; + + if (exception != nil) { + [ATLUtil debug:@"Failed to parse json response. (%@)", exception.description]; + + return nil; + } + + if (error != nil) { + [ATLUtil debug:@"Failed to parse json response. (%@)", error.description]; + + return nil; + } + + return jsonFoundation; +} + ++ (id)buildJsonFoundation:(NSData *)jsonData + exceptionPtr:(NSException **)exceptionPtr + errorPtr:(NSError **)error { + if (jsonData == nil) { + return nil; + } + + id jsonFoundation = nil; + + @try { + jsonFoundation = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:error]; + } @catch (NSException *ex) { + *exceptionPtr = ex; + return nil; + } + + return jsonFoundation; +} + +@end diff --git a/AdjustTests/ADJActivityHandlerConstructorState.h b/AdjustTests/AdjustUnitTests/ADJActivityHandlerConstructorState.h similarity index 100% rename from AdjustTests/ADJActivityHandlerConstructorState.h rename to AdjustTests/AdjustUnitTests/ADJActivityHandlerConstructorState.h diff --git a/AdjustTests/ADJActivityHandlerConstructorState.m b/AdjustTests/AdjustUnitTests/ADJActivityHandlerConstructorState.m similarity index 100% rename from AdjustTests/ADJActivityHandlerConstructorState.m rename to AdjustTests/AdjustUnitTests/ADJActivityHandlerConstructorState.m diff --git a/AdjustTests/ADJActivityHandlerMock.h b/AdjustTests/AdjustUnitTests/ADJActivityHandlerMock.h similarity index 100% rename from AdjustTests/ADJActivityHandlerMock.h rename to AdjustTests/AdjustUnitTests/ADJActivityHandlerMock.h diff --git a/AdjustTests/ADJActivityHandlerMock.m b/AdjustTests/AdjustUnitTests/ADJActivityHandlerMock.m similarity index 100% rename from AdjustTests/ADJActivityHandlerMock.m rename to AdjustTests/AdjustUnitTests/ADJActivityHandlerMock.m diff --git a/AdjustTests/ADJActivityHandlerTests.m b/AdjustTests/AdjustUnitTests/ADJActivityHandlerTests.m similarity index 100% rename from AdjustTests/ADJActivityHandlerTests.m rename to AdjustTests/AdjustUnitTests/ADJActivityHandlerTests.m diff --git a/AdjustTests/ADJAttributionChangedDelegate.h b/AdjustTests/AdjustUnitTests/ADJAttributionChangedDelegate.h similarity index 100% rename from AdjustTests/ADJAttributionChangedDelegate.h rename to AdjustTests/AdjustUnitTests/ADJAttributionChangedDelegate.h diff --git a/AdjustTests/ADJAttributionChangedDelegate.m b/AdjustTests/AdjustUnitTests/ADJAttributionChangedDelegate.m similarity index 100% rename from AdjustTests/ADJAttributionChangedDelegate.m rename to AdjustTests/AdjustUnitTests/ADJAttributionChangedDelegate.m diff --git a/AdjustTests/ADJAttributionHandlerMock.h b/AdjustTests/AdjustUnitTests/ADJAttributionHandlerMock.h similarity index 100% rename from AdjustTests/ADJAttributionHandlerMock.h rename to AdjustTests/AdjustUnitTests/ADJAttributionHandlerMock.h diff --git a/AdjustTests/ADJAttributionHandlerMock.m b/AdjustTests/AdjustUnitTests/ADJAttributionHandlerMock.m similarity index 100% rename from AdjustTests/ADJAttributionHandlerMock.m rename to AdjustTests/AdjustUnitTests/ADJAttributionHandlerMock.m diff --git a/AdjustTests/ADJAttributionHandlerTests.m b/AdjustTests/AdjustUnitTests/ADJAttributionHandlerTests.m similarity index 100% rename from AdjustTests/ADJAttributionHandlerTests.m rename to AdjustTests/AdjustUnitTests/ADJAttributionHandlerTests.m diff --git a/AdjustTests/ADJDeeplinkDelegate.h b/AdjustTests/AdjustUnitTests/ADJDeeplinkDelegate.h similarity index 100% rename from AdjustTests/ADJDeeplinkDelegate.h rename to AdjustTests/AdjustUnitTests/ADJDeeplinkDelegate.h diff --git a/AdjustTests/ADJDeeplinkDelegate.m b/AdjustTests/AdjustUnitTests/ADJDeeplinkDelegate.m similarity index 100% rename from AdjustTests/ADJDeeplinkDelegate.m rename to AdjustTests/AdjustUnitTests/ADJDeeplinkDelegate.m diff --git a/AdjustTests/ADJEndSessionState.h b/AdjustTests/AdjustUnitTests/ADJEndSessionState.h similarity index 100% rename from AdjustTests/ADJEndSessionState.h rename to AdjustTests/AdjustUnitTests/ADJEndSessionState.h diff --git a/AdjustTests/ADJEndSessionState.m b/AdjustTests/AdjustUnitTests/ADJEndSessionState.m similarity index 100% rename from AdjustTests/ADJEndSessionState.m rename to AdjustTests/AdjustUnitTests/ADJEndSessionState.m diff --git a/AdjustTests/ADJInitState.h b/AdjustTests/AdjustUnitTests/ADJInitState.h similarity index 100% rename from AdjustTests/ADJInitState.h rename to AdjustTests/AdjustUnitTests/ADJInitState.h diff --git a/AdjustTests/ADJInitState.m b/AdjustTests/AdjustUnitTests/ADJInitState.m similarity index 100% rename from AdjustTests/ADJInitState.m rename to AdjustTests/AdjustUnitTests/ADJInitState.m diff --git a/AdjustTests/ADJLoggerMock.h b/AdjustTests/AdjustUnitTests/ADJLoggerMock.h similarity index 100% rename from AdjustTests/ADJLoggerMock.h rename to AdjustTests/AdjustUnitTests/ADJLoggerMock.h diff --git a/AdjustTests/ADJLoggerMock.m b/AdjustTests/AdjustUnitTests/ADJLoggerMock.m similarity index 100% rename from AdjustTests/ADJLoggerMock.m rename to AdjustTests/AdjustUnitTests/ADJLoggerMock.m diff --git a/AdjustTests/ADJPackageFields.h b/AdjustTests/AdjustUnitTests/ADJPackageFields.h similarity index 100% rename from AdjustTests/ADJPackageFields.h rename to AdjustTests/AdjustUnitTests/ADJPackageFields.h diff --git a/AdjustTests/ADJPackageFields.m b/AdjustTests/AdjustUnitTests/ADJPackageFields.m similarity index 96% rename from AdjustTests/ADJPackageFields.m rename to AdjustTests/AdjustUnitTests/ADJPackageFields.m index 42ca0cf69..4f913dad9 100644 --- a/AdjustTests/ADJPackageFields.m +++ b/AdjustTests/AdjustUnitTests/ADJPackageFields.m @@ -16,7 +16,7 @@ - (id) init { // default values self.appToken = @"qwerty123456"; - self.clientSdk = @"ios4.12.1"; + self.clientSdk = @"ios4.12.2"; self.suffix = @""; self.environment = @"sandbox"; diff --git a/AdjustTests/ADJPackageHandlerMock.h b/AdjustTests/AdjustUnitTests/ADJPackageHandlerMock.h similarity index 100% rename from AdjustTests/ADJPackageHandlerMock.h rename to AdjustTests/AdjustUnitTests/ADJPackageHandlerMock.h diff --git a/AdjustTests/ADJPackageHandlerMock.m b/AdjustTests/AdjustUnitTests/ADJPackageHandlerMock.m similarity index 100% rename from AdjustTests/ADJPackageHandlerMock.m rename to AdjustTests/AdjustUnitTests/ADJPackageHandlerMock.m diff --git a/AdjustTests/ADJPackageHandlerTests.m b/AdjustTests/AdjustUnitTests/ADJPackageHandlerTests.m similarity index 100% rename from AdjustTests/ADJPackageHandlerTests.m rename to AdjustTests/AdjustUnitTests/ADJPackageHandlerTests.m diff --git a/AdjustTests/ADJRequestHandlerMock.h b/AdjustTests/AdjustUnitTests/ADJRequestHandlerMock.h similarity index 100% rename from AdjustTests/ADJRequestHandlerMock.h rename to AdjustTests/AdjustUnitTests/ADJRequestHandlerMock.h diff --git a/AdjustTests/ADJRequestHandlerMock.m b/AdjustTests/AdjustUnitTests/ADJRequestHandlerMock.m similarity index 100% rename from AdjustTests/ADJRequestHandlerMock.m rename to AdjustTests/AdjustUnitTests/ADJRequestHandlerMock.m diff --git a/AdjustTests/ADJRequestHandlerTests.m b/AdjustTests/AdjustUnitTests/ADJRequestHandlerTests.m similarity index 100% rename from AdjustTests/ADJRequestHandlerTests.m rename to AdjustTests/AdjustUnitTests/ADJRequestHandlerTests.m diff --git a/AdjustTests/ADJSdkClickHandlerMock.h b/AdjustTests/AdjustUnitTests/ADJSdkClickHandlerMock.h similarity index 100% rename from AdjustTests/ADJSdkClickHandlerMock.h rename to AdjustTests/AdjustUnitTests/ADJSdkClickHandlerMock.h diff --git a/AdjustTests/ADJSdkClickHandlerMock.m b/AdjustTests/AdjustUnitTests/ADJSdkClickHandlerMock.m similarity index 100% rename from AdjustTests/ADJSdkClickHandlerMock.m rename to AdjustTests/AdjustUnitTests/ADJSdkClickHandlerMock.m diff --git a/AdjustTests/ADJSdkClickHandlerTests.m b/AdjustTests/AdjustUnitTests/ADJSdkClickHandlerTests.m similarity index 100% rename from AdjustTests/ADJSdkClickHandlerTests.m rename to AdjustTests/AdjustUnitTests/ADJSdkClickHandlerTests.m diff --git a/AdjustTests/ADJSessionState.h b/AdjustTests/AdjustUnitTests/ADJSessionState.h similarity index 100% rename from AdjustTests/ADJSessionState.h rename to AdjustTests/AdjustUnitTests/ADJSessionState.h diff --git a/AdjustTests/ADJSessionState.m b/AdjustTests/AdjustUnitTests/ADJSessionState.m similarity index 100% rename from AdjustTests/ADJSessionState.m rename to AdjustTests/AdjustUnitTests/ADJSessionState.m diff --git a/AdjustTests/ADJTest.h b/AdjustTests/AdjustUnitTests/ADJTest.h similarity index 100% rename from AdjustTests/ADJTest.h rename to AdjustTests/AdjustUnitTests/ADJTest.h diff --git a/AdjustTests/ADJTest.m b/AdjustTests/AdjustUnitTests/ADJTest.m similarity index 100% rename from AdjustTests/ADJTest.m rename to AdjustTests/AdjustUnitTests/ADJTest.m diff --git a/AdjustTests/ADJTestActivityPackage.h b/AdjustTests/AdjustUnitTests/ADJTestActivityPackage.h similarity index 100% rename from AdjustTests/ADJTestActivityPackage.h rename to AdjustTests/AdjustUnitTests/ADJTestActivityPackage.h diff --git a/AdjustTests/ADJTestActivityPackage.m b/AdjustTests/AdjustUnitTests/ADJTestActivityPackage.m similarity index 100% rename from AdjustTests/ADJTestActivityPackage.m rename to AdjustTests/AdjustUnitTests/ADJTestActivityPackage.m diff --git a/AdjustTests/ADJTestsUtil.h b/AdjustTests/AdjustUnitTests/ADJTestsUtil.h similarity index 100% rename from AdjustTests/ADJTestsUtil.h rename to AdjustTests/AdjustUnitTests/ADJTestsUtil.h diff --git a/AdjustTests/ADJTestsUtil.m b/AdjustTests/AdjustUnitTests/ADJTestsUtil.m similarity index 100% rename from AdjustTests/ADJTestsUtil.m rename to AdjustTests/AdjustUnitTests/ADJTestsUtil.m diff --git a/AdjustTests/ADJTrackingDelegate.h b/AdjustTests/AdjustUnitTests/ADJTrackingDelegate.h similarity index 100% rename from AdjustTests/ADJTrackingDelegate.h rename to AdjustTests/AdjustUnitTests/ADJTrackingDelegate.h diff --git a/AdjustTests/ADJTrackingDelegate.m b/AdjustTests/AdjustUnitTests/ADJTrackingDelegate.m similarity index 100% rename from AdjustTests/ADJTrackingDelegate.m rename to AdjustTests/AdjustUnitTests/ADJTrackingDelegate.m diff --git a/AdjustTests/Adjust-Prefix.pch b/AdjustTests/AdjustUnitTests/Adjust-Prefix.pch similarity index 100% rename from AdjustTests/Adjust-Prefix.pch rename to AdjustTests/AdjustUnitTests/Adjust-Prefix.pch diff --git a/AdjustExampleTests/AppDelegate.h b/AdjustTests/AdjustUnitTests/AdjustExampleTests/AppDelegate.h similarity index 100% rename from AdjustExampleTests/AppDelegate.h rename to AdjustTests/AdjustUnitTests/AdjustExampleTests/AppDelegate.h diff --git a/AdjustExampleTests/AppDelegate.m b/AdjustTests/AdjustUnitTests/AdjustExampleTests/AppDelegate.m similarity index 100% rename from AdjustExampleTests/AppDelegate.m rename to AdjustTests/AdjustUnitTests/AdjustExampleTests/AppDelegate.m diff --git a/AdjustExampleTests/Assets.xcassets/AppIcon.appiconset/Contents.json b/AdjustTests/AdjustUnitTests/AdjustExampleTests/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from AdjustExampleTests/Assets.xcassets/AppIcon.appiconset/Contents.json rename to AdjustTests/AdjustUnitTests/AdjustExampleTests/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/AdjustExampleTests/Base.lproj/LaunchScreen.storyboard b/AdjustTests/AdjustUnitTests/AdjustExampleTests/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from AdjustExampleTests/Base.lproj/LaunchScreen.storyboard rename to AdjustTests/AdjustUnitTests/AdjustExampleTests/Base.lproj/LaunchScreen.storyboard diff --git a/AdjustExampleTests/Base.lproj/Main.storyboard b/AdjustTests/AdjustUnitTests/AdjustExampleTests/Base.lproj/Main.storyboard similarity index 100% rename from AdjustExampleTests/Base.lproj/Main.storyboard rename to AdjustTests/AdjustUnitTests/AdjustExampleTests/Base.lproj/Main.storyboard diff --git a/AdjustExampleTests/Info.plist b/AdjustTests/AdjustUnitTests/AdjustExampleTests/Info.plist similarity index 100% rename from AdjustExampleTests/Info.plist rename to AdjustTests/AdjustUnitTests/AdjustExampleTests/Info.plist diff --git a/AdjustExampleTests/ViewController.h b/AdjustTests/AdjustUnitTests/AdjustExampleTests/ViewController.h similarity index 100% rename from AdjustExampleTests/ViewController.h rename to AdjustTests/AdjustUnitTests/AdjustExampleTests/ViewController.h diff --git a/AdjustExampleTests/ViewController.m b/AdjustTests/AdjustUnitTests/AdjustExampleTests/ViewController.m similarity index 100% rename from AdjustExampleTests/ViewController.m rename to AdjustTests/AdjustUnitTests/AdjustExampleTests/ViewController.m diff --git a/AdjustExampleTests/main.m b/AdjustTests/AdjustUnitTests/AdjustExampleTests/main.m similarity index 100% rename from AdjustExampleTests/main.m rename to AdjustTests/AdjustUnitTests/AdjustExampleTests/main.m diff --git a/AdjustTests/AdjustTests-Info.plist b/AdjustTests/AdjustUnitTests/AdjustTests-Info.plist similarity index 100% rename from AdjustTests/AdjustTests-Info.plist rename to AdjustTests/AdjustUnitTests/AdjustTests-Info.plist diff --git a/AdjustTests/NSURLConnection+NSURLConnectionSynchronousLoadingMocking.h b/AdjustTests/AdjustUnitTests/NSURLConnection+NSURLConnectionSynchronousLoadingMocking.h similarity index 100% rename from AdjustTests/NSURLConnection+NSURLConnectionSynchronousLoadingMocking.h rename to AdjustTests/AdjustUnitTests/NSURLConnection+NSURLConnectionSynchronousLoadingMocking.h diff --git a/AdjustTests/NSURLConnection+NSURLConnectionSynchronousLoadingMocking.m b/AdjustTests/AdjustUnitTests/NSURLConnection+NSURLConnectionSynchronousLoadingMocking.m similarity index 100% rename from AdjustTests/NSURLConnection+NSURLConnectionSynchronousLoadingMocking.m rename to AdjustTests/AdjustUnitTests/NSURLConnection+NSURLConnectionSynchronousLoadingMocking.m diff --git a/AdjustTests/NSURLSession+NSURLDataWithRequestMocking.h b/AdjustTests/AdjustUnitTests/NSURLSession+NSURLDataWithRequestMocking.h similarity index 100% rename from AdjustTests/NSURLSession+NSURLDataWithRequestMocking.h rename to AdjustTests/AdjustUnitTests/NSURLSession+NSURLDataWithRequestMocking.h diff --git a/AdjustTests/NSURLSession+NSURLDataWithRequestMocking.m b/AdjustTests/AdjustUnitTests/NSURLSession+NSURLDataWithRequestMocking.m similarity index 100% rename from AdjustTests/NSURLSession+NSURLDataWithRequestMocking.m rename to AdjustTests/AdjustUnitTests/NSURLSession+NSURLDataWithRequestMocking.m diff --git a/AdjustTests/en.lproj/InfoPlist.strings b/AdjustTests/AdjustUnitTests/en.lproj/InfoPlist.strings similarity index 100% rename from AdjustTests/en.lproj/InfoPlist.strings rename to AdjustTests/AdjustUnitTests/en.lproj/InfoPlist.strings diff --git a/CHANGELOG.md b/CHANGELOG.md index 674617b02..f80ce9278 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +### Version 4.12.2 (13th February 2018) +#### Changed +- Improved SDK logging to indicate the presence/absence of `iAd.framework` inside of the app. + +#### Fixed +- Added handling of occasional `nil` file paths when attempting to write to file. + +--- + ### Version 4.12.1 (13th December 2017) #### Fixed - Fixed compatibility of Adjust SDK with apps that are already using `Reachability` class (https://github.com/adjust/ios_sdk/issues/315) (thanks to @fedetrim). diff --git a/README.md b/README.md index 73e1d5639..41a82d5c1 100644 --- a/README.md +++ b/README.md @@ -67,13 +67,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.12.1' +pod 'Adjust', '~> 4.12.2' ``` or: ```ruby -pod 'Adjust', :git => 'https://github.com/adjust/ios_sdk.git', :tag => 'v4.12.1' +pod 'Adjust', :git => 'https://github.com/adjust/ios_sdk.git', :tag => 'v4.12.2' ``` --- diff --git a/VERSION b/VERSION index 53cf85e17..f1cd7de1d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.12.1 +4.12.2 diff --git a/doc/english/migrate.md b/doc/english/migrate.md index 6250393eb..8156a1e9a 100644 --- a/doc/english/migrate.md +++ b/doc/english/migrate.md @@ -1,4 +1,4 @@ -## Migrate your adjust SDK for iOS to v4.12.1 from v3.4.0 +## Migrate your adjust SDK for iOS to v4.12.2 from v3.4.0 ### Initial setup diff --git a/doc/japanese/migrate_ja.md b/doc/japanese/migrate_ja.md index f9db1b718..3a1c2024c 100644 --- a/doc/japanese/migrate_ja.md +++ b/doc/japanese/migrate_ja.md @@ -1,4 +1,4 @@ -## iOS用adjust SDKのv3.4.0からv.4.12.1への移行 +## iOS用adjust SDKのv3.4.0からv.4.12.2への移行 ### 初期設定 diff --git a/doc/migrate.md b/doc/migrate.md index 6250393eb..8156a1e9a 100644 --- a/doc/migrate.md +++ b/doc/migrate.md @@ -1,4 +1,4 @@ -## Migrate your adjust SDK for iOS to v4.12.1 from v3.4.0 +## Migrate your adjust SDK for iOS to v4.12.2 from v3.4.0 ### Initial setup