summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorBrad Leege <bleege@gmail.com>2015-05-08 10:13:05 -0500
committerBrad Leege <bleege@gmail.com>2015-05-08 10:13:05 -0500
commitea3979b19e08d5893347e648bbdc28bbb9bfe010 (patch)
tree55077fc9fad252bb4c32e03fdf2363014767a1f6 /platform
parentadec24c97c59dffeb7e49bc20d6422f0fbc4cb0a (diff)
downloadqtlocation-mapboxgl-ea3979b19e08d5893347e648bbdc28bbb9bfe010.tar.gz
#1474 - Refactoring timer to be started when first event is added to queue. Debug logic and content also included
Diffstat (limited to 'platform')
-rw-r--r--platform/ios/MGLMapboxEvents.m12
1 files changed, 8 insertions, 4 deletions
diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m
index 4450fa87fb..b5a2195463 100644
--- a/platform/ios/MGLMapboxEvents.m
+++ b/platform/ios/MGLMapboxEvents.m
@@ -163,7 +163,7 @@ NSString *const MGLEventGestureRotateStart = @"Rotation";
// Events Control
_eventQueue = [[NSMutableArray alloc] init];
_flushAt = 20;
- _flushAfter = 60;
+ _flushAfter = 15;
_token = nil;
_instanceID = [[NSUUID UUID] UUIDString];
@@ -382,16 +382,20 @@ NSString *const MGLEventGestureRotateStart = @"Rotation";
// Has Flush Limit Been Reached?
if (_eventQueue.count >= strongSelf.flushAt) {
[strongSelf flush];
+ } else if (_eventQueue.count == 1) {
+ // If this is first new event on queue start timer,
+ NSLog(@"event queue is 1, start timer.");
+ [strongSelf startTimer];
+ } else {
+ NSLog(@"event queue is != 1, don't adjust timer.");
}
-
- // Reset Timer (Initial Starting of Timer after first event is pushed)
- [strongSelf startTimer];
});
}
// Can be called from any thread.
//
+ (void) flush {
+ NSLog(@"+flush called (likely timer)");
[[MGLMapboxEvents sharedManager] flush];
}