Put group calling behind a remote feature flag
This commit is contained in:
parent
23fed9ce63
commit
a2f285d243
11 changed files with 51 additions and 14 deletions
|
@ -8,6 +8,7 @@ type ConfigKeyType =
|
|||
| 'desktop.cds'
|
||||
| 'desktop.clientExpiration'
|
||||
| 'desktop.disableGV1'
|
||||
| 'desktop.groupCalling'
|
||||
| 'desktop.gv2'
|
||||
| 'desktop.mandatoryProfileSharing'
|
||||
| 'desktop.messageRequests'
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
|
|
22
ts/test-both/util/version_test.ts
Normal file
22
ts/test-both/util/version_test.ts
Normal 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'));
|
||||
});
|
||||
});
|
||||
});
|
13
ts/util/isGroupCallingEnabled.ts
Normal file
13
ts/util/isGroupCallingEnabled.ts
Normal 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
7
ts/util/version.ts
Normal 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
2
ts/window.d.ts
vendored
|
@ -486,7 +486,7 @@ declare global {
|
|||
readyForUpdates: () => void;
|
||||
|
||||
// Flags
|
||||
GROUP_CALLING: boolean;
|
||||
isGroupCallingEnabled: () => boolean;
|
||||
}
|
||||
|
||||
interface Error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue