Removes old feature flags

This commit is contained in:
Josh Perez 2021-08-18 21:04:38 -04:00 committed by GitHub
parent 778c8b4220
commit aecb11247f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 80 additions and 100 deletions

View File

@ -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);

View File

@ -3298,11 +3298,9 @@ export async function startApp(): Promise<void> {
): 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(

View File

@ -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<PropsType> = ({
controlsFadeClass
)}
>
{isScreenSharingEnabled() ? (
<CallingButton
buttonType={presentingButtonType}
i18n={i18n}
onClick={togglePresenting}
/>
) : null}
<CallingButton
buttonType={presentingButtonType}
i18n={i18n}
onClick={togglePresenting}
/>
<CallingButton
buttonType={videoButtonType}
i18n={i18n}

View File

@ -120,6 +120,7 @@ const createProps = (): PropsType => ({
isAutoLaunchSupported: true,
isHideMenuBarSupported: true,
isNotificationAttentionSupported: true,
isPhoneNumberSharingSupported: false,
isSyncSupported: true,
isSystemTraySupported: true,

View File

@ -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 = ({
}
/>
</SettingsRow>
<SettingsRow title={i18n('Preferences__who-can--title')}>
<Control
left={i18n('Preferences--see-me')}
right={
<Select
disabled
onChange={noop}
options={[
{
text: i18n('Preferences__who-can--everybody'),
value: PhoneNumberSharingMode.Everybody,
},
{
text: i18n('Preferences__who-can--contacts'),
value: PhoneNumberSharingMode.ContactsOnly,
},
{
text: i18n('Preferences__who-can--nobody'),
value: PhoneNumberSharingMode.Nobody,
},
]}
value={whoCanSeeMe}
/>
}
/>
<Control
left={i18n('Preferences--find-me')}
right={
<Select
disabled
onChange={noop}
options={[
{
text: i18n('Preferences__who-can--everybody'),
value: PhoneNumberDiscoverability.Discoverable,
},
{
text: i18n('Preferences__who-can--nobody'),
value: PhoneNumberDiscoverability.NotDiscoverable,
},
]}
value={whoCanFindMe}
/>
}
/>
<div className="Preferences__padding">
<div className="Preferences__description">
{i18n('Preferences__privacy--description')}
{isPhoneNumberSharingSupported ? (
<SettingsRow title={i18n('Preferences__who-can--title')}>
<Control
left={i18n('Preferences--see-me')}
right={
<Select
disabled
onChange={noop}
options={[
{
text: i18n('Preferences__who-can--everybody'),
value: PhoneNumberSharingMode.Everybody,
},
{
text: i18n('Preferences__who-can--contacts'),
value: PhoneNumberSharingMode.ContactsOnly,
},
{
text: i18n('Preferences__who-can--nobody'),
value: PhoneNumberSharingMode.Nobody,
},
]}
value={whoCanSeeMe}
/>
}
/>
<Control
left={i18n('Preferences--find-me')}
right={
<Select
disabled
onChange={noop}
options={[
{
text: i18n('Preferences__who-can--everybody'),
value: PhoneNumberDiscoverability.Discoverable,
},
{
text: i18n('Preferences__who-can--nobody'),
value: PhoneNumberDiscoverability.NotDiscoverable,
},
]}
value={whoCanFindMe}
/>
}
/>
<div className="Preferences__padding">
<div className="Preferences__description">
{i18n('Preferences__privacy--description')}
</div>
</div>
</div>
</SettingsRow>
</SettingsRow>
) : null}
<SettingsRow title={i18n('Preferences--messaging')}>
<Checkbox
checked={hasReadReceipts}

View File

@ -38,6 +38,7 @@ export class SettingsChannel {
this.installCallback('getAvailableIODevices');
this.installCallback('isPrimary');
this.installCallback('syncRequest');
this.installCallback('isPhoneNumberSharingEnabled');
// Getters only. These are set by the primary device
this.installSetting('blockedCount', { setter: false });

View File

@ -22,7 +22,6 @@ import { getUserUuid, getIntl } from '../selectors/user';
import { getOwn } from '../../util/getOwn';
import { missingCaseError } from '../../util/missingCaseError';
import { isConversationSMSOnly } from '../../util/isConversationSMSOnly';
import { isGroupCallingEnabled } from '../../util/isGroupCallingEnabled';
export type OwnProps = {
id: string;
@ -65,9 +64,6 @@ const getOutgoingCallButtonStyle = (
case CallMode.Direct:
return OutgoingCallButtonStyle.Both;
case CallMode.Group: {
if (!isGroupCallingEnabled()) {
return OutgoingCallButtonStyle.None;
}
const call = getOwn(calling.callsByConversation, conversation.id);
if (
call?.callMode === CallMode.Group &&

View File

@ -27,6 +27,7 @@ import * as universalExpireTimer from './universalExpireTimer';
import { PhoneNumberDiscoverability } from './phoneNumberDiscoverability';
import { PhoneNumberSharingMode } from './phoneNumberSharingMode';
import { assert } from './assert';
import { isPhoneNumberSharingEnabled } from './isPhoneNumberSharingEnabled';
type ThemeType = 'light' | 'dark' | 'system';
type NotificationSettingType = 'message' | 'name' | 'count' | 'off';
@ -81,6 +82,7 @@ export type IPCEventsCallbacksType = {
editCustomColor: (colorId: string, customColor: CustomColorType) => void;
getConversationsWithCustomColor: (x: string) => Array<ConversationType>;
installStickerPack: (packId: string, key: string) => Promise<void>;
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<void>((resolve, reject) => {

View File

@ -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())
);
}

View File

@ -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'));
}

View File

@ -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))
);
}

1
ts/window.d.ts vendored
View File

@ -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;

View File

@ -46,6 +46,7 @@ installSetting('callSystemNotification');
installSetting('deviceName');
installSetting('hideMenuBar');
installSetting('incomingCallNotification');
installCallback('isPhoneNumberSharingEnabled');
installCallback('isPrimary');
installCallback('syncRequest');
installSetting('notificationDrawAttention');

View File

@ -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()),