signal-desktop/ts/badges/shouldShowBadges.ts

26 lines
729 B
TypeScript
Raw Normal View History

2021-11-09 15:51:56 +00:00
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { isEnabled } from '../RemoteConfig';
import { getEnvironment, Environment } from '../environment';
import { isBeta } from '../util/version';
2021-11-09 15:51:56 +00:00
export function shouldShowBadges(): boolean {
if (
2021-11-09 15:51:56 +00:00
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;
2021-11-09 15:51:56 +00:00
}