mirror of https://github.com/vector-im/riot-web
Add setting for enabling location sharing (#7547)
parent
ae2cb63a0d
commit
18c82d57ae
|
@ -286,12 +286,16 @@ export default class MessageComposer extends React.Component<IProps, IState> {
|
|||
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<IProps, IState> {
|
|||
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<IProps, IState> {
|
|||
buttons.push(
|
||||
<UploadButton key="controls_upload" roomId={this.props.room.roomId} relation={this.props.relation} />,
|
||||
);
|
||||
if (SettingsStore.getValue("feature_location_share")) {
|
||||
if (this.state.showLocationButton) {
|
||||
const sender = this.props.room.getMember(
|
||||
MatrixClientPeg.get().getUserId(),
|
||||
);
|
||||
|
|
|
@ -296,6 +296,16 @@ 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 (SettingsStore.getValue("feature_location_share")) {
|
||||
return ['MessageComposerInput.showLocationButton'];
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
let autoLaunchOption = null;
|
||||
if (this.state.autoLaunchSupported) {
|
||||
|
@ -377,7 +387,10 @@ 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.renderGroup([
|
||||
...PreferencesUserSettingsTab.COMPOSER_SETTINGS,
|
||||
...this.getShowLocationIfEnabled(),
|
||||
]) }
|
||||
</div>
|
||||
|
||||
<div className="mx_SettingsTab_section">
|
||||
|
|
|
@ -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)",
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue