diff --git a/vector/src/main/java/im/vector/app/features/widgets/WidgetArgsBuilder.kt b/vector/src/main/java/im/vector/app/features/widgets/WidgetArgsBuilder.kt index 198278a794..daca84add4 100644 --- a/vector/src/main/java/im/vector/app/features/widgets/WidgetArgsBuilder.kt +++ b/vector/src/main/java/im/vector/app/features/widgets/WidgetArgsBuilder.kt @@ -16,11 +16,16 @@ package im.vector.app.features.widgets +import android.content.Context import im.vector.app.core.di.ActiveSessionHolder +import im.vector.app.features.themes.ThemeUtils import org.matrix.android.sdk.api.session.widgets.model.Widget import javax.inject.Inject -class WidgetArgsBuilder @Inject constructor(private val sessionHolder: ActiveSessionHolder) { +class WidgetArgsBuilder @Inject constructor( + private val sessionHolder: ActiveSessionHolder, + private val context: Context +) { @Suppress("UNCHECKED_CAST") fun buildIntegrationManagerArgs(roomId: String, integId: String?, screen: String?): WidgetArgs { @@ -38,11 +43,20 @@ class WidgetArgsBuilder @Inject constructor(private val sessionHolder: ActiveSes urlParams = mapOf( "screen" to normalizedScreen, "integ_id" to integId, - "room_id" to roomId + "room_id" to roomId, + "theme" to getTheme() ).filterNotNull() ) } + 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