mirror of
https://github.com/PranshulGG/WeatherMaster.git
synced 2026-10-21 10:40:23 -05:00
update alert and air quality source display strings and adjust recommended source filtering logic
This commit is contained in:
1 parent
9c3e5dbb97
commit
700c64bbfa
3 files changed
+37
-7
No files matched your search
+19
-4
@@ -127,6 +127,23 @@ fun EditLocationScreen(
|
||||
append(" (${effectiveOpenMeteoModel.displayName})")
|
||||
}
|
||||
}
|
||||
|
||||
val effectiveAlertSource = uiState.selectedAlertSource ?: uiState.location.alertSource
|
||||
val selectedAlertSourceString = buildString {
|
||||
append(effectiveAlertSource.displayName)
|
||||
effectiveAlertSource.countryNameRes?.let {
|
||||
append(" (${stringResource(it)})")
|
||||
}
|
||||
}
|
||||
|
||||
val effectiveAirQualitySource =
|
||||
uiState.selectedAirQualitySource ?: uiState.location.airQualitySource
|
||||
val selectedAirQualitySourceString = buildString {
|
||||
append(effectiveAlertSource.displayName)
|
||||
effectiveAirQualitySource.countryNameRes?.let {
|
||||
append(" (${stringResource(it)})")
|
||||
}
|
||||
}
|
||||
LargeTopBarScaffold(
|
||||
title = stringResource(R.string.location_edit),
|
||||
navigationIcon = { NavigateUpBtn(navController) },
|
||||
@@ -195,8 +212,7 @@ fun EditLocationScreen(
|
||||
),
|
||||
SettingTile.ActionTile(
|
||||
title = stringResource(R.string.weather_alert_source),
|
||||
description = uiState.selectedAlertSource?.displayName
|
||||
?: uiState.location.alertSource.displayName,
|
||||
description = selectedAlertSourceString,
|
||||
colorDesc = colorDesc,
|
||||
onClick = {
|
||||
viewModel.showAlertSourcesSheet()
|
||||
@@ -204,8 +220,7 @@ fun EditLocationScreen(
|
||||
),
|
||||
SettingTile.ActionTile(
|
||||
title = stringResource(R.string.weather_airquality_source),
|
||||
description = uiState.selectedAirQualitySource?.displayName
|
||||
?: uiState.location.airQualitySource.displayName,
|
||||
description = selectedAirQualitySourceString,
|
||||
colorDesc = colorDesc,
|
||||
onClick = {
|
||||
viewModel.showAirQualitySourcesSheet()
|
||||
|
||||
+3
-1
@@ -216,7 +216,8 @@ object EditLocationBottomSheet {
|
||||
|
||||
var recommendedSources = getSourcesForCountry(countryCode?.uppercase())
|
||||
|
||||
recommendedSources = recommendedSources.filter { Capability.ALERTS in it.capabilities }
|
||||
recommendedSources =
|
||||
recommendedSources.filter { Capability.AIR_QUALITY in it.capabilities }
|
||||
|
||||
val isApiKeyAvailable: (Source) -> Boolean = { source ->
|
||||
if (source.requiresUserApiKey) {
|
||||
@@ -287,6 +288,7 @@ object EditLocationBottomSheet {
|
||||
tiles = sources.filter { it !in recommendedSources }.map { source ->
|
||||
val isSelected = currentSelectedSource == source
|
||||
|
||||
|
||||
SettingTile.ActionTile(
|
||||
leading = {
|
||||
if (isSelected) Symbol(
|
||||
|
||||
+15
-2
@@ -47,8 +47,21 @@ object MainScreenBottomSheets {
|
||||
|
||||
}
|
||||
|
||||
val alertSourceString = buildString {
|
||||
append(location!!.alertSource.fullName)
|
||||
if (location.alertSource.countryNameRes != null) {
|
||||
append(" (${stringResource(location.alertSource.countryNameRes)})")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
val airQualitySourceString = buildString {
|
||||
append(location!!.airQualitySource.fullName)
|
||||
if (location.airQualitySource.countryNameRes != null) {
|
||||
append(" (${stringResource(location.airQualitySource.countryNameRes)})")
|
||||
}
|
||||
}
|
||||
|
||||
ActionBottomSheet(
|
||||
sheetState = sheetState,
|
||||
onCancel = viewModel::hideWeatherSourcesInfoForLocationSheet,
|
||||
@@ -76,7 +89,7 @@ object MainScreenBottomSheets {
|
||||
title = stringResource(R.string.weather_air_quality),
|
||||
tiles = listOf(
|
||||
SettingTile.ActionTile(
|
||||
title = location.airQualitySource.fullName,
|
||||
title = airQualitySourceString,
|
||||
description = location.airQualitySource.displayLink,
|
||||
trailing = { SettingsTileIcon(R.drawable.open_in_new_24px) },
|
||||
onClick = {
|
||||
@@ -92,7 +105,7 @@ object MainScreenBottomSheets {
|
||||
title = "Alerts",
|
||||
tiles = listOf(
|
||||
SettingTile.ActionTile(
|
||||
title = location.alertSource.fullName,
|
||||
title = alertSourceString,
|
||||
description = location.alertSource.displayLink,
|
||||
trailing = { SettingsTileIcon(R.drawable.open_in_new_24px) },
|
||||
onClick = {
|
||||
|
||||
Reference in new issue
Block a user