Skip to content
Snippets Groups Projects
Commit 98063d6f authored by Kateryna Kostiuk's avatar Kateryna Kostiuk
Browse files

location: allow background access only when share location

Change-Id: Ie472b6675f9754e37bc9d5de9fef4a5c43d1edb6
parent ed03aaa0
No related branches found
No related tags found
No related merge requests found
......@@ -154,7 +154,6 @@ class LocationSharingService: NSObject {
self.locationManager.delegate = self
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest
self.locationManager.allowsBackgroundLocationUpdates = true
self.initialize()
}
......@@ -227,6 +226,7 @@ extension LocationSharingService {
self.outgoingInstances.insertOrUpdate(instanceToInsert)
self.locationManager.startUpdatingLocation()
self.locationManager.allowsBackgroundLocationUpdates = true
}
private func doShareLocationAction(_ location: CLLocation) {
......@@ -247,6 +247,7 @@ extension LocationSharingService {
func stopSharingLocation(accountId: String, contactUri: String) {
self.outgoingInstances.get(accountId, contactUri)?.invalidate()
self.locationManager.allowsBackgroundLocationUpdates = false
_ = self.outgoingInstances.remove(accountId, contactUri)
if self.outgoingInstances.isEmpty {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment