Skip to content

Commit

Permalink
fix: [ANDROAPP-6635] allow manual selection when gps is off
Browse files Browse the repository at this point in the history
  • Loading branch information
mmmateos authored and Balcan committed Nov 8, 2024
1 parent 277cf70 commit 48946aa
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import org.dhis2.maps.layer.types.FEATURE_PROPERTY_PLACES
import org.dhis2.maps.location.LocationState
import org.dhis2.maps.location.LocationState.FIXED
import org.dhis2.maps.location.LocationState.NOT_FIXED
import org.dhis2.maps.location.LocationState.OFF
import org.dhis2.maps.model.AccuracyRange
import org.dhis2.maps.model.MapData
import org.dhis2.maps.model.MapSelectorScreenState
Expand Down Expand Up @@ -449,7 +450,8 @@ class MapSelectorViewModel(

private fun canCaptureWithSwipe() = featureType == FeatureType.POINT &&
_screenState.value.isManualCaptureEnabled &&
_screenState.value.selectedLocation !is SelectedLocation.None
(_screenState.value.selectedLocation !is SelectedLocation.None ||
_screenState.value.captureMode.isManual())

fun canCaptureManually(): Boolean {
return _screenState.value.isManualCaptureEnabled
Expand Down Expand Up @@ -477,7 +479,11 @@ class MapSelectorViewModel(

else -> {
updateScreenState(
captureMode = if (locationState == FIXED) CaptureMode.GPS else _screenState.value.captureMode,
captureMode = when (locationState) {
FIXED -> CaptureMode.GPS
OFF -> CaptureMode.MANUAL
else -> _screenState.value.captureMode
},
locationState = locationState,
)
}
Expand Down

0 comments on commit 48946aa

Please sign in to comment.