Skip to content
This repository has been archived by the owner on Jan 19, 2018. It is now read-only.

Feature/podspec split #14

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
19 changes: 19 additions & 0 deletions ATInternet-iOS-ObjC-SDK-AppExtension.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Pod::Spec.new do |s|
s.name = "ATInternet-iOS-ObjC-SDK-AppExtension"
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/'
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.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}"
s.frameworks = "CoreData", "CoreFoundation", "WatchKit", "UIKit", "CoreTelephony", "SystemConfiguration"
s.requires_arc = true
end
23 changes: 4 additions & 19 deletions ATInternet-iOS-ObjC-SDK.podspec
Original file line number Diff line number Diff line change
@@ -1,36 +1,21 @@
Pod::Spec.new do |s|
s.name = "ATInternet-iOS-ObjC-SDK"
s.version = 2.2.7
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/'
s.license = "MIT"
s.author = "AT Internet"
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.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.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
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>4F53DF5F1A8E140A009C6B44</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>AEDFEE501B2599EA00756827</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>AEF293121A4343AB00B0034E</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>AEF2931D1A4343AB00B0034E</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
32 changes: 16 additions & 16 deletions Tracker/Tracker/ATBackgroundTask.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,49 +79,49 @@ - (NSUInteger)beginTaskWithCompletionHandler:(CompletionBlock)_completion;
//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;
}

- (void)endTaskWithKey:(NSUInteger)_key
{
@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;
Expand All @@ -130,13 +130,13 @@ - (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]];

}

}
}

Expand Down
3 changes: 3 additions & 0 deletions Tracker/Tracker/ATTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -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]){
Expand All @@ -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;
}
Expand Down