From 48946aa4ec2d618cc96731968257befc0eb99472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manu=20Mu=C3=B1oz?= Date: Tue, 5 Nov 2024 17:39:35 +0100 Subject: [PATCH] fix: [ANDROAPP-6635] allow manual selection when gps is off --- .../java/org/dhis2/maps/views/MapSelectorViewModel.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dhis2_android_maps/src/main/java/org/dhis2/maps/views/MapSelectorViewModel.kt b/dhis2_android_maps/src/main/java/org/dhis2/maps/views/MapSelectorViewModel.kt index be7a2e02cc..a2b50d83ad 100644 --- a/dhis2_android_maps/src/main/java/org/dhis2/maps/views/MapSelectorViewModel.kt +++ b/dhis2_android_maps/src/main/java/org/dhis2/maps/views/MapSelectorViewModel.kt @@ -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 @@ -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 @@ -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, ) }