From 1141ec0032cb7a1002b8a0baaa7b3573d99d452d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Je=CC=81ro=CC=82me=20Morissard?= Date: Thu, 3 Aug 2017 00:25:14 +0200 Subject: [PATCH 01/10] Try to support full compilation for extensions --- Tracker/Tracker/ATBackgroundTask.m | 8 ++++++++ Tracker/Tracker/ATTracker.m | 3 +++ 2 files changed, 11 insertions(+) diff --git a/Tracker/Tracker/ATBackgroundTask.m b/Tracker/Tracker/ATBackgroundTask.m index d04a902..e3bafb0 100644 --- a/Tracker/Tracker/ATBackgroundTask.m +++ b/Tracker/Tracker/ATBackgroundTask.m @@ -76,6 +76,9 @@ - (NSInteger) begin { - (NSUInteger)beginTaskWithCompletionHandler:(CompletionBlock)_completion; { +#if defined AT_EXTENSION + return 0 +#else //read the counter and increment it NSUInteger taskKey; @synchronized(self) { @@ -98,10 +101,14 @@ - (NSUInteger)beginTaskWithCompletionHandler:(CompletionBlock)_completion; //return the dictionary key return taskKey; +#endif } - (void)endTaskWithKey:(NSUInteger)_key { +#if defined AT_EXTENSION + return +#else @synchronized(self.tasksCompletionBlocks) { //see if this task has a completion block @@ -138,6 +145,7 @@ - (void)endTaskWithKey:(NSUInteger)_key } } +#end } @end diff --git a/Tracker/Tracker/ATTracker.m b/Tracker/Tracker/ATTracker.m index 1287226..78e42df 100644 --- a/Tracker/Tracker/ATTracker.m +++ b/Tracker/Tracker/ATTracker.m @@ -316,6 +316,8 @@ - (instancetype)init { - (instancetype)init:(NSMutableDictionary *)configuration { if (self = [super init]) { +#if defined AT_EXTENSION +#else self.buffer = [[ATBuffer alloc] initWithTracker:self]; self.configuration = [[ATConfiguration alloc] initWithDictionary: configuration]; if(![ATLifeCycle isInitialized]){ @@ -327,6 +329,7 @@ - (instancetype)init:(NSMutableDictionary *)configuration { self.lifeCycle = [[ATLifeCycle alloc] init]; self.businessObjects = [[NSMutableDictionary alloc] init]; self.dispatcher = [[ATDispatcher alloc] initWithTracker:self]; +#endif } return self; } From 59f8de18c2b82f5a23bf6f8fa2eb4d92a2ebf31e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Morissard?= Date: Thu, 3 Aug 2017 00:30:25 +0200 Subject: [PATCH 02/10] Update ATInternet-iOS-ObjC-SDK.podspec --- ATInternet-iOS-ObjC-SDK.podspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ATInternet-iOS-ObjC-SDK.podspec b/ATInternet-iOS-ObjC-SDK.podspec index 5181e34..40953ae 100644 --- a/ATInternet-iOS-ObjC-SDK.podspec +++ b/ATInternet-iOS-ObjC-SDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ATInternet-iOS-ObjC-SDK" - s.version = ‘2.2.7’ + s.version = ‘1.0’ s.summary = "AT Internet mobile analytics solution for iOS" s.homepage = "https://github.com/at-internet/atinternet-ios-objc-sdk" s.documentation_url = 'http://developers.atinternet-solutions.com/apple-en/getting-started-apple-en/operating-principle-apple-en/' @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.platform = :ios s.ios.deployment_target = '7.0' - s.source = { :git => "https://github.com/at-internet/atinternet-ios-objc-sdk.git", :tag => s.version} + s.source = { :git => "https://github.com/summerize/atinternet-ios-objc-sdk.git", :tag => s.version} s.prefix_header_file = "Tracker/Tracker/ATTracker-prefix.pch" s.subspec 'Res' do |res| From 9d9ed268f32f857e0f75f84aa00abffd57eb7443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Morissard?= Date: Thu, 3 Aug 2017 00:31:57 +0200 Subject: [PATCH 03/10] 2.2.7.1 --- ATInternet-iOS-ObjC-SDK.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ATInternet-iOS-ObjC-SDK.podspec b/ATInternet-iOS-ObjC-SDK.podspec index 40953ae..e52bb8f 100644 --- a/ATInternet-iOS-ObjC-SDK.podspec +++ b/ATInternet-iOS-ObjC-SDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ATInternet-iOS-ObjC-SDK" - s.version = ‘1.0’ + s.version = '2.2.7.1' s.summary = "AT Internet mobile analytics solution for iOS" s.homepage = "https://github.com/at-internet/atinternet-ios-objc-sdk" s.documentation_url = 'http://developers.atinternet-solutions.com/apple-en/getting-started-apple-en/operating-principle-apple-en/' From 446d8c0930de1f4596105534b437e81782e859e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Je=CC=81ro=CC=82me=20Morissard?= Date: Thu, 3 Aug 2017 00:40:45 +0200 Subject: [PATCH 04/10] FIX #if --- Tracker/Tracker/ATBackgroundTask.m | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Tracker/Tracker/ATBackgroundTask.m b/Tracker/Tracker/ATBackgroundTask.m index e3bafb0..bb270c4 100644 --- a/Tracker/Tracker/ATBackgroundTask.m +++ b/Tracker/Tracker/ATBackgroundTask.m @@ -76,9 +76,7 @@ - (NSInteger) begin { - (NSUInteger)beginTaskWithCompletionHandler:(CompletionBlock)_completion; { -#if defined AT_EXTENSION - return 0 -#else +#ifndef AT_EXTENSION //read the counter and increment it NSUInteger taskKey; @synchronized(self) { @@ -102,13 +100,12 @@ - (NSUInteger)beginTaskWithCompletionHandler:(CompletionBlock)_completion; //return the dictionary key return taskKey; #endif + return 0; } - (void)endTaskWithKey:(NSUInteger)_key { -#if defined AT_EXTENSION - return -#else +#ifndef AT_EXTENSION @synchronized(self.tasksCompletionBlocks) { //see if this task has a completion block @@ -145,7 +142,7 @@ - (void)endTaskWithKey:(NSUInteger)_key } } -#end +#endif } @end From 7191bf816330267b93c5cd9db65277e1c0937961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Je=CC=81ro=CC=82me=20Morissard?= Date: Thu, 3 Aug 2017 11:56:27 +0200 Subject: [PATCH 05/10] Spliting podspec into AppPodspec and AppExtensionPodspec --- ATInternet-iOS-ObjC-SDK-AppExtension.podspec | 25 +++++++++++++ ATInternet-iOS-ObjC-SDK.podspec | 11 ------ .../xcschemes/xcschememanagement.plist | 29 +++++++++++++++ Tracker/Tracker/ATBackgroundTask.m | 37 ++++++++----------- 4 files changed, 70 insertions(+), 32 deletions(-) create mode 100644 ATInternet-iOS-ObjC-SDK-AppExtension.podspec create mode 100644 Tracker/Tracker.xcodeproj/xcuserdata/jeromemorissard.xcuserdatad/xcschemes/xcschememanagement.plist diff --git a/ATInternet-iOS-ObjC-SDK-AppExtension.podspec b/ATInternet-iOS-ObjC-SDK-AppExtension.podspec new file mode 100644 index 0000000..deecc3b --- /dev/null +++ b/ATInternet-iOS-ObjC-SDK-AppExtension.podspec @@ -0,0 +1,25 @@ +Pod::Spec.new do |s| + s.name = "ATInternet-iOS-ObjC-SDK-AppExtension" + s.version = '2.2.7.1' + s.summary = "AT Internet mobile analytics solution for iOS" + s.homepage = "https://github.com/at-internet/atinternet-ios-objc-sdk" + s.documentation_url = 'http://developers.atinternet-solutions.com/apple-en/getting-started-apple-en/operating-principle-apple-en/' + s.license = "MIT" + s.author = "AT Internet" + s.platform = :ios + s.ios.deployment_target = '7.0' + + s.source = { :git => "https://github.com/summerize/atinternet-ios-objc-sdk.git", :tag => s.version} + s.prefix_header_file = "Tracker/Tracker/ATTracker-prefix.pch" + + s.subspec 'Res' do |res| + res.resource_bundle = {'ATAssets' => ['Tracker/Tracker/*.{xcdatamodeld,png,json}','Tracker/Tracker/ATDefaultConfiguration.plist']} + end + + s.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) AT_EXTENSION'} + s.source_files = "Tracker/Tracker/*.{h,m}" + s.exclude_files = "Tracker/Tracker/ATBackgroundTask.{h,m}" + s.frameworks = "CoreData", "CoreFoundation", "WatchKit", "UIKit", "CoreTelephony", "SystemConfiguration" + s.dependency s.name+'/Res' + s.requires_arc = true +end diff --git a/ATInternet-iOS-ObjC-SDK.podspec b/ATInternet-iOS-ObjC-SDK.podspec index e52bb8f..3f6b20c 100644 --- a/ATInternet-iOS-ObjC-SDK.podspec +++ b/ATInternet-iOS-ObjC-SDK.podspec @@ -21,16 +21,5 @@ Pod::Spec.new do |s| ios.frameworks = "CoreData", "CoreFoundation", "UIKit", "CoreTelephony", "SystemConfiguration" ios.dependency s.name+'/Res' end - - s.subspec 'AppExtension' do |appExt| - pchwatch = <<-EOS - #define AT_EXTENSION - EOS - appExt.prefix_header_contents = pchwatch - appExt.source_files = "Tracker/Tracker/*.{h,m}" - appExt.exclude_files = "Tracker/Tracker/ATBackgroundTask.{h,m}" - appExt.frameworks = "CoreData", "CoreFoundation", "WatchKit", "UIKit", "CoreTelephony", "SystemConfiguration" - appExt.dependency s.name+'/Res' - end s.requires_arc = true end diff --git a/Tracker/Tracker.xcodeproj/xcuserdata/jeromemorissard.xcuserdatad/xcschemes/xcschememanagement.plist b/Tracker/Tracker.xcodeproj/xcuserdata/jeromemorissard.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..d1ad42c --- /dev/null +++ b/Tracker/Tracker.xcodeproj/xcuserdata/jeromemorissard.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,29 @@ + + + + + SuppressBuildableAutocreation + + 4F53DF5F1A8E140A009C6B44 + + primary + + + AEDFEE501B2599EA00756827 + + primary + + + AEF293121A4343AB00B0034E + + primary + + + AEF2931D1A4343AB00B0034E + + primary + + + + + diff --git a/Tracker/Tracker/ATBackgroundTask.m b/Tracker/Tracker/ATBackgroundTask.m index bb270c4..e9b7e59 100644 --- a/Tracker/Tracker/ATBackgroundTask.m +++ b/Tracker/Tracker/ATBackgroundTask.m @@ -76,56 +76,52 @@ - (NSInteger) begin { - (NSUInteger)beginTaskWithCompletionHandler:(CompletionBlock)_completion; { -#ifndef AT_EXTENSION //read the counter and increment it NSUInteger taskKey; @synchronized(self) { - + taskKey = self.taskCounter; self.taskCounter++; - + } - + //tell the OS to start a task that should continue in the background if needed NSUInteger taskId = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{ [self endTaskWithKey:taskKey]; }]; - + //add this task identifier to the active task dictionary [self.tasks setObject:[NSNumber numberWithUnsignedLong:taskId] forKey:[NSNumber numberWithUnsignedLong:taskKey]]; - + //store the completion block (if any) if (_completion) [self.tasksCompletionBlocks setObject:_completion forKey:[NSNumber numberWithUnsignedLong:taskKey]]; - + //return the dictionary key return taskKey; -#endif - return 0; } - (void)endTaskWithKey:(NSUInteger)_key { -#ifndef AT_EXTENSION @synchronized(self.tasksCompletionBlocks) { - + //see if this task has a completion block CompletionBlock completion = [self.tasksCompletionBlocks objectForKey:[NSNumber numberWithUnsignedLong:_key]]; if (completion) { - + //run the completion block and remove it from the completion block dictionary completion(); [self.tasksCompletionBlocks removeObjectForKey:[NSNumber numberWithUnsignedLong:_key]]; - + } - + } - + @synchronized(self.tasks) { - + //see if this task has been ended yet NSNumber *taskId = [self.tasks objectForKey:[NSNumber numberWithUnsignedLong:_key]]; if (taskId) { - + for (NSOperation *operation in [ATTrackerQueue sharedInstance].queue.operations) { if([operation isKindOfClass:[ATSender class]]){ ATSender *sender = (ATSender *) operation; @@ -134,15 +130,14 @@ - (void)endTaskWithKey:(NSUInteger)_key } } } - + //end the task and remove it from the active task dictionary [[UIApplication sharedApplication] endBackgroundTask:[taskId unsignedLongValue]]; [self.tasks removeObjectForKey:[NSNumber numberWithUnsignedLong:_key]]; - + } - + } -#endif } @end From a512147a2e03501b142b47c9ef54cd36bd91d9df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Morissard?= Date: Thu, 3 Aug 2017 12:01:50 +0200 Subject: [PATCH 06/10] Update ATInternet-iOS-ObjC-SDK-AppExtension.podspec --- ATInternet-iOS-ObjC-SDK-AppExtension.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ATInternet-iOS-ObjC-SDK-AppExtension.podspec b/ATInternet-iOS-ObjC-SDK-AppExtension.podspec index deecc3b..844303f 100644 --- a/ATInternet-iOS-ObjC-SDK-AppExtension.podspec +++ b/ATInternet-iOS-ObjC-SDK-AppExtension.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ATInternet-iOS-ObjC-SDK-AppExtension" - s.version = '2.2.7.1' + s.version = '2.2.7.3' s.summary = "AT Internet mobile analytics solution for iOS" s.homepage = "https://github.com/at-internet/atinternet-ios-objc-sdk" s.documentation_url = 'http://developers.atinternet-solutions.com/apple-en/getting-started-apple-en/operating-principle-apple-en/' From 991596e360a6db86007938a49d9827e44bf7905d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Morissard?= Date: Thu, 3 Aug 2017 12:02:04 +0200 Subject: [PATCH 07/10] Update ATInternet-iOS-ObjC-SDK.podspec --- ATInternet-iOS-ObjC-SDK.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ATInternet-iOS-ObjC-SDK.podspec b/ATInternet-iOS-ObjC-SDK.podspec index 3f6b20c..575ba24 100644 --- a/ATInternet-iOS-ObjC-SDK.podspec +++ b/ATInternet-iOS-ObjC-SDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ATInternet-iOS-ObjC-SDK" - s.version = '2.2.7.1' + s.version = '2.2.7.3' s.summary = "AT Internet mobile analytics solution for iOS" s.homepage = "https://github.com/at-internet/atinternet-ios-objc-sdk" s.documentation_url = 'http://developers.atinternet-solutions.com/apple-en/getting-started-apple-en/operating-principle-apple-en/' From c1f77121b7f0cbfd957bca3bc8d4c959f1d71e49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Morissard?= Date: Thu, 3 Aug 2017 12:03:21 +0200 Subject: [PATCH 08/10] Update ATInternet-iOS-ObjC-SDK-AppExtension.podspec --- ATInternet-iOS-ObjC-SDK-AppExtension.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ATInternet-iOS-ObjC-SDK-AppExtension.podspec b/ATInternet-iOS-ObjC-SDK-AppExtension.podspec index 844303f..425ee39 100644 --- a/ATInternet-iOS-ObjC-SDK-AppExtension.podspec +++ b/ATInternet-iOS-ObjC-SDK-AppExtension.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |s| s.license = "MIT" s.author = "AT Internet" s.platform = :ios - s.ios.deployment_target = '7.0' + s.ios.deployment_target = '7.0' s.source = { :git => "https://github.com/summerize/atinternet-ios-objc-sdk.git", :tag => s.version} s.prefix_header_file = "Tracker/Tracker/ATTracker-prefix.pch" From cb67ee87736bb8cab0ac3e270aec8352a0c90987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Je=CC=81ro=CC=82me=20Morissard?= Date: Thu, 3 Aug 2017 12:08:20 +0200 Subject: [PATCH 09/10] Simplify pod specs --- ATInternet-iOS-ObjC-SDK-AppExtension.podspec | 9 ++------- ATInternet-iOS-ObjC-SDK.podspec | 9 +++------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/ATInternet-iOS-ObjC-SDK-AppExtension.podspec b/ATInternet-iOS-ObjC-SDK-AppExtension.podspec index 425ee39..a740954 100644 --- a/ATInternet-iOS-ObjC-SDK-AppExtension.podspec +++ b/ATInternet-iOS-ObjC-SDK-AppExtension.podspec @@ -7,15 +7,10 @@ Pod::Spec.new do |s| s.license = "MIT" s.author = "AT Internet" s.platform = :ios - s.ios.deployment_target = '7.0' - + s.ios.deployment_target = '7.0' s.source = { :git => "https://github.com/summerize/atinternet-ios-objc-sdk.git", :tag => s.version} s.prefix_header_file = "Tracker/Tracker/ATTracker-prefix.pch" - - s.subspec 'Res' do |res| - res.resource_bundle = {'ATAssets' => ['Tracker/Tracker/*.{xcdatamodeld,png,json}','Tracker/Tracker/ATDefaultConfiguration.plist']} - end - + s.resource_bundle = {'ATAssets' => ['Tracker/Tracker/*.{xcdatamodeld,png,json}','Tracker/Tracker/ATDefaultConfiguration.plist']} s.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) AT_EXTENSION'} s.source_files = "Tracker/Tracker/*.{h,m}" s.exclude_files = "Tracker/Tracker/ATBackgroundTask.{h,m}" diff --git a/ATInternet-iOS-ObjC-SDK.podspec b/ATInternet-iOS-ObjC-SDK.podspec index 575ba24..2468b91 100644 --- a/ATInternet-iOS-ObjC-SDK.podspec +++ b/ATInternet-iOS-ObjC-SDK.podspec @@ -7,19 +7,16 @@ Pod::Spec.new do |s| s.license = "MIT" s.author = "AT Internet" s.platform = :ios - s.ios.deployment_target = '7.0' - + s.ios.deployment_target = '7.0' s.source = { :git => "https://github.com/summerize/atinternet-ios-objc-sdk.git", :tag => s.version} s.prefix_header_file = "Tracker/Tracker/ATTracker-prefix.pch" - - s.subspec 'Res' do |res| - res.resource_bundle = {'ATAssets' => ['Tracker/Tracker/*.{xcdatamodeld,png,json}','Tracker/Tracker/ATDefaultConfiguration.plist']} - end + s.resource_bundle = {'ATAssets' => ['Tracker/Tracker/*.{xcdatamodeld,png,json}','Tracker/Tracker/ATDefaultConfiguration.plist']} s.subspec 'iOS' do |ios| ios.source_files = "Tracker/Tracker/*.{h,m}" ios.frameworks = "CoreData", "CoreFoundation", "UIKit", "CoreTelephony", "SystemConfiguration" ios.dependency s.name+'/Res' end + s.requires_arc = true end From e3ac8fdf6003e13a8db173473c87158148d376f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Je=CC=81ro=CC=82me=20Morissard?= Date: Thu, 3 Aug 2017 12:09:42 +0200 Subject: [PATCH 10/10] FIX removed dependency --- ATInternet-iOS-ObjC-SDK-AppExtension.podspec | 1 - ATInternet-iOS-ObjC-SDK.podspec | 1 - 2 files changed, 2 deletions(-) diff --git a/ATInternet-iOS-ObjC-SDK-AppExtension.podspec b/ATInternet-iOS-ObjC-SDK-AppExtension.podspec index a740954..77692a4 100644 --- a/ATInternet-iOS-ObjC-SDK-AppExtension.podspec +++ b/ATInternet-iOS-ObjC-SDK-AppExtension.podspec @@ -15,6 +15,5 @@ Pod::Spec.new do |s| s.source_files = "Tracker/Tracker/*.{h,m}" s.exclude_files = "Tracker/Tracker/ATBackgroundTask.{h,m}" s.frameworks = "CoreData", "CoreFoundation", "WatchKit", "UIKit", "CoreTelephony", "SystemConfiguration" - s.dependency s.name+'/Res' s.requires_arc = true end diff --git a/ATInternet-iOS-ObjC-SDK.podspec b/ATInternet-iOS-ObjC-SDK.podspec index 2468b91..516ad10 100644 --- a/ATInternet-iOS-ObjC-SDK.podspec +++ b/ATInternet-iOS-ObjC-SDK.podspec @@ -15,7 +15,6 @@ Pod::Spec.new do |s| s.subspec 'iOS' do |ios| ios.source_files = "Tracker/Tracker/*.{h,m}" ios.frameworks = "CoreData", "CoreFoundation", "UIKit", "CoreTelephony", "SystemConfiguration" - ios.dependency s.name+'/Res' end s.requires_arc = true