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

Enable location sharing #7703

Merged
merged 3 commits into from
Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/TextForEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
8 changes: 3 additions & 5 deletions src/components/views/messages/MessageEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,19 +125,17 @@ export default class MessageEvent extends React.Component<IProps> implements IMe
BodyType = UnknownBody;
}

// TODO: this can be done in eventTypes when Polls stabilise
// TODO: this can be done in eventTypes when Polls stabilises
andybalaam marked this conversation as resolved.
Show resolved Hide resolved
if (M_POLL_START.matches(type)) {
BodyType = sdk.getComponent('messages.MPollBody');
}

// TODO: this can be done in eventTypes when location sharing stabilises
andybalaam marked this conversation as resolved.
Show resolved Hide resolved
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');
}
}

Expand Down
22 changes: 1 addition & 21 deletions src/components/views/rooms/MessageComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ interface IState {
isMenuOpen: boolean;
isStickerPickerOpen: boolean;
showStickersButton: boolean;
showLocationButton: boolean;
}

@replaceableComponent("views.rooms.MessageComposer")
Expand Down Expand Up @@ -118,17 +117,11 @@ export default class MessageComposer extends React.Component<IProps, IState> {
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() {
Expand Down Expand Up @@ -174,19 +167,6 @@ export default class MessageComposer extends React.Component<IProps, IState> {
}
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;
}
}
}
}
Expand Down Expand Up @@ -463,7 +443,7 @@ export default class MessageComposer extends React.Component<IProps, IState> {
}
}}
setStickerPickerOpen={this.setStickerPickerOpen}
showLocationButton={this.state.showLocationButton}
showLocationButton={!window.electron}
showStickersButton={this.state.showStickersButton}
toggleButtonMenu={this.toggleButtonMenu}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
let autoLaunchOption = null;
if (this.state.autoLaunchSupported) {
Expand Down Expand Up @@ -395,10 +385,7 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,

<div className="mx_SettingsTab_section">
<span className="mx_SettingsTab_subheading">{ _t("Composer") }</span>
{ this.renderGroup([
...PreferencesUserSettingsTab.COMPOSER_SETTINGS,
...this.getShowLocationIfEnabled(),
]) }
{ this.renderGroup(PreferencesUserSettingsTab.COMPOSER_SETTINGS) }
</div>

<div className="mx_SettingsTab_section">
Expand Down
13 changes: 0 additions & 13 deletions src/settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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),
},
t3chguy marked this conversation as resolved.
Show resolved Hide resolved
// TODO: Wire up appropriately to UI (FTUE notifications)
"Notifications.alwaysShowBadgeCounts": {
supportedLevels: LEVELS_ROOM_OR_ACCOUNT,
Expand Down