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

@ -16,6 +16,7 @@ import { reducer } from './reducer';
import { dispatchItemsMiddleware } from '../shims/dispatchItemsMiddleware';
import { isOlderThan } from '../util/timestamp';
import { SECOND } from '../util/durations';
import { getEnvironment } from '../environment';
declare global {
// We want to extend `window`'s properties, so we need an interface.
@ -25,7 +26,7 @@ declare global {
}
}
const env = window.getEnvironment();
const env = getEnvironment();
// So Redux logging doesn't go to disk, and so we can get colors/styles
const directConsole = {

View file

@ -7,6 +7,7 @@ import type { StateType as RootStateType } from '../reducer';
import type { BoundActionCreatorsMapObject } from '../../hooks/useBoundActions';
import { useBoundActions } from '../../hooks/useBoundActions';
import * as log from '../../logging/log';
import { getEnvironment, Environment } from '../../environment';
import {
START_INSTALLER,
type StartInstallerActionType,
@ -90,7 +91,7 @@ function openStandalone(): ThunkAction<
OpenStandaloneActionType
> {
return dispatch => {
if (window.getEnvironment() === 'production') {
if (getEnvironment() === Environment.PackagedApp) {
return;
}

View file

@ -61,7 +61,7 @@ export const hasExpired = createSelector(
getAutoDownloadUpdate,
(_: StateType, { now = Date.now() }: HasExpiredOptionsType = {}) => now,
(buildExpiration: number, autoDownloadUpdate: boolean, now: number) => {
if (getEnvironment() !== Environment.Production && buildExpiration === 0) {
if (getEnvironment() !== Environment.PackagedApp && buildExpiration === 0) {
return false;
}

View file

@ -14,6 +14,7 @@ import { TargetedMessageSource } from '../ducks/conversationsEnums';
import { useConversationsActions } from '../ducks/conversations';
import { useToastActions } from '../ducks/toast';
import { strictAssert } from '../../util/assert';
import { isStagingServer } from '../../util/isStagingServer';
import { ToastType } from '../../types/Toast';
import { getNavTabsCollapsed } from '../selectors/items';
import { useItemsActions } from '../ducks/items';
@ -146,6 +147,7 @@ export const SmartChatsTab = memo(function SmartChatsTab() {
<ChatsTab
otherTabsUnreadStats={otherTabsUnreadStats}
i18n={i18n}
isStaging={isStagingServer()}
hasFailedStorySends={hasFailedStorySends}
hasPendingUpdate={hasPendingUpdate}
navTabsCollapsed={navTabsCollapsed}

View file

@ -17,6 +17,7 @@ import { WidthBreakpoint } from '../../components/_util';
import { InstallScreenStep } from '../../types/InstallScreen';
import OS from '../../util/os/osMain';
import { fileToBytes } from '../../util/fileToBytes';
import { isStagingServer } from '../../util/isStagingServer';
import * as log from '../../logging/log';
import { SmartToastManager } from './ToastManager';
@ -70,6 +71,7 @@ export const SmartInstallScreen = memo(function SmartInstallScreen() {
startUpdate,
retryGetQrCode: startInstaller,
OS: OS.getName(),
isStaging: isStagingServer(),
},
};
break;