Update local backups availability during rollout

This commit is contained in:
trevor-signal
2026-03-23 17:47:38 -04:00
committed by GitHub
parent f88b6fc293
commit 8ad63966ae
5 changed files with 48 additions and 16 deletions

View File

@@ -271,7 +271,7 @@ import { MessageModel } from './models/messages.preload.js';
import { waitForEvent } from './shims/events.dom.js';
import { sendSyncRequests } from './textsecure/syncRequests.preload.js';
import { handleServerAlerts } from './util/handleServerAlerts.preload.js';
import { isLocalBackupsEnabled } from './util/isLocalBackupsEnabled.dom.js';
import { isLocalBackupsEnabled } from './util/isLocalBackupsEnabled.preload.js';
import { NavTab, SettingsPage, ProfileEditorPage } from './types/Nav.std.js';
import { initialize as initializeDonationService } from './services/donations.preload.js';
import { MessageRequestResponseSource } from './types/MessageRequestResponseEvent.std.js';

View File

@@ -83,7 +83,7 @@ import {
import { FileStream } from './util/FileStream.node.js';
import { ToastType } from '../../types/Toast.dom.js';
import { isAdhoc, isNightly } from '../../util/version.std.js';
import { isLocalBackupsEnabled } from '../../util/isLocalBackupsEnabled.dom.js';
import { isLocalBackupsEnabled } from '../../util/isLocalBackupsEnabled.preload.js';
import type { ValidateLocalBackupStructureResultType } from './util/localBackup.node.js';
import {
writeLocalBackupMetadata,

View File

@@ -117,6 +117,7 @@ import type { SmartPreferencesEditChatFolderPageProps } from './PreferencesEditC
import type { ExternalProps as SmartNotificationProfilesProps } from './PreferencesNotificationProfiles.preload.js';
import { useMegaphonesActions } from '../ducks/megaphones.preload.js';
import type { ZoomFactorType } from '../../types/StorageKeys.std.js';
import { isLocalBackupsEnabled } from '../../util/isLocalBackupsEnabled.preload.js';
const DEFAULT_NOTIFICATION_SETTING = 'message';
@@ -578,9 +579,7 @@ export function SmartPreferences(): React.JSX.Element | null {
Settings.isContentProtectionSupported(OS);
const isContentProtectionNeeded = Settings.isContentProtectionNeeded(OS);
const backupLocalBackupsEnabled = isFeaturedEnabledSelector({
betaKey: 'desktop.localBackups.beta',
prodKey: 'desktop.localBackups.prod',
const backupLocalBackupsEnabled = isLocalBackupsEnabled({
currentVersion: version,
remoteConfig: items.remoteConfig,
});

View File

@@ -1,11 +0,0 @@
// Copyright 2025 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { isFeaturedEnabledNoRedux } from './isFeatureEnabled.dom.js';
export function isLocalBackupsEnabled(): boolean {
return isFeaturedEnabledNoRedux({
betaKey: 'desktop.localBackups.beta',
prodKey: 'desktop.localBackups.prod',
});
}

View File

@@ -0,0 +1,44 @@
// Copyright 2025 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { ReadonlyObjectDeep } from 'type-fest/source/readonly-deep.js';
import { isEnabled, type ConfigMapType } from '../RemoteConfig.dom.js';
import {
isFeaturedEnabledNoRedux,
isFeaturedEnabledSelector,
} from './isFeatureEnabled.dom.js';
import { itemStorage } from '../textsecure/Storage.preload.js';
import { isNightly } from './version.std.js';
import { isTestOrMockEnvironment } from '../environment.std.js';
const IOS_USER_AGENT = 'OWI';
export function isLocalBackupsEnabled(reduxArgs?: {
currentVersion: string;
remoteConfig: ReadonlyObjectDeep<ConfigMapType> | undefined;
}): boolean {
// This is a temporary guard until iOS supports importing local backups
// Android no longer sends its OWA agent string, so we have to rely on iOS
if (
itemStorage.get('userAgent') === IOS_USER_AGENT &&
!isNightly(window.getVersion()) &&
!isTestOrMockEnvironment() &&
!isEnabled('desktop.internalUser', reduxArgs?.remoteConfig)
) {
return false;
}
if (reduxArgs) {
return isFeaturedEnabledSelector({
currentVersion: reduxArgs.currentVersion,
remoteConfig: reduxArgs.remoteConfig,
betaKey: 'desktop.localBackups.beta',
prodKey: 'desktop.localBackups.prod',
});
}
return isFeaturedEnabledNoRedux({
betaKey: 'desktop.localBackups.beta',
prodKey: 'desktop.localBackups.prod',
});
}