From 457c1d011abc8028a5ddb0e47fcbe9ee29418080 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 28 Apr 2023 08:46:33 +0100 Subject: [PATCH] Add UIFeature.locationSharing to hide location sharing (#10727) * Add UIFeature.locationSharing to hide location sharing * Iterate --- src/components/views/rooms/MessageComposer.tsx | 5 ++++- src/settings/Settings.tsx | 4 ++++ src/settings/UIFeature.ts | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/views/rooms/MessageComposer.tsx b/src/components/views/rooms/MessageComposer.tsx index bf5f6b42bb7..c7d824c9163 100644 --- a/src/components/views/rooms/MessageComposer.tsx +++ b/src/components/views/rooms/MessageComposer.tsx @@ -60,6 +60,7 @@ import { setUpVoiceBroadcastPreRecording } from "../../../voice-broadcast/utils/ import { SdkContextClass } from "../../../contexts/SDKContext"; import { VoiceBroadcastInfoState } from "../../../voice-broadcast"; import { createCantStartVoiceMessageBroadcastDialog } from "../dialogs/CantStartVoiceMessageBroadcastDialog"; +import { UIFeature } from "../../../settings/UIFeature"; let instanceCount = 0; @@ -614,7 +615,9 @@ export class MessageComposer extends React.Component { relation={this.props.relation} onRecordStartEndClick={this.onRecordStartEndClick} setStickerPickerOpen={this.setStickerPickerOpen} - showLocationButton={!window.electron} + showLocationButton={ + !window.electron && SettingsStore.getValue(UIFeature.LocationSharing) + } showPollsButton={this.state.showPollsButton} showStickersButton={this.showStickersButton} isRichTextEnabled={this.state.isRichTextEnabled} diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx index 5c78f30134a..641afe0e1b7 100644 --- a/src/settings/Settings.tsx +++ b/src/settings/Settings.tsx @@ -1089,6 +1089,10 @@ export const SETTINGS: { [setting: string]: ISetting } = { supportedLevels: LEVELS_UI_FEATURE, default: true, }, + [UIFeature.LocationSharing]: { + supportedLevels: LEVELS_UI_FEATURE, + default: true, + }, [UIFeature.Voip]: { supportedLevels: LEVELS_UI_FEATURE, default: true, diff --git a/src/settings/UIFeature.ts b/src/settings/UIFeature.ts index e131293ce7a..b9e290ffeca 100644 --- a/src/settings/UIFeature.ts +++ b/src/settings/UIFeature.ts @@ -15,10 +15,11 @@ limitations under the License. */ // see settings.md for documentation on conventions -export enum UIFeature { +export const enum UIFeature { AdvancedEncryption = "UIFeature.advancedEncryption", URLPreviews = "UIFeature.urlPreviews", Widgets = "UIFeature.widgets", + LocationSharing = "UIFeature.locationSharing", Voip = "UIFeature.voip", Feedback = "UIFeature.feedback", Registration = "UIFeature.registration",