mirror of
https://github.com/home-assistant/android
synced 2024-10-15 20:43:06 +00:00
Fix template widgets that render null in websocket subscription (#2866)
Fix widgets that return null in websocket subscription - Just like in the preview, null is a valid result and should be handled by the app
This commit is contained in:
parent
a31afb3455
commit
6756e21112
|
@ -286,7 +286,7 @@ class TemplateWidget : AppWidgetProvider() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun onTemplateChanged(context: Context, appWidgetId: Int, template: String) {
|
||||
private fun onTemplateChanged(context: Context, appWidgetId: Int, template: String?) {
|
||||
widgetScope?.launch {
|
||||
val views = getWidgetRemoteViews(context, appWidgetId, template)
|
||||
AppWidgetManager.getInstance(context).updateAppWidget(appWidgetId, views)
|
||||
|
|
|
@ -15,7 +15,7 @@ interface IntegrationRepository {
|
|||
suspend fun getNotificationRateLimits(): RateLimitResponse
|
||||
|
||||
suspend fun renderTemplate(template: String, variables: Map<String, String>): String?
|
||||
suspend fun getTemplateUpdates(template: String): Flow<String>?
|
||||
suspend fun getTemplateUpdates(template: String): Flow<String?>?
|
||||
|
||||
suspend fun updateLocation(updateLocation: UpdateLocation)
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ class IntegrationRepositoryImpl @Inject constructor(
|
|||
else throw IntegrationException("Error calling integration request render_template")
|
||||
}
|
||||
|
||||
override suspend fun getTemplateUpdates(template: String): Flow<String>? {
|
||||
override suspend fun getTemplateUpdates(template: String): Flow<String?>? {
|
||||
return webSocketRepository.getTemplateUpdates(template)
|
||||
?.map {
|
||||
it.result
|
||||
|
|
|
@ -4,6 +4,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
|||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
data class TemplateUpdatedEvent(
|
||||
val result: String,
|
||||
val result: String?,
|
||||
val listeners: Map<String, Any>
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue