From 94ef80c0088e8bf2bc815306b136a620df4de371 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Sat, 16 Dec 2017 20:11:00 -0700 Subject: [PATCH 1/3] Support sending the current theme to widgets This is a namespaced variable because some clients may not be able to support themes, or may have varying definitions of what "light" means. Widgets are recommended to opt for per-client checks, or accept that some clients may differ. Signed-off-by: Travis Ralston --- src/components/views/rooms/AppsDrawer.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/views/rooms/AppsDrawer.js b/src/components/views/rooms/AppsDrawer.js index 78677e138b..365dc57777 100644 --- a/src/components/views/rooms/AppsDrawer.js +++ b/src/components/views/rooms/AppsDrawer.js @@ -27,6 +27,7 @@ import ScalarAuthClient from '../../../ScalarAuthClient'; import ScalarMessaging from '../../../ScalarMessaging'; import { _t } from '../../../languageHandler'; import WidgetUtils from '../../../WidgetUtils'; +import SettingsStore from "../../../settings/SettingsStore"; // The maximum number of widgets that can be added in a room const MAX_WIDGETS = 2; @@ -131,6 +132,9 @@ module.exports = React.createClass({ '$matrix_room_id': this.props.room.roomId, '$matrix_display_name': user ? user.displayName : this.props.userId, '$matrix_avatar_url': user ? MatrixClientPeg.get().mxcUrlToHttp(user.avatarUrl) : '', + + // Namespaced for Riot + '$riot_theme': SettingsStore.getValue("theme"), }; app.id = appId; From 678d87ef206d9ea52a5bd5f6ea046c2228c12ce2 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Sat, 16 Dec 2017 20:13:27 -0700 Subject: [PATCH 2/3] Give the current theme to the integration manager For integration managers which would like to theme themselves to match Riot. Signed-off-by: Travis Ralston --- src/ScalarAuthClient.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ScalarAuthClient.js b/src/ScalarAuthClient.js index 3e775a94ab..7bd8603264 100644 --- a/src/ScalarAuthClient.js +++ b/src/ScalarAuthClient.js @@ -15,6 +15,7 @@ limitations under the License. */ import Promise from 'bluebird'; +import SettingsStore from "./settings/SettingsStore"; const request = require('browser-request'); const SdkConfig = require('./SdkConfig'); @@ -109,6 +110,7 @@ class ScalarAuthClient { let url = SdkConfig.get().integrations_ui_url; url += "?scalar_token=" + encodeURIComponent(this.scalarToken); url += "&room_id=" + encodeURIComponent(roomId); + url += "&theme=" + encodeURIComponent(SettingsStore.getValue("theme")); if (id) { url += '&integ_id=' + encodeURIComponent(id); } From e5df0dcf1efc4c0b07f54b999d8cc99773d2b72d Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 18 Dec 2017 09:19:54 -0700 Subject: [PATCH 3/3] $riot_theme -> $theme Signed-off-by: Travis Ralston --- src/components/views/rooms/AppsDrawer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/rooms/AppsDrawer.js b/src/components/views/rooms/AppsDrawer.js index 365dc57777..e29f46fd37 100644 --- a/src/components/views/rooms/AppsDrawer.js +++ b/src/components/views/rooms/AppsDrawer.js @@ -133,8 +133,8 @@ module.exports = React.createClass({ '$matrix_display_name': user ? user.displayName : this.props.userId, '$matrix_avatar_url': user ? MatrixClientPeg.get().mxcUrlToHttp(user.avatarUrl) : '', - // Namespaced for Riot - '$riot_theme': SettingsStore.getValue("theme"), + // TODO: Namespace themes through some standard + '$theme': SettingsStore.getValue("theme"), }; app.id = appId;