Add setting for enabling location sharing (#7547)
This commit is contained in:
parent
ae2cb63a0d
commit
18c82d57ae
4 changed files with 34 additions and 5 deletions
|
@ -286,12 +286,16 @@ export default class MessageComposer extends React.Component<IProps, IState> {
|
||||||
showStickers: false,
|
showStickers: false,
|
||||||
showStickersButton: SettingsStore.getValue("MessageComposerInput.showStickersButton"),
|
showStickersButton: SettingsStore.getValue("MessageComposerInput.showStickersButton"),
|
||||||
showPollsButton: SettingsStore.getValue("feature_polls"),
|
showPollsButton: SettingsStore.getValue("feature_polls"),
|
||||||
showLocationButton: SettingsStore.getValue("feature_location_share"),
|
showLocationButton: (
|
||||||
|
SettingsStore.getValue("feature_location_share") &&
|
||||||
|
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_polls", null);
|
SettingsStore.monitorSetting("feature_polls", null);
|
||||||
SettingsStore.monitorSetting("feature_location_share", null);
|
SettingsStore.monitorSetting("feature_location_share", null);
|
||||||
}
|
}
|
||||||
|
@ -348,9 +352,14 @@ export default class MessageComposer extends React.Component<IProps, IState> {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "MessageComposerInput.showLocationButton":
|
||||||
case "feature_location_share": {
|
case "feature_location_share": {
|
||||||
const showLocationButton = SettingsStore.getValue(
|
const showLocationButton = (
|
||||||
"feature_location_share");
|
SettingsStore.getValue("feature_location_share") &&
|
||||||
|
SettingsStore.getValue(
|
||||||
|
"MessageComposerInput.showLocationButton",
|
||||||
|
)
|
||||||
|
);
|
||||||
if (this.state.showLocationButton !== showLocationButton) {
|
if (this.state.showLocationButton !== showLocationButton) {
|
||||||
this.setState({ showLocationButton });
|
this.setState({ showLocationButton });
|
||||||
}
|
}
|
||||||
|
@ -525,7 +534,7 @@ export default class MessageComposer extends React.Component<IProps, IState> {
|
||||||
buttons.push(
|
buttons.push(
|
||||||
<UploadButton key="controls_upload" roomId={this.props.room.roomId} relation={this.props.relation} />,
|
<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(
|
const sender = this.props.room.getMember(
|
||||||
MatrixClientPeg.get().getUserId(),
|
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() {
|
render() {
|
||||||
let autoLaunchOption = null;
|
let autoLaunchOption = null;
|
||||||
if (this.state.autoLaunchSupported) {
|
if (this.state.autoLaunchSupported) {
|
||||||
|
@ -377,7 +387,10 @@ 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(PreferencesUserSettingsTab.COMPOSER_SETTINGS) }
|
{ this.renderGroup([
|
||||||
|
...PreferencesUserSettingsTab.COMPOSER_SETTINGS,
|
||||||
|
...this.getShowLocationIfEnabled(),
|
||||||
|
]) }
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mx_SettingsTab_section">
|
<div className="mx_SettingsTab_section">
|
||||||
|
|
|
@ -892,6 +892,7 @@
|
||||||
"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)",
|
||||||
|
|
|
@ -407,6 +407,12 @@ 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 UIFeatureController(UIFeature.Widgets, 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,
|
||||||
|
|
Loading…
Reference in a new issue