mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-02 00:07:56 +01:00
Update local backups availability during rollout
This commit is contained in:
@@ -271,7 +271,7 @@ import { MessageModel } from './models/messages.preload.js';
|
|||||||
import { waitForEvent } from './shims/events.dom.js';
|
import { waitForEvent } from './shims/events.dom.js';
|
||||||
import { sendSyncRequests } from './textsecure/syncRequests.preload.js';
|
import { sendSyncRequests } from './textsecure/syncRequests.preload.js';
|
||||||
import { handleServerAlerts } from './util/handleServerAlerts.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 { NavTab, SettingsPage, ProfileEditorPage } from './types/Nav.std.js';
|
||||||
import { initialize as initializeDonationService } from './services/donations.preload.js';
|
import { initialize as initializeDonationService } from './services/donations.preload.js';
|
||||||
import { MessageRequestResponseSource } from './types/MessageRequestResponseEvent.std.js';
|
import { MessageRequestResponseSource } from './types/MessageRequestResponseEvent.std.js';
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ import {
|
|||||||
import { FileStream } from './util/FileStream.node.js';
|
import { FileStream } from './util/FileStream.node.js';
|
||||||
import { ToastType } from '../../types/Toast.dom.js';
|
import { ToastType } from '../../types/Toast.dom.js';
|
||||||
import { isAdhoc, isNightly } from '../../util/version.std.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 type { ValidateLocalBackupStructureResultType } from './util/localBackup.node.js';
|
||||||
import {
|
import {
|
||||||
writeLocalBackupMetadata,
|
writeLocalBackupMetadata,
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ import type { SmartPreferencesEditChatFolderPageProps } from './PreferencesEditC
|
|||||||
import type { ExternalProps as SmartNotificationProfilesProps } from './PreferencesNotificationProfiles.preload.js';
|
import type { ExternalProps as SmartNotificationProfilesProps } from './PreferencesNotificationProfiles.preload.js';
|
||||||
import { useMegaphonesActions } from '../ducks/megaphones.preload.js';
|
import { useMegaphonesActions } from '../ducks/megaphones.preload.js';
|
||||||
import type { ZoomFactorType } from '../../types/StorageKeys.std.js';
|
import type { ZoomFactorType } from '../../types/StorageKeys.std.js';
|
||||||
|
import { isLocalBackupsEnabled } from '../../util/isLocalBackupsEnabled.preload.js';
|
||||||
|
|
||||||
const DEFAULT_NOTIFICATION_SETTING = 'message';
|
const DEFAULT_NOTIFICATION_SETTING = 'message';
|
||||||
|
|
||||||
@@ -578,9 +579,7 @@ export function SmartPreferences(): React.JSX.Element | null {
|
|||||||
Settings.isContentProtectionSupported(OS);
|
Settings.isContentProtectionSupported(OS);
|
||||||
const isContentProtectionNeeded = Settings.isContentProtectionNeeded(OS);
|
const isContentProtectionNeeded = Settings.isContentProtectionNeeded(OS);
|
||||||
|
|
||||||
const backupLocalBackupsEnabled = isFeaturedEnabledSelector({
|
const backupLocalBackupsEnabled = isLocalBackupsEnabled({
|
||||||
betaKey: 'desktop.localBackups.beta',
|
|
||||||
prodKey: 'desktop.localBackups.prod',
|
|
||||||
currentVersion: version,
|
currentVersion: version,
|
||||||
remoteConfig: items.remoteConfig,
|
remoteConfig: items.remoteConfig,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
44
ts/util/isLocalBackupsEnabled.preload.ts
Normal file
44
ts/util/isLocalBackupsEnabled.preload.ts
Normal 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',
|
||||||
|
});
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user