Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Update startGetLocation to only run if location is shared #1942

Merged
merged 7 commits into from
Dec 28, 2023
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,18 @@ internal class LocationManager(

// Started from this class or PermissionActivity
private suspend fun startGetLocation() {
Logging.debug("LocationManager.startGetLocation()") // with lastLocation: " + lastLocation)
try {
if (!_locationController.start()) {
Logging.warn("LocationManager.startGetLocation: not possible, no location dependency found")
if (isShared) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommend returning early instead if isShared is false, this keeps the code from getting to nested.

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,
)
}
} catch (t: Throwable) {
Logging.warn("LocationManager.startGetLocation: Location permission exists but there was an error initializing: ", t)
}
}
}
Loading