From 6313b05da75ceb1528b7f7639d4d294fc6e48dc5 Mon Sep 17 00:00:00 2001 From: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com> Date: Wed, 1 Dec 2021 16:41:25 -0600 Subject: [PATCH] Add "can resize left pane" feature flags --- ts/RemoteConfig.ts | 2 ++ ts/state/smart/LeftPane.tsx | 14 +++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ts/RemoteConfig.ts b/ts/RemoteConfig.ts index 183cb30ee..5a6ce4b83 100644 --- a/ts/RemoteConfig.ts +++ b/ts/RemoteConfig.ts @@ -9,6 +9,8 @@ import * as log from './logging/log'; export type ConfigKeyType = | 'desktop.announcementGroup' | 'desktop.calling.useWindowsAdm2' + | 'desktop.canResizeLeftPane.beta' + | 'desktop.canResizeLeftPane.production' | 'desktop.clientExpiration' | 'desktop.disableGV1' | 'desktop.groupCallOutboundRing' diff --git a/ts/state/smart/LeftPane.tsx b/ts/state/smart/LeftPane.tsx index ca7753870..986bb4093 100644 --- a/ts/state/smart/LeftPane.tsx +++ b/ts/state/smart/LeftPane.tsx @@ -9,6 +9,7 @@ import type { PropsType as LeftPanePropsType } from '../../components/LeftPane'; import { LeftPane, LeftPaneMode } from '../../components/LeftPane'; import type { StateType } from '../reducer'; import { missingCaseError } from '../../util/missingCaseError'; +import { isAlpha, isBeta } from '../../util/version'; import { ComposerStep, OneTimeModalState } from '../ducks/conversationsEnums'; import { @@ -163,12 +164,19 @@ const getModeSpecificProps = ( } }; +const canResizeLeftPane = () => + window.Signal.RemoteConfig.isEnabled('desktop.internalUser') || + isAlpha(window.getVersion()) || + isBeta(window.getVersion()) + ? window.Signal.RemoteConfig.isEnabled('desktop.canResizeLeftPane.beta') + : window.Signal.RemoteConfig.isEnabled( + 'desktop.canResizeLeftPane.production' + ); + const mapStateToProps = (state: StateType) => { return { modeSpecificProps: getModeSpecificProps(state), - canResizeLeftPane: window.Signal.RemoteConfig.isEnabled( - 'desktop.internalUser' - ), + canResizeLeftPane: canResizeLeftPane(), preferredWidthFromStorage: getPreferredLeftPaneWidth(state), selectedConversationId: getSelectedConversationId(state), selectedMessageId: getSelectedMessage(state)?.id,