Weather widget: add warning if selected providerr is unavailable
This commit is contained in:
@@ -27,6 +27,7 @@ import java.util.*
|
||||
import kotlin.time.Duration.Companion.minutes
|
||||
|
||||
interface WeatherRepository {
|
||||
fun getActiveProvider(): Flow<WeatherProviderInfo?>
|
||||
fun getProviders(): Flow<List<WeatherProviderInfo>>
|
||||
fun searchLocations(query: String): Flow<List<WeatherLocation>>
|
||||
|
||||
@@ -147,6 +148,14 @@ internal class WeatherRepositoryImpl(
|
||||
}
|
||||
}
|
||||
|
||||
override fun getActiveProvider(): Flow<WeatherProviderInfo?> {
|
||||
return settings.providerId.flatMapLatest { id ->
|
||||
getProviders().map {
|
||||
it.find { it.id == id }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getProviders(): Flow<List<WeatherProviderInfo>> {
|
||||
val providers = mutableListOf<WeatherProviderInfo>()
|
||||
providers.add(
|
||||
|
||||
Reference in New Issue
Block a user