Commit 1fe1b54b by Demid Merzlyakov

Fix the flow for enabling location permissions outside the app and then logging in.

parent 899bbabd
...@@ -151,6 +151,18 @@ internal class DeviceLocationMonitor: NSObject { ...@@ -151,6 +151,18 @@ internal class DeviceLocationMonitor: NSObject {
} }
} }
public func startLocationUpdatesIfPossible() {
onMain {
guard CLLocationManager.locationServicesEnabled() else {
return
}
guard CLLocationManager.authorizationStatus() == CLAuthorizationStatus.authorizedAlways || CLLocationManager.authorizationStatus() == CLAuthorizationStatus.authorizedWhenInUse else {
return
}
self.locationManager.startUpdatingLocation()
}
}
public var hasLocationPermissions: Bool { public var hasLocationPermissions: Bool {
guard CLLocationManager.locationServicesEnabled() else { guard CLLocationManager.locationServicesEnabled() else {
return false return false
......
...@@ -231,6 +231,7 @@ public class LocationManager { ...@@ -231,6 +231,7 @@ public class LocationManager {
} }
} }
self.loadedLocations = true self.loadedLocations = true
self.deviceLocationMonitor.startLocationUpdatesIfPossible()
} }
} }
} }
......
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