From 96fdef721fd5302ef18d99e5dc855a098eee16d3 Mon Sep 17 00:00:00 2001 From: Aleksey Belouosv Date: Tue, 5 Feb 2019 16:56:59 +0300 Subject: [PATCH] [iOS] adjust geo tracker params --- iphone/Maps/Core/Location/GeoTracker/Impl/GeoTracker.swift | 2 +- .../Maps/Core/Location/GeoTracker/Impl/GeoZoneTracker.swift | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/iphone/Maps/Core/Location/GeoTracker/Impl/GeoTracker.swift b/iphone/Maps/Core/Location/GeoTracker/Impl/GeoTracker.swift index 99421f35e8..a0e4c7ad83 100644 --- a/iphone/Maps/Core/Location/GeoTracker/Impl/GeoTracker.swift +++ b/iphone/Maps/Core/Location/GeoTracker/Impl/GeoTracker.swift @@ -41,7 +41,7 @@ extension GeoTracker: CLLocationManagerDelegate { zones.forEach { locationManager.startMonitoring( for: CLCircularRegion(center: CLLocationCoordinate2DMake($0.latitude, $0.longitude), - radius: 20, + radius: 100, identifier: $0.identifier)) } trackingZones = zones.reduce(into: [:]) { $0[$1.identifier] = $1 } diff --git a/iphone/Maps/Core/Location/GeoTracker/Impl/GeoZoneTracker.swift b/iphone/Maps/Core/Location/GeoTracker/Impl/GeoZoneTracker.swift index 9816a7033a..85ff4845be 100644 --- a/iphone/Maps/Core/Location/GeoTracker/Impl/GeoZoneTracker.swift +++ b/iphone/Maps/Core/Location/GeoTracker/Impl/GeoZoneTracker.swift @@ -6,13 +6,14 @@ class GeoZoneTracker: NSObject { init(_ zone: IMWMGeoTrackerZone, trackerCore: IMWMGeoTrackerCore) { self.geoZone = zone self.trackerCore = trackerCore - locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters + locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters locationManager.distanceFilter = 10 super.init() locationManager.delegate = self } deinit { + stopTracking() locationManager.delegate = nil } @@ -28,7 +29,7 @@ class GeoZoneTracker: NSObject { extension GeoZoneTracker: CLLocationManagerDelegate { func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { if let visitedLocation = locations.filter({ - $0.horizontalAccuracy <= 20 && + $0.horizontalAccuracy <= 30 && $0.distance(from: CLLocation(latitude: geoZone.latitude, longitude: geoZone.longitude)) <= 20 }).first { trackerCore.logEnter(geoZone, location: visitedLocation)