Add weather plugin specific settings

This commit is contained in:
MM20
2023-12-29 17:50:55 +01:00
parent f984f68b34
commit 35ff1bce1a
8 changed files with 145 additions and 5 deletions
@@ -46,6 +46,10 @@ interface PluginService {
enabled: Boolean? = null,
): Flow<List<PluginWithState>>
fun getPluginWithState(
authority: String,
): Flow<PluginWithState?>
fun getPluginPackages(): Flow<List<PluginPackage>>
fun getPluginPackage(packageName: String): Flow<PluginPackage?>
suspend fun getPluginState(plugin: Plugin): PluginState?
@@ -132,6 +136,17 @@ internal class PluginServiceImpl(
}
}
override fun getPluginWithState(authority: String): Flow<PluginWithState?> {
return repository.get(authority).map {
it?.let {
PluginWithState(
plugin = it,
state = getPluginState(it),
)
}
}
}
override suspend fun getPluginState(plugin: Plugin): PluginState {
val bundle =
try {