diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/feature/search/SearchScreenViewModel.kt b/app/src/main/java/com/pranshulgg/weather_master_app/feature/search/SearchScreenViewModel.kt index d17eef1ea..eed76391a 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/feature/search/SearchScreenViewModel.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/feature/search/SearchScreenViewModel.kt @@ -9,6 +9,7 @@ import androidx.lifecycle.viewModelScope import com.pranshulgg.weather_master_app.R import com.pranshulgg.weather_master_app.core.model.sources.Capability import com.pranshulgg.weather_master_app.core.model.sources.SearchSource +import com.pranshulgg.weather_master_app.core.model.sources.getSourcesForCountry import com.pranshulgg.weather_master_app.core.model.domain.location.Location import com.pranshulgg.weather_master_app.core.model.domain.toAppException import com.pranshulgg.weather_master_app.core.model.domain.toMessageRes @@ -84,7 +85,9 @@ class SearchScreenViewModel @Inject constructor( val alertSource = if (Capability.ALERTS in weatherSource.capabilities) { weatherSource } else { - resolved.alertSource + getSourcesForCountry(resolved.countryCode?.uppercase()) + .firstOrNull { Capability.ALERTS in it.capabilities } + ?: resolved.alertSource } locationsRepo.saveLocation(resolved.copy(source = weatherSource, alertSource = alertSource)) onBack() diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/feature/shared/ui/SharedBottomSheets.kt b/app/src/main/java/com/pranshulgg/weather_master_app/feature/shared/ui/SharedBottomSheets.kt index 82435d0ed..b6be39e9f 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/feature/shared/ui/SharedBottomSheets.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/feature/shared/ui/SharedBottomSheets.kt @@ -55,6 +55,7 @@ object SharedBottomSheet { ) { if (show) { val recommendedSources = getSourcesForCountry(countryCode?.uppercase()) + .filter { Capability.WEATHER in it.capabilities } val globalSources = getSourcesGlobal().filter { Capability.WEATHER in it.capabilities } val isApiKeyAvailable: (Source) -> Boolean = { source ->