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

fixed map search #3491

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import com.mapbox.geojson.FeatureCollection
import com.mapbox.geojson.MultiPoint
import com.mapbox.geojson.Point
import com.mapbox.mapboxsdk.Mapbox
import com.mapbox.mapboxsdk.camera.CameraPosition
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory
import com.mapbox.mapboxsdk.exceptions.MapboxConfigurationException
import com.mapbox.mapboxsdk.geometry.LatLngBounds
Expand Down Expand Up @@ -316,9 +317,13 @@ class GeoWidgetFragment : Fragment() {
},
)
}

=
private fun zoomToLocationsOnMap(features: List<Feature>) {
if (features.isEmpty()) return
if (features.isEmpty()) {
geoJsonSource?.setGeoJson(null as FeatureCollection?)
mapView.getMapAsync { mapboxMap -> mapboxMap.easeCamera(CameraUpdateFactory.newCameraPosition(CameraPosition.DEFAULT)) }
return
}
featureCollection = FeatureCollection.fromFeatures(features)

val locationPoints =
Copy link
Collaborator

Choose a reason for hiding this comment

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

This implementation was refactored.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This would no longer be required.

Copy link
Collaborator

Choose a reason for hiding this comment

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

See #3488

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,12 @@ class GeoWidgetLauncherFragment : Fragment(), OnSyncListener {
geoWidgetConfig = geoWidgetConfiguration,
searchText = searchText,
)
if (geoJsonFeatures.isNotEmpty()) {
geoWidgetViewModel.features.postValue(geoJsonFeatures)
} else {
geoWidgetViewModel.features.postValue(geoJsonFeatures)
if (geoJsonFeatures.isEmpty()) {
geoWidgetLauncherViewModel.emitSnackBarState(
SnackBarMessageConfig(
message =
getString(R.string.no_found_locations_matching_text, searchText),
getString(R.string.no_found_locations_matching_text, searchText),
),
)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This condition has just been inverted. Not necessary.

Copy link
Member

Choose a reason for hiding this comment

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

@owais-vd @syedowaisali please look into this.

Expand Down
2 changes: 1 addition & 1 deletion android/quest/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
<string name="submit_questionnaire">Submit</string>
<string name="invalid_base_resource">The base resource for GeoWidgetConfiguration MUST be Location</string>
<string name="no_search_coonfigs_provided">No configs provided for search bar</string>
<string name="no_found_locations_matching_text">No location found matching text \"%1$s\"</string>
<string name="no_found_locations_matching_text">No caregiver found matching text \"%1$s\"</string>
Copy link
Contributor

Choose a reason for hiding this comment

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

@owais-vd This change should not be here. But pushed to the Strings XML file of the build variant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

<string name="open_choice_other_hint">Other</string>
<string name="qr_code">qr_code</string>
<string name="barcode_camera_permission_denied">Camera permission request denied. Barcode may not work as expected</string>
Expand Down
Loading