diff --git a/src/components/views/rooms/MessageComposer.tsx b/src/components/views/rooms/MessageComposer.tsx index dc6951fd46a..8f737df2731 100644 --- a/src/components/views/rooms/MessageComposer.tsx +++ b/src/components/views/rooms/MessageComposer.tsx @@ -286,12 +286,16 @@ 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"), + showLocationButton: ( + SettingsStore.getValue("feature_location_share") && + SettingsStore.getValue("MessageComposerInput.showLocationButton") + ), }; this.instanceId = instanceCount++; SettingsStore.monitorSetting("MessageComposerInput.showStickersButton", null); + SettingsStore.monitorSetting("MessageComposerInput.showLocationButton", null); SettingsStore.monitorSetting("feature_polls", null); SettingsStore.monitorSetting("feature_location_share", null); } @@ -348,9 +352,14 @@ export default class MessageComposer extends React.Component { break; } + case "MessageComposerInput.showLocationButton": case "feature_location_share": { - const showLocationButton = SettingsStore.getValue( - "feature_location_share"); + const showLocationButton = ( + SettingsStore.getValue("feature_location_share") && + SettingsStore.getValue( + "MessageComposerInput.showLocationButton", + ) + ); if (this.state.showLocationButton !== showLocationButton) { this.setState({ showLocationButton }); } @@ -525,7 +534,7 @@ export default class MessageComposer extends React.Component { buttons.push( , ); - if (SettingsStore.getValue("feature_location_share")) { + if (this.state.showLocationButton) { const sender = this.props.room.getMember( MatrixClientPeg.get().getUserId(), ); diff --git a/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx b/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx index d3f99f31dcb..e8e9af7f0d9 100644 --- a/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx +++ b/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx @@ -296,6 +296,16 @@ export default class PreferencesUserSettingsTab extends React.Component { _t("Composer") } - { this.renderGroup(PreferencesUserSettingsTab.COMPOSER_SETTINGS) } + { this.renderGroup([ + ...PreferencesUserSettingsTab.COMPOSER_SETTINGS, + ...this.getShowLocationIfEnabled(), + ]) }
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 35049c2244b..504834e1e5a 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -892,6 +892,7 @@ "Use custom size": "Use custom size", "Enable Emoji suggestions while typing": "Enable Emoji suggestions while typing", "Show stickers button": "Show stickers button", + "Enable location sharing": "Enable location sharing", "Use a more compact 'Modern' layout": "Use a more compact 'Modern' layout", "Show a placeholder for removed messages": "Show a placeholder for removed messages", "Show join/leave messages (invites/removes/bans unaffected)": "Show join/leave messages (invites/removes/bans unaffected)", diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx index 7a2b952068d..bc7e3d1bb33 100644 --- a/src/settings/Settings.tsx +++ b/src/settings/Settings.tsx @@ -407,6 +407,12 @@ export const SETTINGS: {[setting: string]: ISetting} = { default: true, controller: new UIFeatureController(UIFeature.Widgets, false), }, + "MessageComposerInput.showLocationButton": { + supportedLevels: LEVELS_ACCOUNT_SETTINGS, + displayName: _td('Enable location sharing'), + default: true, + controller: new UIFeatureController(UIFeature.Widgets, false), + }, // TODO: Wire up appropriately to UI (FTUE notifications) "Notifications.alwaysShowBadgeCounts": { supportedLevels: LEVELS_ROOM_OR_ACCOUNT,