Skip to content

Commit

Permalink
Update startGetLocation to return early if isShared is false
Browse files Browse the repository at this point in the history
  • Loading branch information
jennantilla committed Dec 13, 2023
1 parent 7bc4aa3 commit ec79584
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,20 @@ internal class LocationManager(

// Started from this class or PermissionActivity
private suspend fun startGetLocation() {
if (isShared) {
Logging.debug("LocationManager.startGetLocation()") // with lastLocation: " + lastLocation)
try {
if (!_locationController.start()) {
Logging.warn("LocationManager.startGetLocation: not possible, no location dependency found")
}
} catch (t: Throwable) {
Logging.warn(
"LocationManager.startGetLocation: Location permission exists but there was an error initializing: ",
t,
)
if (!isShared) {
return
}

Logging.debug("LocationManager.startGetLocation()") // with lastLocation: " + lastLocation)
try {
if (!_locationController.start()) {
Logging.warn("LocationManager.startGetLocation: not possible, no location dependency found")
}
} catch (t: Throwable) {
Logging.warn(
"LocationManager.startGetLocation: Location permission exists but there was an error initializing: ",
t,
)
}
}
}

0 comments on commit ec79584

Please sign in to comment.