From ae2cb63a0d0fbfe705589320d6bc7ef3d9085699 Mon Sep 17 00:00:00 2001 From: Andy Balaam Date: Fri, 14 Jan 2022 15:04:09 +0000 Subject: [PATCH] Enable/disable location share button when setting is changed (#7545) --- src/components/views/rooms/MessageComposer.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/components/views/rooms/MessageComposer.tsx b/src/components/views/rooms/MessageComposer.tsx index 21d1cecedb..dc6951fd46 100644 --- a/src/components/views/rooms/MessageComposer.tsx +++ b/src/components/views/rooms/MessageComposer.tsx @@ -254,6 +254,7 @@ interface IState { showStickers: boolean; showStickersButton: boolean; showPollsButton: boolean; + showLocationButton: boolean; } @replaceableComponent("views.rooms.MessageComposer") @@ -285,12 +286,14 @@ export default class MessageComposer extends React.Component { showStickers: false, showStickersButton: SettingsStore.getValue("MessageComposerInput.showStickersButton"), showPollsButton: SettingsStore.getValue("feature_polls"), + showLocationButton: SettingsStore.getValue("feature_location_share"), }; this.instanceId = instanceCount++; SettingsStore.monitorSetting("MessageComposerInput.showStickersButton", null); SettingsStore.monitorSetting("feature_polls", null); + SettingsStore.monitorSetting("feature_location_share", null); } componentDidMount() { @@ -344,6 +347,15 @@ export default class MessageComposer extends React.Component { } break; } + + case "feature_location_share": { + const showLocationButton = SettingsStore.getValue( + "feature_location_share"); + if (this.state.showLocationButton !== showLocationButton) { + this.setState({ showLocationButton }); + } + break; + } } } }