From 2332c2e4f226ad99c276d2223dbf9de3424aad19 Mon Sep 17 00:00:00 2001 From: automated-signal <37887102+automated-signal@users.noreply.github.com> Date: Wed, 16 Oct 2024 13:22:11 -0500 Subject: [PATCH] Allow call links beta Co-authored-by: ayumi-signal <143036029+ayumi-signal@users.noreply.github.com> --- ts/RemoteConfig.ts | 2 ++ ts/util/callLinks.ts | 16 +++++++++++++++- ts/util/isAdhocCallingEnabled.ts | 13 ++++++++++++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/ts/RemoteConfig.ts b/ts/RemoteConfig.ts index 261bf042ab6c..b5e2d8219b25 100644 --- a/ts/RemoteConfig.ts +++ b/ts/RemoteConfig.ts @@ -16,7 +16,9 @@ import { getCountryCode } from './types/PhoneNumber'; export type ConfigKeyType = | 'desktop.calling.adhoc' + | 'desktop.calling.adhoc.beta' | 'desktop.calling.adhoc.create' + | 'desktop.calling.adhoc.create.beta' | 'desktop.calling.ringrtcAdm' | 'desktop.clientExpiration' | 'desktop.backup.credentialFetch' diff --git a/ts/util/callLinks.ts b/ts/util/callLinks.ts index bc90b4026a38..3d58d2e00c6e 100644 --- a/ts/util/callLinks.ts +++ b/ts/util/callLinks.ts @@ -15,6 +15,7 @@ import { type CallHistoryDetails, CallMode, } from '../types/CallDisposition'; +import { isBeta, isProduction } from './version'; export const CALL_LINK_DEFAULT_STATE: Pick< CallLinkType, @@ -43,7 +44,20 @@ export function isCallLinksCreateEnabled(): boolean { if (isTestOrMockEnvironment()) { return true; } - return RemoteConfig.getValue('desktop.calling.adhoc.create') === 'TRUE'; + + const version = window.getVersion(); + + if (isProduction(version)) { + return RemoteConfig.getValue('desktop.calling.adhoc.create') === 'TRUE'; + } + + if (isBeta(version)) { + return ( + RemoteConfig.getValue('desktop.calling.adhoc.create.beta') === 'TRUE' + ); + } + + return true; } export function callLinkToConversation( diff --git a/ts/util/isAdhocCallingEnabled.ts b/ts/util/isAdhocCallingEnabled.ts index 67472a325561..0cdf090fa59d 100644 --- a/ts/util/isAdhocCallingEnabled.ts +++ b/ts/util/isAdhocCallingEnabled.ts @@ -2,7 +2,18 @@ // SPDX-License-Identifier: AGPL-3.0-only import * as RemoteConfig from '../RemoteConfig'; +import { isBeta, isProduction } from './version'; export function isAdhocCallingEnabled(): boolean { - return Boolean(RemoteConfig.isEnabled('desktop.calling.adhoc')); + const version = window.getVersion(); + + if (isProduction(version)) { + return Boolean(RemoteConfig.isEnabled('desktop.calling.adhoc')); + } + + if (isBeta(version)) { + return Boolean(RemoteConfig.isEnabled('desktop.calling.adhoc.beta')); + } + + return true; }