Skip to content

Commit

Permalink
Merge pull request #9 from fatalhck/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
fatalhck authored Dec 16, 2016
2 parents 389ab59 + ecd5d28 commit 2ceedce
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Findr/Classes/FindrTrackingManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,13 @@ open class FindrTrackingManager: NSObject, CLLocationManagerDelegate
}
}

/**
* Specifies in metters the accuracy limit acceptable for a user location.
*/
open var maximumAcuracyAllowed: CLLocationAccuracy = 400

open var motionManager: CMMotionManager = CMMotionManager()


//===== Internal variables
fileprivate(set) internal var locationManager: CLLocationManager = CLLocationManager()
Expand Down Expand Up @@ -171,15 +176,16 @@ open class FindrTrackingManager: NSObject, CLLocationManagerDelegate
let location = locations[0]

// Disregarding old and low quality location detections
let age = location.timestamp.timeIntervalSinceNow;
if age < -30 || location.horizontalAccuracy > 500 || location.horizontalAccuracy < 0
let age = location.timestamp.timeIntervalSinceNow
if age < -30 || location.horizontalAccuracy > maximumAcuracyAllowed || location.horizontalAccuracy < 0
{
print("Disregarding location: age: \(age), ha: \(location.horizontalAccuracy)")
return
}

//println("== \(location!.horizontalAccuracy), \(age) \(location!.coordinate.latitude), \(location!.coordinate.longitude)" )
self.userLocation = location

//println("== \(location!.horizontalAccuracy), \(age) \(location!.coordinate.latitude), \(location!.coordinate.longitude)" )

// Setting altitude to 0 if altitudeSensitive == false
if self.userLocation != nil && !self.altitudeSensitive
Expand Down

0 comments on commit 2ceedce

Please sign in to comment.