mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-26 09:33:14 +01: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
@ -16,11 +16,16 @@
|
|||||||
|
|
||||||
package im.vector.app.features.widgets
|
package im.vector.app.features.widgets
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import im.vector.app.core.di.ActiveSessionHolder
|
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 org.matrix.android.sdk.api.session.widgets.model.Widget
|
||||||
import javax.inject.Inject
|
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")
|
@Suppress("UNCHECKED_CAST")
|
||||||
fun buildIntegrationManagerArgs(roomId: String, integId: String?, screen: String?): WidgetArgs {
|
fun buildIntegrationManagerArgs(roomId: String, integId: String?, screen: String?): WidgetArgs {
|
||||||
@ -38,11 +43,20 @@ class WidgetArgsBuilder @Inject constructor(private val sessionHolder: ActiveSes
|
|||||||
urlParams = mapOf(
|
urlParams = mapOf(
|
||||||
"screen" to normalizedScreen,
|
"screen" to normalizedScreen,
|
||||||
"integ_id" to integId,
|
"integ_id" to integId,
|
||||||
"room_id" to roomId
|
"room_id" to roomId,
|
||||||
|
"theme" to getTheme()
|
||||||
).filterNotNull()
|
).filterNotNull()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user