You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
func authorizationStatus() {
Task(operation: {
try await location.requestPermission(.whenInUse) // obtain the permissions
let userLocation = try await location.requestLocation() // get the location
for await event in await location.startMonitoringAuthorization() {
print("Authorization status did change: \(event.authorizationStatus)")
switch event.authorizationStatus {
case .authorizedAlways, .authorizedWhenInUse:
let obtaninedStatus = try await location.requestPermission(.whenInUse)
self.locationServiceStatus()
case .notDetermined, .restricted, .denied :
AlertHelper.showAlert(title: StaticString.alertTitle, message: "location_failure".localize(), viewController: self) {
DashboardViewModel.shared.openLocationSettings()
}
default:
return
}
break
}
})
}
func continousLocationMonitoring() {
Task(operation: {
for await event in try await self.location.startMonitoringLocations() {
switch event {
case .didPaused:
PrintLog.info("location did paused startMonitoringLocations")
break
// stream paused
case .didResume:
PrintLog.info("location did resume startMonitoringLocations")
break
// stream resumed
case .didUpdateLocations(let locations):
debugPrint("locations startMonitoringLocations -----------", locations)
for location in locations {
processMapCurrentLocation(location: location)
}
// new locations received
case let .didFailed(error):
PrintLog.info("location did fail with error startMonitoringLocations \(error.localizedDescription)")
break
// an error has occured
}
// break to stop the stream
}
})
}
Issue: It is not navigating inside of the for loop function of above statement locationServiceStatus() and authorizationStatus()
can you please help me how can I fix.
Other Information
No response
The text was updated successfully, but these errors were encountered:
What problem are you facing?
View did load () {
authorizationStatus()
}
func locationServiceStatus() {
Task(operation: {
for await event in await location.startMonitoringLocationServices() {
if event.isLocationEnabled {
self.continousLocationMonitoring()
} else {
AlertHelper.showAlert(title: StaticString.alertTitle, message: "camera_permission".localize(), viewController: self) {
DashboardViewModel.shared.openLocationSettings()
}
}
print("Location Services are (event.isLocationEnabled ? "enabled" : "disabled")")
break
}
})
}
Other Information
No response
The text was updated successfully, but these errors were encountered: