// Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import type { ReactElement, ReactNode } from 'react'; import React from 'react'; import classNames from 'classnames'; import type { LocalizerType } from '../../types/Util'; import { missingCaseError } from '../../util/missingCaseError'; import type { Loadable } from '../../util/loadable'; import { LoadingState } from '../../util/loadable'; import { Intl } from '../Intl'; import { Spinner } from '../Spinner'; import { QrCode } from '../QrCode'; import { TitlebarDragArea } from '../TitlebarDragArea'; 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. export type PropsType = Readonly<{ i18n: LocalizerType; provisioningUrl: Loadable; hasExpired?: boolean; updates: UpdatesStateType; currentVersion: string; OS: string; retryGetQrCode: () => void; startUpdate: () => void; }>; const getQrCodeClassName = getClassNamesFor( 'module-InstallScreenQrCodeNotScannedStep__qr-code' ); export function InstallScreenQrCodeNotScannedStep({ currentVersion, hasExpired, i18n, OS, provisioningUrl, retryGetQrCode, startUpdate, updates, }: Readonly): ReactElement { return (
{hasExpired && ( )}

{i18n('icu:Install__scan-this-code')}

  1. {i18n('icu:Install__instructions__1')}
  2. {i18n('icu:Install__instructions__2__settings')} ), linkedDevices: {i18n('icu:linkedDevices')}, }} />
  3. ), linkNewDevice: {i18n('icu:linkNewDevice')}, }} />
{getEnvironment() !== Environment.Staging ? ( {i18n('icu:Install__support-link')} ) : ( 'THIS IS A STAGING DESKTOP' )}
); } function InstallScreenQrCode( props: Loadable & { i18n: LocalizerType; retryGetQrCode: () => void } ): ReactElement { const { i18n } = props; let contents: ReactNode; switch (props.loadingState) { case LoadingState.Loading: contents = ; break; case LoadingState.LoadFailed: contents = ( ( ), }} /> ); break; case LoadingState.Loaded: contents = ( ); break; default: throw missingCaseError(props); } return (
{contents}
); }