From 2fb05257564a121d67bf66c537bdee1f544c3b7b Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 27 Oct 2020 11:13:55 +0000 Subject: [PATCH] Fix theme variable passed to Jitsi --- src/stores/widgets/StopGapWidget.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/stores/widgets/StopGapWidget.ts b/src/stores/widgets/StopGapWidget.ts index edce39d033..4cc8a99d74 100644 --- a/src/stores/widgets/StopGapWidget.ts +++ b/src/stores/widgets/StopGapWidget.ts @@ -49,6 +49,8 @@ import defaultDispatcher from "../../dispatcher/dispatcher"; import { ElementWidgetActions } from "./ElementWidgetActions"; import Modal from "../../Modal"; import WidgetOpenIDPermissionsDialog from "../../components/views/dialogs/WidgetOpenIDPermissionsDialog"; +import ThemeWatcher from "../../settings/watchers/ThemeWatcher"; +import {getCustomTheme} from "../../theme"; // TODO: Destroy all of this code @@ -102,9 +104,25 @@ class ElementWidget extends Widget { // v1 widgets default to jitsi.riot.im regardless of user settings domain = "jitsi.riot.im"; } + + let theme = new ThemeWatcher().getEffectiveTheme(); + if (theme.startsWith("custom-")) { + const customTheme = getCustomTheme(theme.substr(7)); + // Jitsi only understands light/dark + theme = customTheme.is_dark ? "dark" : "light"; + } + + // only allow light/dark through, defaulting to dark as that was previously the only state + // accounts for legacy-light/legacy-dark themes too + if (theme.includes("light")) { + theme = "light"; + } else { + theme = "dark"; + } + return { ...super.rawData, - theme: SettingsStore.getValue("theme"), + theme, conferenceId, domain, };