From aecb11247f0d28e7340bd453219297cb704a3b7d Mon Sep 17 00:00:00 2001 From: Josh Perez <60019601+josh-signal@users.noreply.github.com> Date: Wed, 18 Aug 2021 21:04:38 -0400 Subject: [PATCH] Removes old feature flags --- preload.js | 2 - ts/background.ts | 8 +- ts/components/CallScreen.tsx | 13 ++-- ts/components/Preferences.stories.tsx | 1 + ts/components/Preferences.tsx | 104 +++++++++++++------------ ts/main/settingsChannel.ts | 1 + ts/state/smart/ConversationHeader.tsx | 4 - ts/util/createIPCEvents.ts | 3 + ts/util/isGroupCallingEnabled.ts | 13 ---- ts/util/isPhoneNumberSharingEnabled.ts | 8 ++ ts/util/isScreenSharingEnabled.ts | 17 ---- ts/window.d.ts | 1 - ts/windows/preload.ts | 1 + ts/windows/settings/preload.ts | 4 + 14 files changed, 80 insertions(+), 100 deletions(-) delete mode 100644 ts/util/isGroupCallingEnabled.ts create mode 100644 ts/util/isPhoneNumberSharingEnabled.ts delete mode 100644 ts/util/isScreenSharingEnabled.ts diff --git a/preload.js b/preload.js index 8413eb2b3..cf631655c 100644 --- a/preload.js +++ b/preload.js @@ -369,7 +369,6 @@ try { }, 1000); const { imageToBlurHash } = require('./ts/util/imageToBlurHash'); - const { isGroupCallingEnabled } = require('./ts/util/isGroupCallingEnabled'); const { isValidGuid } = require('./ts/util/isValidGuid'); const { ActiveWindowService } = require('./ts/services/ActiveWindowService'); @@ -379,7 +378,6 @@ try { window.libphonenumber.PhoneNumberFormat = require('google-libphonenumber').PhoneNumberFormat; window.loadImage = require('blueimp-load-image'); window.getGuid = require('uuid/v4'); - window.isGroupCallingEnabled = isGroupCallingEnabled; const activeWindowService = new ActiveWindowService(); activeWindowService.initialize(window.document, ipc); diff --git a/ts/background.ts b/ts/background.ts index 5373f5a93..7ac3c7d54 100644 --- a/ts/background.ts +++ b/ts/background.ts @@ -3298,11 +3298,9 @@ export async function startApp(): Promise { ): boolean { if (message.groupCallUpdate) { if (message.groupV2 && messageDescriptor.type === Message.GROUP) { - if (window.isGroupCallingEnabled()) { - window.reduxActions.calling.peekNotConnectedGroupCall({ - conversationId: messageDescriptor.id, - }); - } + window.reduxActions.calling.peekNotConnectedGroupCall({ + conversationId: messageDescriptor.id, + }); return true; } window.log.warn( diff --git a/ts/components/CallScreen.tsx b/ts/components/CallScreen.tsx index deff1d2f8..52860df7a 100644 --- a/ts/components/CallScreen.tsx +++ b/ts/components/CallScreen.tsx @@ -30,7 +30,6 @@ import { DirectCallRemoteParticipant } from './DirectCallRemoteParticipant'; import { GroupCallRemoteParticipants } from './GroupCallRemoteParticipants'; import { LocalizerType } from '../types/Util'; import { NeedsScreenRecordingPermissionsModal } from './NeedsScreenRecordingPermissionsModal'; -import { isScreenSharingEnabled } from '../util/isScreenSharingEnabled'; import { missingCaseError } from '../util/missingCaseError'; import { useActivateSpeakerViewOnPresenting } from '../hooks/useActivateSpeakerViewOnPresenting'; @@ -372,13 +371,11 @@ export const CallScreen: React.FC = ({ controlsFadeClass )} > - {isScreenSharingEnabled() ? ( - - ) : null} + ({ isAutoLaunchSupported: true, isHideMenuBarSupported: true, isNotificationAttentionSupported: true, + isPhoneNumberSharingSupported: false, isSyncSupported: true, isSystemTraySupported: true, diff --git a/ts/components/Preferences.tsx b/ts/components/Preferences.tsx index 8fec053e2..fba133f2e 100644 --- a/ts/components/Preferences.tsx +++ b/ts/components/Preferences.tsx @@ -98,6 +98,7 @@ export type PropsType = { isAutoLaunchSupported: boolean; isHideMenuBarSupported: boolean; isNotificationAttentionSupported: boolean; + isPhoneNumberSharingSupported: boolean; isSyncSupported: boolean; isSystemTraySupported: boolean; @@ -182,6 +183,7 @@ export const Preferences = ({ isAudioNotificationsSupported, isAutoLaunchSupported, isHideMenuBarSupported, + isPhoneNumberSharingSupported, isNotificationAttentionSupported, isSyncSupported, isSystemTraySupported, @@ -748,57 +750,59 @@ export const Preferences = ({ } /> - - - } - /> - - } - /> -
-
- {i18n('Preferences__privacy--description')} + {isPhoneNumberSharingSupported ? ( + + + } + /> + + } + /> +
+
+ {i18n('Preferences__privacy--description')} +
-
- + + ) : null} void; getConversationsWithCustomColor: (x: string) => Array; installStickerPack: (packId: string, key: string) => Promise; + isPhoneNumberSharingEnabled: () => boolean; isPrimary: () => boolean; removeCustomColor: (x: string) => void; removeCustomColorOnConversations: (x: string) => void; @@ -321,6 +323,7 @@ export function createIPCEvents( window.setAutoLaunch(value); }, + isPhoneNumberSharingEnabled: () => isPhoneNumberSharingEnabled(), isPrimary: () => window.textsecure.storage.user.getDeviceId() === 1, syncRequest: () => new Promise((resolve, reject) => { diff --git a/ts/util/isGroupCallingEnabled.ts b/ts/util/isGroupCallingEnabled.ts deleted file mode 100644 index 831d9a6e3..000000000 --- a/ts/util/isGroupCallingEnabled.ts +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2020 Signal Messenger, LLC -// SPDX-License-Identifier: AGPL-3.0-only - -import { isProduction } from './version'; -import * as RemoteConfig from '../RemoteConfig'; - -// We can remove this function once group calling has been turned on for everyone. -export function isGroupCallingEnabled(): boolean { - return ( - RemoteConfig.isEnabled('desktop.groupCalling') || - !isProduction(window.getVersion()) - ); -} diff --git a/ts/util/isPhoneNumberSharingEnabled.ts b/ts/util/isPhoneNumberSharingEnabled.ts new file mode 100644 index 000000000..4e064f941 --- /dev/null +++ b/ts/util/isPhoneNumberSharingEnabled.ts @@ -0,0 +1,8 @@ +// Copyright 2021 Signal Messenger, LLC +// SPDX-License-Identifier: AGPL-3.0-only + +import * as RemoteConfig from '../RemoteConfig'; + +export function isPhoneNumberSharingEnabled(): boolean { + return Boolean(RemoteConfig.isEnabled('desktop.internalUser')); +} diff --git a/ts/util/isScreenSharingEnabled.ts b/ts/util/isScreenSharingEnabled.ts deleted file mode 100644 index a32e2c031..000000000 --- a/ts/util/isScreenSharingEnabled.ts +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2021 Signal Messenger, LLC -// SPDX-License-Identifier: AGPL-3.0-only - -import * as RemoteConfig from '../RemoteConfig'; -import { isProduction } from './version'; - -// We can remove this function once screen sharing has been turned on for everyone -export function isScreenSharingEnabled(): boolean { - // `window.getVersion` is missing in Storybook. - const version = window.getVersion?.(); - - return Boolean( - RemoteConfig.isEnabled('desktop.internalUser') || - RemoteConfig.isEnabled('desktop.screensharing2') || - (version && !isProduction(version)) - ); -} diff --git a/ts/window.d.ts b/ts/window.d.ts index 42697eea0..81f3e7da1 100644 --- a/ts/window.d.ts +++ b/ts/window.d.ts @@ -511,7 +511,6 @@ declare global { isShowingModal?: boolean; // Feature Flags - isGroupCallingEnabled: () => boolean; GV2_ENABLE_SINGLE_CHANGE_PROCESSING: boolean; GV2_ENABLE_CHANGE_PROCESSING: boolean; GV2_ENABLE_STATE_PROCESSING: boolean; diff --git a/ts/windows/preload.ts b/ts/windows/preload.ts index 92268809d..42a717644 100644 --- a/ts/windows/preload.ts +++ b/ts/windows/preload.ts @@ -46,6 +46,7 @@ installSetting('callSystemNotification'); installSetting('deviceName'); installSetting('hideMenuBar'); installSetting('incomingCallNotification'); +installCallback('isPhoneNumberSharingEnabled'); installCallback('isPrimary'); installCallback('syncRequest'); installSetting('notificationDrawAttention'); diff --git a/ts/windows/settings/preload.ts b/ts/windows/settings/preload.ts index 499be8e5b..c74f0db9b 100644 --- a/ts/windows/settings/preload.ts +++ b/ts/windows/settings/preload.ts @@ -102,6 +102,7 @@ const ipcGetAvailableIODevices = createCallback('getAvailableIODevices'); const ipcGetCustomColors = createCallback('getCustomColors'); const ipcIsSyncNotSupported = createCallback('isPrimary'); const ipcMakeSyncRequest = createCallback('syncRequest'); +const ipcPNP = createCallback('isPhoneNumberSharingEnabled'); // ChatColorPicker redux hookups // The redux actions update over IPC through a preferences re-render @@ -179,6 +180,7 @@ async function renderPreferences() { hasRelayCalls, hasSpellCheck, hasTypingIndicators, + isPhoneNumberSharingSupported, lastSyncTime, notificationContent, selectedCamera, @@ -213,6 +215,7 @@ async function renderPreferences() { hasRelayCalls: settingRelayCalls.getValue(), hasSpellCheck: settingSpellCheck.getValue(), hasTypingIndicators: settingTypingIndicators.getValue(), + isPhoneNumberSharingSupported: ipcPNP(), lastSyncTime: settingLastSyncTime.getValue(), notificationContent: settingNotificationSetting.getValue(), selectedCamera: settingVideoInput.getValue(), @@ -301,6 +304,7 @@ async function renderPreferences() { isAutoLaunchSupported: Settings.isAutoLaunchSupported(), isHideMenuBarSupported: Settings.isHideMenuBarSupported(), isNotificationAttentionSupported: Settings.isDrawAttentionSupported(), + isPhoneNumberSharingSupported, isSyncSupported: !isSyncNotSupported, isSystemTraySupported: Settings.isSystemTraySupported(window.getVersion()),