From 853c522467e177c3437e8faf587e5192068120e2 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 3 Oct 2019 23:20:00 -0600 Subject: [PATCH 1/2] Enable CIDER composer by default Also convert the setting to a watched setting to apply in realtime. --- src/components/structures/RoomView.js | 14 +++++++++++++- .../tabs/user/PreferencesUserSettingsTab.js | 1 + src/i18n/strings/en_EN.json | 2 +- src/settings/Settings.js | 13 ++++++------- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 27b9d93e50..8cade404a9 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -166,6 +166,8 @@ module.exports = createReactClass({ canReact: false, canReply: false, + + useCider: false, }; }, @@ -201,6 +203,14 @@ module.exports = createReactClass({ this._onRoomViewStoreUpdate(true); WidgetEchoStore.on('update', this._onWidgetEchoStoreUpdate); + + this.setState({useCider: SettingsStore.getValue("useCiderComposer")}); + this._ciderWatcherRef = SettingsStore.watchSetting( + "useCiderComposer", null, this._onCiderUpdated); + }, + + _onCiderUpdated: function() { + this.setState({useCider: SettingsStore.getValue("useCiderComposer")}); }, _onRoomViewStoreUpdate: function(initial) { @@ -479,6 +489,8 @@ module.exports = createReactClass({ // (We could use isMounted, but facebook have deprecated that.) this.unmounted = true; + SettingsStore.unwatchSetting(this._ciderWatcherRef); + // update the scroll map before we get unmounted if (this.state.roomId) { RoomScrollStateStore.setScrollState(this.state.roomId, this._getScrollState()); @@ -1793,7 +1805,7 @@ module.exports = createReactClass({ myMembership === 'join' && !this.state.searchResults ); if (canSpeak) { - if (SettingsStore.isFeatureEnabled("feature_cider_composer")) { + if (this.state.useCider) { const MessageComposer = sdk.getComponent('rooms.MessageComposer'); messageComposer = Date: Fri, 4 Oct 2019 10:15:00 +0100 Subject: [PATCH 2/2] DRY and fix useCiderComposer being in both labs and preferences Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/RoomView.js | 2 +- src/settings/Settings.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 8cade404a9..4de573479d 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -204,7 +204,7 @@ module.exports = createReactClass({ WidgetEchoStore.on('update', this._onWidgetEchoStoreUpdate); - this.setState({useCider: SettingsStore.getValue("useCiderComposer")}); + this._onCiderUpdated(); this._ciderWatcherRef = SettingsStore.watchSetting( "useCiderComposer", null, this._onCiderUpdated); }, diff --git a/src/settings/Settings.js b/src/settings/Settings.js index fda94091a4..3c33ae57fe 100644 --- a/src/settings/Settings.js +++ b/src/settings/Settings.js @@ -121,7 +121,6 @@ export const SETTINGS = { default: false, }, "useCiderComposer": { - isFeature: true, displayName: _td("Use the new, faster, composer for writing messages"), supportedLevels: LEVELS_ACCOUNT_SETTINGS, default: true,