Skip to content

Commit

Permalink
Fix showing map snackbar messages
Browse files Browse the repository at this point in the history
Signed-off-by: Elly Kitoto <[email protected]>
  • Loading branch information
ellykits committed Dec 10, 2024
1 parent 8e329f3 commit 3dca72c
Showing 1 changed file with 19 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ constructor(
}
}

_isSyncing.postValue(false)
geoJsonFeatures.postValue(features)

Timber.w(
Expand Down Expand Up @@ -202,43 +203,34 @@ constructor(
),
)
} else {
val message =
if (searchText.isNullOrBlank()) {
context.getString(R.string.all_locations_rendered)
} else {
context.getString(R.string.all_matching_locations_rendered, locationsCount)
}
emitSnackBarState(
SnackBarMessageConfig(
message = message,
actionLabel = context.getString(org.smartregister.fhircore.engine.R.string.ok),
duration = SnackbarDuration.Short,
),
)
}

// Account for missing locations
if (locationsCount == 0) {
if (!searchText.isNullOrBlank()) {
if (locationsCount == 0) {
val message =
context.getString(
R.string.no_found_locations_matching_text,
searchText,
)
Timber.w(message)
if (!searchText.isNullOrBlank()) {
context.getString(R.string.no_found_locations_matching_text, searchText)
} else context.getString(R.string.no_locations_to_render)
emitSnackBarState(
SnackBarMessageConfig(
message = message,
actionLabel = context.getString(org.smartregister.fhircore.engine.R.string.ok),
duration = SnackbarDuration.Long,
),
)
Timber.w(message)
} else {
SnackBarMessageConfig(
message = context.getString(R.string.no_locations_to_render),
actionLabel = context.getString(org.smartregister.fhircore.engine.R.string.ok),
duration = SnackbarDuration.Long,
val message =

Check warning on line 220 in android/quest/src/main/java/org/smartregister/fhircore/quest/ui/geowidget/GeoWidgetLauncherViewModel.kt

View check run for this annotation

Codecov / codecov/patch

android/quest/src/main/java/org/smartregister/fhircore/quest/ui/geowidget/GeoWidgetLauncherViewModel.kt#L220

Added line #L220 was not covered by tests
if (searchText.isNullOrBlank()) {
context.getString(R.string.all_locations_rendered)

Check warning on line 222 in android/quest/src/main/java/org/smartregister/fhircore/quest/ui/geowidget/GeoWidgetLauncherViewModel.kt

View check run for this annotation

Codecov / codecov/patch

android/quest/src/main/java/org/smartregister/fhircore/quest/ui/geowidget/GeoWidgetLauncherViewModel.kt#L222

Added line #L222 was not covered by tests
} else {
context.getString(R.string.all_matching_locations_rendered, locationsCount)
}
emitSnackBarState(
SnackBarMessageConfig(
message = message,
actionLabel = context.getString(org.smartregister.fhircore.engine.R.string.ok),
duration = SnackbarDuration.Short,

Check warning on line 230 in android/quest/src/main/java/org/smartregister/fhircore/quest/ui/geowidget/GeoWidgetLauncherViewModel.kt

View check run for this annotation

Codecov / codecov/patch

android/quest/src/main/java/org/smartregister/fhircore/quest/ui/geowidget/GeoWidgetLauncherViewModel.kt#L226-L230

Added lines #L226 - L230 were not covered by tests
),
)
Timber.w(message)
}
}
}
Expand Down

0 comments on commit 3dca72c

Please sign in to comment.