Don't force update weather data on every restart
This commit is contained in:
parent
7b2ae4c8ac
commit
1d589e5246
@ -110,18 +110,21 @@ class WeatherRepositoryImpl(
|
||||
var providerSetting: WeatherSettings.WeatherProvider? = null
|
||||
selectedProvider.collectLatest {
|
||||
if (it != providerSetting) {
|
||||
providerSetting = it
|
||||
provider = get { parametersOf(it) }
|
||||
location.value = provider.getLocation()
|
||||
lastLocation.value = provider.getLastLocation()
|
||||
autoLocation.value = provider.autoLocation
|
||||
|
||||
// Force weather data update but only if provider has changed; not during
|
||||
// initialization
|
||||
if (providerSetting != null) {
|
||||
provider.resetLastUpdate()
|
||||
requestUpdate()
|
||||
}
|
||||
providerSetting = it
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
requestUpdate()
|
||||
}
|
||||
|
||||
private fun groupForecastsPerDay(forecasts: List<Forecast>): List<DailyForecast> {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user