From 32c517b60c32b19d1fbe59c9f06e40c31c2495da Mon Sep 17 00:00:00 2001 From: Abhishek Banthia <8280282+n0shake@users.noreply.github.com> Date: Sun, 21 May 2023 03:25:36 +0530 Subject: [PATCH] Update LocationController.swift --- Clocker/Clocker/LocationController.swift | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Clocker/Clocker/LocationController.swift b/Clocker/Clocker/LocationController.swift index 3b43b9c..60eb8a2 100644 --- a/Clocker/Clocker/LocationController.swift +++ b/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: