Browse Source

Update LocationController.swift

master
Abhishek Banthia 2 years ago
parent
commit
32c517b60c
  1. 12
      Clocker/Clocker/LocationController.swift

12
Clocker/Clocker/LocationController.swift

@ -11,9 +11,7 @@ protocol LocationControllerDelegate: NSObject {
class LocationController: NSObject {
private let store: DataStore
private static var sharedController = LocationController(withStore: DataStore.shared())
weak var delegate: LocationControllerDelegate?
init(withStore dataStore: DataStore) {
store = dataStore
super.init()
@ -24,10 +22,6 @@ class LocationController: NSObject {
locationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers
return locationManager
}()
class func shared() -> LocationController {
return sharedController
}
func authorizationStatus() -> CLAuthorizationStatus {
return CLLocationManager.authorizationStatus()
@ -61,9 +55,7 @@ class LocationController: NSObject {
case .authorizedAlways:
locationManager.startUpdatingLocation()
case .notDetermined:
if #available(macOS 10.15, *) {
locationManager.requestWhenInUseAuthorization()
}
locationManager.startUpdatingLocation()
case .denied, .restricted:
locationManager.startUpdatingLocation()
default:

Loading…
Cancel
Save