Add debug options to weather settings screen

This commit is contained in:
MM20
2022-01-03 22:51:55 +01:00
parent 497625a9e6
commit 2a01bccb62
3 changed files with 27 additions and 0 deletions
@@ -32,6 +32,8 @@ interface WeatherRepository {
fun selectProvider(provider: WeatherSettings.WeatherProvider)
val selectedProvider: Flow<WeatherSettings.WeatherProvider>
fun clearForecasts()
}
class WeatherRepositoryImpl(
@@ -174,6 +176,14 @@ class WeatherRepositoryImpl(
.build()
WorkManager.getInstance(context).enqueue(weatherRequest)
}
override fun clearForecasts() {
scope.launch {
withContext(Dispatchers.IO) {
database.weatherDao().deleteAll()
}
}
}
}
class WeatherUpdateWorker(val context: Context, params: WorkerParameters) :