From 70a44a8cd61692173c2f311a577cc89c22914ca5 Mon Sep 17 00:00:00 2001 From: Andy Balaam Date: Wed, 2 Feb 2022 11:44:17 +0000 Subject: [PATCH] Enable location sharing (#7703) --- src/TextForEvent.tsx | 5 +---- .../views/messages/MessageEvent.tsx | 8 +++---- .../views/rooms/MessageComposer.tsx | 22 +------------------ .../tabs/user/PreferencesUserSettingsTab.tsx | 15 +------------ src/i18n/strings/en_EN.json | 2 -- src/settings/Settings.tsx | 13 ----------- 6 files changed, 6 insertions(+), 59 deletions(-) diff --git a/src/TextForEvent.tsx b/src/TextForEvent.tsx index 9f6a3a76f5..174b64de0a 100644 --- a/src/TextForEvent.tsx +++ b/src/TextForEvent.tsx @@ -343,10 +343,7 @@ function textForMessageEvent(ev: MatrixEvent): () => string | null { const content = ev.getContent(); const msgtype = content.msgtype; - if ( - (LOCATION_EVENT_TYPE.matches(type) || LOCATION_EVENT_TYPE.matches(msgtype)) && - SettingsStore.getValue("feature_location_share") - ) { + if (LOCATION_EVENT_TYPE.matches(type) || LOCATION_EVENT_TYPE.matches(msgtype)) { return textForLocationEvent(ev); } diff --git a/src/components/views/messages/MessageEvent.tsx b/src/components/views/messages/MessageEvent.tsx index 8b4fa0f51a..ec310fef0c 100644 --- a/src/components/views/messages/MessageEvent.tsx +++ b/src/components/views/messages/MessageEvent.tsx @@ -125,19 +125,17 @@ export default class MessageEvent extends React.Component implements IMe BodyType = UnknownBody; } - // TODO: this can be done in eventTypes when Polls stabilise + // TODO: move to eventTypes when Polls spec stabilises if (M_POLL_START.matches(type)) { BodyType = sdk.getComponent('messages.MPollBody'); } + // TODO: move to eventTypes when location sharing spec stabilises if ( LOCATION_EVENT_TYPE.matches(type) || (type === EventType.RoomMessage && msgtype === MsgType.Location) ) { - // TODO: tidy this up once location sharing is out of labs - if (SettingsStore.getValue("feature_location_share")) { - BodyType = sdk.getComponent('messages.MLocationBody'); - } + BodyType = sdk.getComponent('messages.MLocationBody'); } } diff --git a/src/components/views/rooms/MessageComposer.tsx b/src/components/views/rooms/MessageComposer.tsx index c0873e9903..27982d71e2 100644 --- a/src/components/views/rooms/MessageComposer.tsx +++ b/src/components/views/rooms/MessageComposer.tsx @@ -87,7 +87,6 @@ interface IState { isMenuOpen: boolean; isStickerPickerOpen: boolean; showStickersButton: boolean; - showLocationButton: boolean; } @replaceableComponent("views.rooms.MessageComposer") @@ -118,17 +117,11 @@ export default class MessageComposer extends React.Component { isMenuOpen: false, isStickerPickerOpen: false, showStickersButton: SettingsStore.getValue("MessageComposerInput.showStickersButton"), - showLocationButton: ( - !window.electron && - SettingsStore.getValue("MessageComposerInput.showLocationButton") - ), }; this.instanceId = instanceCount++; SettingsStore.monitorSetting("MessageComposerInput.showStickersButton", null); - SettingsStore.monitorSetting("MessageComposerInput.showLocationButton", null); - SettingsStore.monitorSetting("feature_location_share", null); } componentDidMount() { @@ -174,19 +167,6 @@ export default class MessageComposer extends React.Component { } break; } - - case "MessageComposerInput.showLocationButton": - case "feature_location_share": { - const showLocationButton = ( - !window.electron && - SettingsStore.getValue("MessageComposerInput.showLocationButton") - ); - - if (this.state.showLocationButton !== showLocationButton) { - this.setState({ showLocationButton }); - } - break; - } } } } @@ -463,7 +443,7 @@ export default class MessageComposer extends React.Component { } }} setStickerPickerOpen={this.setStickerPickerOpen} - showLocationButton={this.state.showLocationButton} + showLocationButton={!window.electron} showStickersButton={this.state.showStickersButton} toggleButtonMenu={this.toggleButtonMenu} /> diff --git a/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx b/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx index c10b07d480..26e5249828 100644 --- a/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx +++ b/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx @@ -304,16 +304,6 @@ export default class PreferencesUserSettingsTab extends React.Component { _t("Composer") } - { this.renderGroup([ - ...PreferencesUserSettingsTab.COMPOSER_SETTINGS, - ...this.getShowLocationIfEnabled(), - ]) } + { this.renderGroup(PreferencesUserSettingsTab.COMPOSER_SETTINGS) }
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index ec1a079592..10cf93fe48 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -883,7 +883,6 @@ "Show message previews for reactions in all rooms": "Show message previews for reactions in all rooms", "Offline encrypted messaging using dehydrated devices": "Offline encrypted messaging using dehydrated devices", "Show extensible event representation of events": "Show extensible event representation of events", - "Location sharing (under active development)": "Location sharing (under active development)", "Show info about bridges in room settings": "Show info about bridges in room settings", "Use new room breadcrumbs": "Use new room breadcrumbs", "New spotlight search experience": "New spotlight search experience", @@ -894,7 +893,6 @@ "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 26ed5f872e..f60587a7e7 100644 --- a/src/settings/Settings.tsx +++ b/src/settings/Settings.tsx @@ -305,13 +305,6 @@ export const SETTINGS: {[setting: string]: ISetting} = { displayName: _td("Show extensible event representation of events"), default: false, }, - "feature_location_share": { - isFeature: true, - labsGroup: LabGroup.Messaging, - supportedLevels: LEVELS_FEATURE, - displayName: _td("Location sharing (under active development)"), - default: false, - }, "doNotDisturb": { supportedLevels: [SettingLevel.DEVICE], default: false, @@ -394,12 +387,6 @@ 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 IncompatibleController("feature_location_share", false, false), - }, // TODO: Wire up appropriately to UI (FTUE notifications) "Notifications.alwaysShowBadgeCounts": { supportedLevels: LEVELS_ROOM_OR_ACCOUNT,