Update local backups availability during rollout

Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com>
This commit is contained in:
automated-signal
2026-03-24 11:06:34 -05:00
committed by GitHub
parent a9d5af83ab
commit 2d00471f5d
5 changed files with 48 additions and 16 deletions

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',
});
}