mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-27 03:49:04 +03:00
Give theme to the integration manager as per Element Web
https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/ScalarAuthClient.js#L277
This commit is contained in:
parent
557a5c715a
commit
6d53d0e12f
1 changed files with 16 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue