Enable location sharing (#7703)

pull/21833/head
Andy Balaam 2022-02-02 11:44:17 +00:00 committed by GitHub
parent afbc843157
commit 70a44a8cd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 59 deletions

View File

@ -343,10 +343,7 @@ function textForMessageEvent(ev: MatrixEvent): () => string | null {
const content = ev.getContent(); const content = ev.getContent();
const msgtype = content.msgtype; const msgtype = content.msgtype;
if ( if (LOCATION_EVENT_TYPE.matches(type) || LOCATION_EVENT_TYPE.matches(msgtype)) {
(LOCATION_EVENT_TYPE.matches(type) || LOCATION_EVENT_TYPE.matches(msgtype)) &&
SettingsStore.getValue("feature_location_share")
) {
return textForLocationEvent(ev); return textForLocationEvent(ev);
} }

View File

@ -125,19 +125,17 @@ export default class MessageEvent extends React.Component<IProps> implements IMe
BodyType = UnknownBody; 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)) { if (M_POLL_START.matches(type)) {
BodyType = sdk.getComponent('messages.MPollBody'); BodyType = sdk.getComponent('messages.MPollBody');
} }
// TODO: move to eventTypes when location sharing spec stabilises
if ( if (
LOCATION_EVENT_TYPE.matches(type) || LOCATION_EVENT_TYPE.matches(type) ||
(type === EventType.RoomMessage && msgtype === MsgType.Location) (type === EventType.RoomMessage && msgtype === MsgType.Location)
) { ) {
// TODO: tidy this up once location sharing is out of labs BodyType = sdk.getComponent('messages.MLocationBody');
if (SettingsStore.getValue("feature_location_share")) {
BodyType = sdk.getComponent('messages.MLocationBody');
}
} }
} }

View File

@ -87,7 +87,6 @@ interface IState {
isMenuOpen: boolean; isMenuOpen: boolean;
isStickerPickerOpen: boolean; isStickerPickerOpen: boolean;
showStickersButton: boolean; showStickersButton: boolean;
showLocationButton: boolean;
} }
@replaceableComponent("views.rooms.MessageComposer") @replaceableComponent("views.rooms.MessageComposer")
@ -118,17 +117,11 @@ export default class MessageComposer extends React.Component<IProps, IState> {
isMenuOpen: false, isMenuOpen: false,
isStickerPickerOpen: false, isStickerPickerOpen: false,
showStickersButton: SettingsStore.getValue("MessageComposerInput.showStickersButton"), showStickersButton: SettingsStore.getValue("MessageComposerInput.showStickersButton"),
showLocationButton: (
!window.electron &&
SettingsStore.getValue("MessageComposerInput.showLocationButton")
),
}; };
this.instanceId = instanceCount++; this.instanceId = instanceCount++;
SettingsStore.monitorSetting("MessageComposerInput.showStickersButton", null); SettingsStore.monitorSetting("MessageComposerInput.showStickersButton", null);
SettingsStore.monitorSetting("MessageComposerInput.showLocationButton", null);
SettingsStore.monitorSetting("feature_location_share", null);
} }
componentDidMount() { componentDidMount() {
@ -174,19 +167,6 @@ export default class MessageComposer extends React.Component<IProps, IState> {
} }
break; 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<IProps, IState> {
} }
}} }}
setStickerPickerOpen={this.setStickerPickerOpen} setStickerPickerOpen={this.setStickerPickerOpen}
showLocationButton={this.state.showLocationButton} showLocationButton={!window.electron}
showStickersButton={this.state.showStickersButton} showStickersButton={this.state.showStickersButton}
toggleButtonMenu={this.toggleButtonMenu} toggleButtonMenu={this.toggleButtonMenu}
/> />

View File

@ -304,16 +304,6 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
}); });
}; };
getShowLocationIfEnabled(): string[] {
// TODO: when location sharing is out of labs, this can be deleted and
// we can just add this to COMPOSER_SETTINGS
if (!window.electron && SettingsStore.getValue("feature_location_share")) {
return ['MessageComposerInput.showLocationButton'];
} else {
return [];
}
}
render() { render() {
let autoLaunchOption = null; let autoLaunchOption = null;
if (this.state.autoLaunchSupported) { if (this.state.autoLaunchSupported) {
@ -395,10 +385,7 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
<div className="mx_SettingsTab_section"> <div className="mx_SettingsTab_section">
<span className="mx_SettingsTab_subheading">{ _t("Composer") }</span> <span className="mx_SettingsTab_subheading">{ _t("Composer") }</span>
{ this.renderGroup([ { this.renderGroup(PreferencesUserSettingsTab.COMPOSER_SETTINGS) }
...PreferencesUserSettingsTab.COMPOSER_SETTINGS,
...this.getShowLocationIfEnabled(),
]) }
</div> </div>
<div className="mx_SettingsTab_section"> <div className="mx_SettingsTab_section">

View File

@ -883,7 +883,6 @@
"Show message previews for reactions in all rooms": "Show message previews for reactions in all rooms", "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", "Offline encrypted messaging using dehydrated devices": "Offline encrypted messaging using dehydrated devices",
"Show extensible event representation of events": "Show extensible event representation of events", "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", "Show info about bridges in room settings": "Show info about bridges in room settings",
"Use new room breadcrumbs": "Use new room breadcrumbs", "Use new room breadcrumbs": "Use new room breadcrumbs",
"New spotlight search experience": "New spotlight search experience", "New spotlight search experience": "New spotlight search experience",
@ -894,7 +893,6 @@
"Use custom size": "Use custom size", "Use custom size": "Use custom size",
"Enable Emoji suggestions while typing": "Enable Emoji suggestions while typing", "Enable Emoji suggestions while typing": "Enable Emoji suggestions while typing",
"Show stickers button": "Show stickers button", "Show stickers button": "Show stickers button",
"Enable location sharing": "Enable location sharing",
"Use a more compact 'Modern' layout": "Use a more compact 'Modern' layout", "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 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)", "Show join/leave messages (invites/removes/bans unaffected)": "Show join/leave messages (invites/removes/bans unaffected)",

View File

@ -305,13 +305,6 @@ export const SETTINGS: {[setting: string]: ISetting} = {
displayName: _td("Show extensible event representation of events"), displayName: _td("Show extensible event representation of events"),
default: false, default: false,
}, },
"feature_location_share": {
isFeature: true,
labsGroup: LabGroup.Messaging,
supportedLevels: LEVELS_FEATURE,
displayName: _td("Location sharing (under active development)"),
default: false,
},
"doNotDisturb": { "doNotDisturb": {
supportedLevels: [SettingLevel.DEVICE], supportedLevels: [SettingLevel.DEVICE],
default: false, default: false,
@ -394,12 +387,6 @@ export const SETTINGS: {[setting: string]: ISetting} = {
default: true, default: true,
controller: new UIFeatureController(UIFeature.Widgets, false), 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) // TODO: Wire up appropriately to UI (FTUE notifications)
"Notifications.alwaysShowBadgeCounts": { "Notifications.alwaysShowBadgeCounts": {
supportedLevels: LEVELS_ROOM_OR_ACCOUNT, supportedLevels: LEVELS_ROOM_OR_ACCOUNT,