Introduce isStagingServer util method

This commit is contained in:
Fedor Indutny 2024-09-04 11:12:45 -07:00 committed by GitHub
parent 4cdb6fab08
commit cd44a7a033
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 80 additions and 71 deletions

View file

@ -2,7 +2,6 @@
// SPDX-License-Identifier: AGPL-3.0-only
import React from 'react';
import { Environment, getEnvironment } from '../environment';
import type { LocalizerType } from '../types/I18N';
import type { NavTabPanelProps } from './NavTabs';
import { WhatsNewLink } from './WhatsNewLink';
@ -11,6 +10,7 @@ import type { UnreadStats } from '../util/countUnreadStats';
type ChatsTabProps = Readonly<{
otherTabsUnreadStats: UnreadStats;
i18n: LocalizerType;
isStaging: boolean;
hasPendingUpdate: boolean;
hasFailedStorySends: boolean;
navTabsCollapsed: boolean;
@ -25,6 +25,7 @@ type ChatsTabProps = Readonly<{
export function ChatsTab({
otherTabsUnreadStats,
i18n,
isStaging,
hasPendingUpdate,
hasFailedStorySends,
navTabsCollapsed,
@ -60,9 +61,9 @@ export function ChatsTab({
{renderMiniPlayer({ shouldFlow: false })}
<div className="module-splash-screen__logo module-img--80 module-logo-blue" />
<h3 className="Inbox__welcome">
{getEnvironment() !== Environment.Staging
? i18n('icu:welcomeToSignal')
: 'THIS IS A STAGING DESKTOP'}
{isStaging
? 'THIS IS A STAGING DESKTOP'
: i18n('icu:welcomeToSignal')}
</h3>
<p className="Inbox__whatsnew">
<WhatsNewLink i18n={i18n} showWhatsNewModal={showWhatsNewModal} />

View file

@ -34,7 +34,7 @@ export function QrCode(props: PropsType): ReactElement {
// simulator primary, which has a debug-only option to paste the linking URL instead of
// scanning it. (By the time you read this comment Android may have a similar feature.)
const onDoubleClick = () => {
if (getEnvironment() === Environment.Production) {
if (getEnvironment() === Environment.PackagedApp) {
return;
}
if (data instanceof Uint8Array) {

View file

@ -42,7 +42,7 @@ export function InstallScreenChoosingDeviceNameStep({
normalizedName.length <= MAX_DEVICE_NAME_LENGTH;
let maybeBackupInput: JSX.Element | undefined;
if (getEnvironment() !== Environment.Production) {
if (getEnvironment() !== Environment.PackagedApp) {
maybeBackupInput = (
<label className="module-InstallScreenChoosingDeviceNameStep__input">
{/* Since this is only for testing - we don't require translation */}

View file

@ -58,6 +58,7 @@ function Simulation({
return (
<InstallScreenQrCodeNotScannedStep
i18n={i18n}
isStaging={false}
provisioningUrl={provisioningUrl}
updates={DEFAULT_UPDATES}
OS="macOS"
@ -72,6 +73,7 @@ export function QrCodeLoading(): JSX.Element {
return (
<InstallScreenQrCodeNotScannedStep
i18n={i18n}
isStaging={false}
provisioningUrl={{
loadingState: LoadingState.Loading,
}}
@ -88,6 +90,7 @@ export function QrCodeFailedToLoad(): JSX.Element {
return (
<InstallScreenQrCodeNotScannedStep
i18n={i18n}
isStaging={false}
provisioningUrl={{
loadingState: LoadingState.LoadFailed,
error: InstallScreenQRCodeError.Unknown,
@ -105,6 +108,7 @@ export function QrCodeLoaded(): JSX.Element {
return (
<InstallScreenQrCodeNotScannedStep
i18n={i18n}
isStaging={false}
provisioningUrl={LOADED_URL}
updates={DEFAULT_UPDATES}
OS="macOS"
@ -164,6 +168,7 @@ export const WithUpdateKnobs: StoryFn<PropsType & { dialogType: DialogType }> =
return (
<InstallScreenQrCodeNotScannedStep
i18n={i18n}
isStaging={false}
provisioningUrl={LOADED_URL}
hasExpired
updates={{

View file

@ -19,7 +19,6 @@ import { InstallScreenSignalLogo } from './InstallScreenSignalLogo';
import { InstallScreenUpdateDialog } from './InstallScreenUpdateDialog';
import { getClassNamesFor } from '../../util/getClassNamesFor';
import type { UpdatesStateType } from '../../state/ducks/updates';
import { Environment, getEnvironment } from '../../environment';
// We can't always use destructuring assignment because of the complexity of this props
// type.
@ -31,6 +30,7 @@ export type PropsType = Readonly<{
updates: UpdatesStateType;
currentVersion: string;
OS: string;
isStaging: boolean;
retryGetQrCode: () => void;
startUpdate: () => void;
}>;
@ -46,6 +46,7 @@ export function InstallScreenQrCodeNotScannedStep({
currentVersion,
hasExpired,
i18n,
isStaging,
OS,
provisioningUrl,
retryGetQrCode,
@ -102,12 +103,12 @@ export function InstallScreenQrCodeNotScannedStep({
/>
</li>
</ol>
{getEnvironment() !== Environment.Staging ? (
{isStaging ? (
'THIS IS A STAGING DESKTOP'
) : (
<a target="_blank" rel="noreferrer" href={SUPPORT_PAGE}>
{i18n('icu:Install__support-link')}
</a>
) : (
'THIS IS A STAGING DESKTOP'
)}
</div>
</div>