Commit 7bff7320 authored by Matthijs van der Kroon's avatar Matthijs van der Kroon

Merge branch 'feature/timerFix' into dev

parents 70baed03 5c9c811b
......@@ -34,4 +34,4 @@ Carthage/Build
# Note: if you ignore the Pods directory, make sure to uncomment
# `pod install` in .travis.yml
#
# Pods/
Pods/
......@@ -135,6 +135,7 @@
Primed.sharedInstance.sha512Signature = [Primed hmac:prepSignature];
Primed.sharedInstance.connectionStringPrimedIO = connectionString;
Primed.sharedInstance.primedTrackerAvailable = YES;
self->heartbeatIncrement = 0;
self.heartbeatInterval = heartbeatInterval;
self.eventQueueRetryInterval = eventQueueRetryInterval;
......@@ -147,14 +148,7 @@
[self.manager setNsps:@{@"/v1":self.socket}];
[self.socket on:@"connect" callback:^(NSArray* data, SocketAckEmitter* ack) {
self->heartbeatIncrement = 0;
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];
}
if(PrimedTracker.sharedInstance.debug){ PrimedLog(@"[PRIMED TRACKER SOCKET CONNECTED]"); }
}];
[self.socket onAny:^(SocketAnyEvent *data) {
......@@ -163,13 +157,16 @@
[self.socket connect];
if (@available(iOS 10.0, *)) {
[NSTimer scheduledTimerWithTimeInterval:self.eventQueueRetryInterval repeats:YES block:^(NSTimer * _Nonnull timer) {
[self emitFromDatabase];
}];
[NSTimer scheduledTimerWithTimeInterval:self.heartbeatInterval repeats:YES block:^(NSTimer * _Nonnull timer) {
[self trackHeartbeat];
}];
} else {
[NSTimer scheduledTimerWithTimeInterval:self.eventQueueRetryInterval target:self selector:@selector(emitFromDatabase) userInfo:nil repeats:YES];
[NSTimer scheduledTimerWithTimeInterval:self.heartbeatInterval target:self selector:@selector(trackHeartbeat) userInfo:nil repeats:YES];
}
[NSNotificationCenter.defaultCenter addObserverForName:UIApplicationDidBecomeActiveNotification object:nil queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification * _Nonnull note) {
......
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