Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 70a44a8

Browse files
authored
Enable location sharing (#7703)
1 parent afbc843 commit 70a44a8

File tree

6 files changed

+6
-59
lines changed

6 files changed

+6
-59
lines changed

src/TextForEvent.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,7 @@ function textForMessageEvent(ev: MatrixEvent): () => string | null {
343343
const content = ev.getContent();
344344
const msgtype = content.msgtype;
345345

346-
if (
347-
(LOCATION_EVENT_TYPE.matches(type) || LOCATION_EVENT_TYPE.matches(msgtype)) &&
348-
SettingsStore.getValue("feature_location_share")
349-
) {
346+
if (LOCATION_EVENT_TYPE.matches(type) || LOCATION_EVENT_TYPE.matches(msgtype)) {
350347
return textForLocationEvent(ev);
351348
}
352349

src/components/views/messages/MessageEvent.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,17 @@ export default class MessageEvent extends React.Component<IProps> implements IMe
125125
BodyType = UnknownBody;
126126
}
127127

128-
// TODO: this can be done in eventTypes when Polls stabilise
128+
// TODO: move to eventTypes when Polls spec stabilises
129129
if (M_POLL_START.matches(type)) {
130130
BodyType = sdk.getComponent('messages.MPollBody');
131131
}
132132

133+
// TODO: move to eventTypes when location sharing spec stabilises
133134
if (
134135
LOCATION_EVENT_TYPE.matches(type) ||
135136
(type === EventType.RoomMessage && msgtype === MsgType.Location)
136137
) {
137-
// TODO: tidy this up once location sharing is out of labs
138-
if (SettingsStore.getValue("feature_location_share")) {
139-
BodyType = sdk.getComponent('messages.MLocationBody');
140-
}
138+
BodyType = sdk.getComponent('messages.MLocationBody');
141139
}
142140
}
143141

src/components/views/rooms/MessageComposer.tsx

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ interface IState {
8787
isMenuOpen: boolean;
8888
isStickerPickerOpen: boolean;
8989
showStickersButton: boolean;
90-
showLocationButton: boolean;
9190
}
9291

9392
@replaceableComponent("views.rooms.MessageComposer")
@@ -118,17 +117,11 @@ export default class MessageComposer extends React.Component<IProps, IState> {
118117
isMenuOpen: false,
119118
isStickerPickerOpen: false,
120119
showStickersButton: SettingsStore.getValue("MessageComposerInput.showStickersButton"),
121-
showLocationButton: (
122-
!window.electron &&
123-
SettingsStore.getValue("MessageComposerInput.showLocationButton")
124-
),
125120
};
126121

127122
this.instanceId = instanceCount++;
128123

129124
SettingsStore.monitorSetting("MessageComposerInput.showStickersButton", null);
130-
SettingsStore.monitorSetting("MessageComposerInput.showLocationButton", null);
131-
SettingsStore.monitorSetting("feature_location_share", null);
132125
}
133126

134127
componentDidMount() {
@@ -174,19 +167,6 @@ export default class MessageComposer extends React.Component<IProps, IState> {
174167
}
175168
break;
176169
}
177-
178-
case "MessageComposerInput.showLocationButton":
179-
case "feature_location_share": {
180-
const showLocationButton = (
181-
!window.electron &&
182-
SettingsStore.getValue("MessageComposerInput.showLocationButton")
183-
);
184-
185-
if (this.state.showLocationButton !== showLocationButton) {
186-
this.setState({ showLocationButton });
187-
}
188-
break;
189-
}
190170
}
191171
}
192172
}
@@ -463,7 +443,7 @@ export default class MessageComposer extends React.Component<IProps, IState> {
463443
}
464444
}}
465445
setStickerPickerOpen={this.setStickerPickerOpen}
466-
showLocationButton={this.state.showLocationButton}
446+
showLocationButton={!window.electron}
467447
showStickersButton={this.state.showStickersButton}
468448
toggleButtonMenu={this.toggleButtonMenu}
469449
/>

src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -304,16 +304,6 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
304304
});
305305
};
306306

307-
getShowLocationIfEnabled(): string[] {
308-
// TODO: when location sharing is out of labs, this can be deleted and
309-
// we can just add this to COMPOSER_SETTINGS
310-
if (!window.electron && SettingsStore.getValue("feature_location_share")) {
311-
return ['MessageComposerInput.showLocationButton'];
312-
} else {
313-
return [];
314-
}
315-
}
316-
317307
render() {
318308
let autoLaunchOption = null;
319309
if (this.state.autoLaunchSupported) {
@@ -395,10 +385,7 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
395385

396386
<div className="mx_SettingsTab_section">
397387
<span className="mx_SettingsTab_subheading">{ _t("Composer") }</span>
398-
{ this.renderGroup([
399-
...PreferencesUserSettingsTab.COMPOSER_SETTINGS,
400-
...this.getShowLocationIfEnabled(),
401-
]) }
388+
{ this.renderGroup(PreferencesUserSettingsTab.COMPOSER_SETTINGS) }
402389
</div>
403390

404391
<div className="mx_SettingsTab_section">

src/i18n/strings/en_EN.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,6 @@
883883
"Show message previews for reactions in all rooms": "Show message previews for reactions in all rooms",
884884
"Offline encrypted messaging using dehydrated devices": "Offline encrypted messaging using dehydrated devices",
885885
"Show extensible event representation of events": "Show extensible event representation of events",
886-
"Location sharing (under active development)": "Location sharing (under active development)",
887886
"Show info about bridges in room settings": "Show info about bridges in room settings",
888887
"Use new room breadcrumbs": "Use new room breadcrumbs",
889888
"New spotlight search experience": "New spotlight search experience",
@@ -894,7 +893,6 @@
894893
"Use custom size": "Use custom size",
895894
"Enable Emoji suggestions while typing": "Enable Emoji suggestions while typing",
896895
"Show stickers button": "Show stickers button",
897-
"Enable location sharing": "Enable location sharing",
898896
"Use a more compact 'Modern' layout": "Use a more compact 'Modern' layout",
899897
"Show a placeholder for removed messages": "Show a placeholder for removed messages",
900898
"Show join/leave messages (invites/removes/bans unaffected)": "Show join/leave messages (invites/removes/bans unaffected)",

src/settings/Settings.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,6 @@ export const SETTINGS: {[setting: string]: ISetting} = {
305305
displayName: _td("Show extensible event representation of events"),
306306
default: false,
307307
},
308-
"feature_location_share": {
309-
isFeature: true,
310-
labsGroup: LabGroup.Messaging,
311-
supportedLevels: LEVELS_FEATURE,
312-
displayName: _td("Location sharing (under active development)"),
313-
default: false,
314-
},
315308
"doNotDisturb": {
316309
supportedLevels: [SettingLevel.DEVICE],
317310
default: false,
@@ -394,12 +387,6 @@ export const SETTINGS: {[setting: string]: ISetting} = {
394387
default: true,
395388
controller: new UIFeatureController(UIFeature.Widgets, false),
396389
},
397-
"MessageComposerInput.showLocationButton": {
398-
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
399-
displayName: _td('Enable location sharing'),
400-
default: true,
401-
controller: new IncompatibleController("feature_location_share", false, false),
402-
},
403390
// TODO: Wire up appropriately to UI (FTUE notifications)
404391
"Notifications.alwaysShowBadgeCounts": {
405392
supportedLevels: LEVELS_ROOM_OR_ACCOUNT,

0 commit comments

Comments
 (0)