Put group calling behind a remote feature flag

This commit is contained in:
Evan Hahn 2020-12-07 14:35:14 -06:00 committed by GitHub
parent 23fed9ce63
commit a2f285d243
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 51 additions and 14 deletions

View file

@ -8,6 +8,7 @@ type ConfigKeyType =
| 'desktop.cds'
| 'desktop.clientExpiration'
| 'desktop.disableGV1'
| 'desktop.groupCalling'
| 'desktop.gv2'
| 'desktop.mandatoryProfileSharing'
| 'desktop.messageRequests'

View file

@ -2658,7 +2658,7 @@ type WhatIsThis = import('./window.d').WhatIsThis;
if (data.message.groupCallUpdate) {
if (data.message.groupV2 && messageDescriptor.type === Message.GROUP) {
if (window.GROUP_CALLING) {
if (window.isGroupCallingEnabled()) {
window.reduxActions.calling.peekNotConnectedGroupCall({
conversationId: messageDescriptor.id,
});

View file

@ -18,6 +18,7 @@ import { getActiveCall, isAnybodyElseInGroupCall } from '../ducks/calling';
import { getUserConversationId, getIntl } from '../selectors/user';
import { getOwn } from '../../util/getOwn';
import { missingCaseError } from '../../util/missingCaseError';
import { isGroupCallingEnabled } from '../../util/isGroupCallingEnabled';
export interface OwnProps {
id: string;
@ -57,7 +58,7 @@ const getOutgoingCallButtonStyle = (
case CallMode.Direct:
return OutgoingCallButtonStyle.Both;
case CallMode.Group: {
if (!window.GROUP_CALLING) {
if (!isGroupCallingEnabled()) {
return OutgoingCallButtonStyle.None;
}
const call = getOwn(calling.callsByConversation, conversation.id);

View file

@ -0,0 +1,22 @@
// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { isBeta } from '../../util/version';
describe('version utilities', () => {
describe('isBeta', () => {
it('returns false for non-beta version strings', () => {
assert.isFalse(isBeta('1.2.3'));
assert.isFalse(isBeta('1.2.3-alpha'));
assert.isFalse(isBeta('1.2.3-alpha.1'));
assert.isFalse(isBeta('1.2.3-rc.1'));
});
it('returns true for beta version strings', () => {
assert.isTrue(isBeta('1.2.3-beta'));
assert.isTrue(isBeta('1.2.3-beta.1'));
});
});
});

View file

@ -0,0 +1,13 @@
// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { isBeta } 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') ||
isBeta(window.getVersion())
);
}

7
ts/util/version.ts Normal file
View file

@ -0,0 +1,7 @@
// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import * as semver from 'semver';
export const isBeta = (version: string): boolean =>
semver.parse(version)?.prerelease[0] === 'beta';

2
ts/window.d.ts vendored
View file

@ -486,7 +486,7 @@ declare global {
readyForUpdates: () => void;
// Flags
GROUP_CALLING: boolean;
isGroupCallingEnabled: () => boolean;
}
interface Error {