mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
forward the theme to all widgets
This commit is contained in:
parent
afd2ecd384
commit
cf9d99ee8b
1 changed files with 14 additions and 10 deletions
|
@ -49,14 +49,6 @@ class WidgetArgsBuilder @Inject constructor(
|
|||
)
|
||||
}
|
||||
|
||||
private fun getTheme(): String {
|
||||
return if (ThemeUtils.isLightTheme(context)) {
|
||||
"light"
|
||||
} else {
|
||||
"dark"
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun buildStickerPickerArgs(roomId: String, widget: Widget): WidgetArgs {
|
||||
val widgetId = widget.widgetId
|
||||
|
@ -68,7 +60,8 @@ class WidgetArgsBuilder @Inject constructor(
|
|||
widgetId = widgetId,
|
||||
urlParams = mapOf(
|
||||
"widgetId" to widgetId,
|
||||
"room_id" to roomId
|
||||
"room_id" to roomId,
|
||||
"theme" to getTheme()
|
||||
).filterNotNull()
|
||||
)
|
||||
}
|
||||
|
@ -80,7 +73,10 @@ class WidgetArgsBuilder @Inject constructor(
|
|||
baseUrl = baseUrl,
|
||||
kind = WidgetKind.ROOM,
|
||||
roomId = roomId,
|
||||
widgetId = widgetId
|
||||
widgetId = widgetId,
|
||||
urlParams = mapOf(
|
||||
"theme" to getTheme()
|
||||
).filterNotNull()
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -88,4 +84,12 @@ class WidgetArgsBuilder @Inject constructor(
|
|||
private fun Map<String, String?>.filterNotNull(): Map<String, String> {
|
||||
return filterValues { it != null } as Map<String, String>
|
||||
}
|
||||
|
||||
private fun getTheme(): String {
|
||||
return if (ThemeUtils.isLightTheme(context)) {
|
||||
"light"
|
||||
} else {
|
||||
"dark"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue