in muster-point-client/LocationManager.swift [50:77]
func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) {
switch manager.authorizationStatus {
case .authorizedWhenInUse:
print("Received authorization of user location, requesting for location")
let result = locationTracker.startTracking(
delegate: self,
options: TrackerOptions(
customDeviceId: Amplify.Auth.getCurrentUser()?.userId,
retrieveLocationFrequency: TimeInterval(5),
emitLocationFrequency: TimeInterval(20)
),
listener: onTrackingEvent
)
switch result {
case .success:
print("Tracking started successfully")
case let .failure(trackingError):
switch trackingError.errorType {
case .invalidTrackerName, .trackerAlreadyStarted, .unauthorized:
print("onFailedToStart \(trackingError)")
case let .serviceError(serviceError):
print("onFailedToStart serviceError: \(serviceError)")
}
}
default:
print("Failed to authorize")
}
}