mirror of
https://github.com/PranshulGG/WeatherMaster.git
synced 2026-10-22 02:52:37 -05:00
Look up the air-quality source's own API key, not the weather source's
locationRequiresApiKey and the key lookup both used location.source (the weather source) instead of location.airQualitySource. Every air-quality source today happens to share a source with its weather counterpart, so this never surfaced, but it breaks - and currently crashes via !! in OpenWeatherRepository - whenever they differ and the air-quality source needs a key the weather source doesn't.
This commit is contained in:
1 parent
02ebad26ed
commit
17ef87f3dd
1 file changed
+2
-2
+2
-2
@@ -38,10 +38,10 @@ class CacheResolverForAirQuality @Inject constructor(
|
||||
val cache = dao.getAirQualityForLocation(location.id)
|
||||
val shouldReturnCache = shouldReturnAirQualityCache(cache, isManualRefresh, isForceRefresh)
|
||||
|
||||
val locationRequiresApiKey = location.source.requiresUserApiKey
|
||||
val locationRequiresApiKey = location.airQualitySource.requiresUserApiKey
|
||||
|
||||
val apiKey = if (locationRequiresApiKey)
|
||||
apiKeysDao.getApiKeyForSource(location.source) else null
|
||||
apiKeysDao.getApiKeyForSource(location.airQualitySource) else null
|
||||
|
||||
val domain = cache.toDomain()
|
||||
|
||||
|
||||
Reference in new issue
Block a user