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

Commit

Permalink
Enable/disable location share button when setting is changed (#7545)
Browse files Browse the repository at this point in the history
  • Loading branch information
andybalaam authored Jan 14, 2022
1 parent aa4131e commit ae2cb63
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/components/views/rooms/MessageComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ interface IState {
showStickers: boolean;
showStickersButton: boolean;
showPollsButton: boolean;
showLocationButton: boolean;
}

@replaceableComponent("views.rooms.MessageComposer")
Expand Down Expand Up @@ -285,12 +286,14 @@ 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"),
};

this.instanceId = instanceCount++;

SettingsStore.monitorSetting("MessageComposerInput.showStickersButton", null);
SettingsStore.monitorSetting("feature_polls", null);
SettingsStore.monitorSetting("feature_location_share", null);
}

componentDidMount() {
Expand Down Expand Up @@ -344,6 +347,15 @@ export default class MessageComposer extends React.Component<IProps, IState> {
}
break;
}

case "feature_location_share": {
const showLocationButton = SettingsStore.getValue(
"feature_location_share");
if (this.state.showLocationButton !== showLocationButton) {
this.setState({ showLocationButton });
}
break;
}
}
}
}
Expand Down

0 comments on commit ae2cb63

Please sign in to comment.