mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-25 17:12:38 +01:00
forward the theme to all widgets
This commit is contained in:
parent
afd2ecd384
commit
cf9d99ee8b
@ -49,14 +49,6 @@ class WidgetArgsBuilder @Inject constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getTheme(): String {
|
|
||||||
return if (ThemeUtils.isLightTheme(context)) {
|
|
||||||
"light"
|
|
||||||
} else {
|
|
||||||
"dark"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
fun buildStickerPickerArgs(roomId: String, widget: Widget): WidgetArgs {
|
fun buildStickerPickerArgs(roomId: String, widget: Widget): WidgetArgs {
|
||||||
val widgetId = widget.widgetId
|
val widgetId = widget.widgetId
|
||||||
@ -68,7 +60,8 @@ class WidgetArgsBuilder @Inject constructor(
|
|||||||
widgetId = widgetId,
|
widgetId = widgetId,
|
||||||
urlParams = mapOf(
|
urlParams = mapOf(
|
||||||
"widgetId" to widgetId,
|
"widgetId" to widgetId,
|
||||||
"room_id" to roomId
|
"room_id" to roomId,
|
||||||
|
"theme" to getTheme()
|
||||||
).filterNotNull()
|
).filterNotNull()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -80,7 +73,10 @@ class WidgetArgsBuilder @Inject constructor(
|
|||||||
baseUrl = baseUrl,
|
baseUrl = baseUrl,
|
||||||
kind = WidgetKind.ROOM,
|
kind = WidgetKind.ROOM,
|
||||||
roomId = roomId,
|
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> {
|
private fun Map<String, String?>.filterNotNull(): Map<String, String> {
|
||||||
return filterValues { it != null } as 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 New Issue
Block a user