Enable CIDER composer by default

Also convert the setting to a watched setting to apply in realtime.
This commit is contained in:
Travis Ralston 2019-10-03 23:20:00 -06:00
parent 47c41759f7
commit 853c522467
4 changed files with 21 additions and 9 deletions

View file

@ -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 =
<MessageComposer