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
|
@ -1,6 +0,0 @@
|
|||
// Copyright 2020 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
const semver = require('semver');
|
||||
|
||||
exports.isBeta = version => semver.parse(version).prerelease[0] === 'beta';
|
2
main.js
2
main.js
|
@ -18,7 +18,6 @@ const electron = require('electron');
|
|||
|
||||
const packageJson = require('./package.json');
|
||||
const GlobalErrors = require('./app/global_errors');
|
||||
const { isBeta } = require('./app/version');
|
||||
const { setup: setupSpellChecker } = require('./app/spell_check');
|
||||
|
||||
GlobalErrors.addHandler();
|
||||
|
@ -98,6 +97,7 @@ const {
|
|||
installWebHandler,
|
||||
} = require('./app/protocol_filter');
|
||||
const { installPermissionsHandler } = require('./app/permissions');
|
||||
const { isBeta } = require('./ts/util/version');
|
||||
const { isSgnlHref, parseSgnlHref } = require('./ts/util/sgnlHref');
|
||||
|
||||
let appStartInitialSpellcheckSetting = true;
|
||||
|
|
|
@ -382,6 +382,7 @@ try {
|
|||
|
||||
const { autoOrientImage } = require('./js/modules/auto_orient_image');
|
||||
const { imageToBlurHash } = require('./ts/util/imageToBlurHash');
|
||||
const { isGroupCallingEnabled } = require('./ts/util/isGroupCallingEnabled');
|
||||
|
||||
window.autoOrientImage = autoOrientImage;
|
||||
window.dataURLToBlobSync = require('blueimp-canvas-to-blob');
|
||||
|
@ -392,6 +393,7 @@ try {
|
|||
window.libphonenumber.PhoneNumberFormat = require('google-libphonenumber').PhoneNumberFormat;
|
||||
window.loadImage = require('blueimp-load-image');
|
||||
window.getGuid = require('uuid/v4');
|
||||
window.isGroupCallingEnabled = isGroupCallingEnabled;
|
||||
|
||||
window.isValidGuid = maybeGuid =>
|
||||
/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i.test(
|
||||
|
@ -428,7 +430,6 @@ try {
|
|||
const Signal = require('./js/modules/signal');
|
||||
const i18n = require('./js/modules/i18n');
|
||||
const Attachments = require('./app/attachments');
|
||||
const { isBeta } = require('./app/version');
|
||||
|
||||
const { locale } = config;
|
||||
window.i18n = i18n.setup(locale, localeMessages);
|
||||
|
@ -587,8 +588,6 @@ try {
|
|||
};
|
||||
/* eslint-enable global-require, import/no-extraneous-dependencies */
|
||||
}
|
||||
|
||||
window.GROUP_CALLING = isBeta(config.version);
|
||||
} catch (error) {
|
||||
/* eslint-disable no-console */
|
||||
if (console._log) {
|
||||
|
|
|
@ -7,7 +7,7 @@ const fs = require('fs');
|
|||
const _ = require('lodash');
|
||||
|
||||
const packageJson = require('./package.json');
|
||||
const { isBeta } = require('./app/version');
|
||||
const { isBeta } = require('./ts/util/version');
|
||||
|
||||
const { version } = packageJson;
|
||||
|
||||
|
|
|
@ -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…
Reference in a new issue