2024-04-22 23:25:56 +02:00
|
|
|
// Copyright 2024 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2025-09-16 17:39:03 -07:00
|
|
|
import * as RemoteConfig from '../RemoteConfig.js';
|
|
|
|
import { isTestOrMockEnvironment } from '../environment.js';
|
|
|
|
import { isStagingServer } from './isStagingServer.js';
|
|
|
|
import { isBeta, isNightly } from './version.js';
|
2024-04-22 23:25:56 +02:00
|
|
|
|
2025-06-30 16:18:52 -04:00
|
|
|
export function areRemoteBackupsTurnedOn(): boolean {
|
|
|
|
return isBackupFeatureEnabled() && window.storage.get('backupTier') != null;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Downloading from a remote backup is currently a test-only feature
|
|
|
|
export function canAttemptRemoteBackupDownload(): boolean {
|
|
|
|
return isBackupFeatureEnabled() && isTestOrMockEnvironment();
|
|
|
|
}
|
|
|
|
|
2025-08-06 14:31:58 -04:00
|
|
|
export function isBackupFeatureEnabled(
|
|
|
|
reduxConfig?: RemoteConfig.ConfigMapType
|
|
|
|
): boolean {
|
2024-10-07 12:58:59 -07:00
|
|
|
if (isStagingServer() || isTestOrMockEnvironment()) {
|
2024-08-08 12:22:48 -07:00
|
|
|
return true;
|
|
|
|
}
|
2025-05-15 13:58:20 +10:00
|
|
|
|
2025-08-06 14:31:58 -04:00
|
|
|
if (isNightly(window.getVersion())) {
|
2025-05-15 13:58:20 +10:00
|
|
|
return true;
|
|
|
|
}
|
2025-08-06 14:31:58 -04:00
|
|
|
|
2025-09-10 10:57:28 -04:00
|
|
|
if (isBeta(window.getVersion())) {
|
|
|
|
return RemoteConfig.isEnabled('desktop.backups.beta', reduxConfig);
|
|
|
|
}
|
|
|
|
|
|
|
|
return Boolean(RemoteConfig.isEnabled('desktop.backups.prod', reduxConfig));
|
2025-05-15 13:58:20 +10:00
|
|
|
}
|