Commit adc333c6 authored by Matthijs van der Kroon's avatar Matthijs van der Kroon

Merge branch 'feature/ios9compatible' into 'dev'

Feature/ios9compatible

See merge request !14
parents bfeb9d77 1ecee92b
{
"name": "PrimedIO",
"version": "0.0.1",
"version": "0.0.2",
"summary": "IOS SDK for retrieving predictions from the Primed Backend, as well as track behavior",
"description": "IOS SDK for retrieving predictions from the Primed Backend, as well as track behavior.",
"homepage": "https://gitlab.com/primedio/delivery-primedios",
......@@ -13,10 +13,10 @@
},
"source": {
"git": "https://gitlab.com/primedio/delivery-primedios.git",
"tag": "0.0.1"
"tag": "0.0.2"
},
"platforms": {
"ios": "10.0"
"ios": "9.0"
},
"source_files": "PrimedIO/Classes/**/*",
"swift_version": "4.0",
......
This diff is collapsed.
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.0.1</string>
<string>0.0.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -456,7 +456,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
......@@ -489,7 +489,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
......@@ -504,7 +504,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "PrimedIO/PrimedIO-Prefix.pch";
INFOPLIST_FILE = "PrimedIO/PrimedIO-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
......@@ -520,7 +520,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "PrimedIO/PrimedIO-Prefix.pch";
INFOPLIST_FILE = "PrimedIO/PrimedIO-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
......
......@@ -18,6 +18,11 @@
@implementation PIOViewControllerDemo_PrimedTracker
-(void)trackLocation{
PIOAppDelegate *appDelegate = (PIOAppDelegate *)[[UIApplication sharedApplication] delegate];
[PrimedTracker.sharedInstance trackPositionChange:appDelegate.locationManager.location];
}
#pragma mark - IBActions
-(IBAction)onBtnTrackView:(UIButton *)sender{
// [PrimedTracker.sharedInstance trackView:@"Test View Example"];
......@@ -62,10 +67,17 @@
// Create PrimedTracker instance
[PrimedTracker.sharedInstance initWithPublicKey:@"mypubkey" secretKey:@"mysecretkey" connectionString:@"http://url.here" trackingConnectionString:@"http://url.here" heartbeatInterval:10 eventQueueRetryInterval:10];
[NSTimer scheduledTimerWithTimeInterval:10 repeats:YES block:^(NSTimer * _Nonnull timer) {
PIOAppDelegate *appDelegate = (PIOAppDelegate *)[[UIApplication sharedApplication] delegate];
[PrimedTracker.sharedInstance trackPositionChange:appDelegate.locationManager.location];
}];
if (@available(iOS 10.0, *)) {
[NSTimer scheduledTimerWithTimeInterval:10 repeats:YES block:^(NSTimer * _Nonnull timer) {
[self trackLocation];
}];
} else {
[NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(trackLocation) userInfo:nil repeats:YES];
}
}
-(void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
......
......@@ -18,7 +18,7 @@ Pod::Spec.new do |s|
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'PrimedIO' => 'info@primed.io' }
s.source = { :git => 'https://gitlab.com/primedio/delivery-primedios.git', :tag => s.version.to_s }
s.ios.deployment_target = '10.0'
s.ios.deployment_target = '9.0'
s.source_files = 'PrimedIO/Classes/**/*'
s.swift_version = '4.0'
......
......@@ -83,6 +83,13 @@
[self saveToPLIST:payload];
}
}
-(void)emitFromDatabase{
if(self->savedPayloads.count > 0 && self.isNetworkAvailable){
if(PrimedTracker.sharedInstance.debug){ PrimedLog(@"Left to send: %lu",(unsigned long)self->savedPayloads.count); }
[self emitPayload:self->savedPayloads.firstObject];
[self removeFirstItemFromPLIST];
}
}
#pragma mark - Initialization
+(PrimedTracker *)sharedInstance{
......@@ -138,9 +145,13 @@
[self.socket on:@"connect" callback:^(NSArray* data, SocketAckEmitter* ack) {
self->heartbeatIncrement = 0;
[NSTimer scheduledTimerWithTimeInterval:self.heartbeatInterval repeats:YES block:^(NSTimer * _Nonnull timer) {
[self trackHeartbeat];
}];
if (@available(iOS 10.0, *)) {
[NSTimer scheduledTimerWithTimeInterval:self.heartbeatInterval repeats:YES block:^(NSTimer * _Nonnull timer) {
[self trackHeartbeat];
}];
} else {
[NSTimer scheduledTimerWithTimeInterval:self.heartbeatInterval target:self selector:@selector(trackHeartbeat) userInfo:nil repeats:YES];
}
}];
[self.socket onAny:^(SocketAnyEvent *data) {
......@@ -149,13 +160,14 @@
[self.socket connect];
[NSTimer scheduledTimerWithTimeInterval:self.eventQueueRetryInterval repeats:YES block:^(NSTimer * _Nonnull timer) {
if(self->savedPayloads.count > 0 && self.isNetworkAvailable){
if(PrimedTracker.sharedInstance.debug){ PrimedLog(@"Left to send: %lu",(unsigned long)self->savedPayloads.count); }
[self emitPayload:self->savedPayloads.firstObject];
[self removeFirstItemFromPLIST];
}
}];
if (@available(iOS 10.0, *)) {
[NSTimer scheduledTimerWithTimeInterval:self.eventQueueRetryInterval repeats:YES block:^(NSTimer * _Nonnull timer) {
[self emitFromDatabase];
}];
} else {
[NSTimer scheduledTimerWithTimeInterval:self.eventQueueRetryInterval target:self selector:@selector(emitFromDatabase) userInfo:nil repeats:YES];
}
[NSNotificationCenter.defaultCenter addObserverForName:UIApplicationDidBecomeActiveNotification object:nil queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification * _Nonnull note) {
[self trackStart:@""];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment