diff --git a/ts/RemoteConfig.ts b/ts/RemoteConfig.ts index a2e037767..087829f90 100644 --- a/ts/RemoteConfig.ts +++ b/ts/RemoteConfig.ts @@ -25,6 +25,7 @@ export type ConfigKeyType = | 'desktop.senderKey.retry' | 'desktop.sendSenderKey3' | 'desktop.showUserBadges' + | 'desktop.showUserBadges.beta' | 'desktop.storage' | 'desktop.storageWrite3' | 'desktop.usernames' diff --git a/ts/badges/shouldShowBadges.ts b/ts/badges/shouldShowBadges.ts index 2c2112647..912ce88f8 100644 --- a/ts/badges/shouldShowBadges.ts +++ b/ts/badges/shouldShowBadges.ts @@ -3,14 +3,23 @@ import { isEnabled } from '../RemoteConfig'; import { getEnvironment, Environment } from '../environment'; +import { isBeta } from '../util/version'; export function shouldShowBadges(): boolean { - return ( + if ( isEnabled('desktop.showUserBadges') || isEnabled('desktop.internalUser') || getEnvironment() === Environment.Staging || getEnvironment() === Environment.Development || // eslint-disable-next-line @typescript-eslint/no-explicit-any Boolean((window as any).STORYBOOK_ENV) - ); + ) { + return true; + } + + if (isEnabled('desktop.showUserBadges.beta') && isBeta(window.getVersion())) { + return true; + } + + return false; }