mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 12:19:41 +00:00
Enable remote backups UI on nightly builds
Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com>
This commit is contained in:
@@ -182,8 +182,12 @@ export async function forceRefreshRemoteConfig(
|
||||
await _refreshRemoteConfig(server);
|
||||
}
|
||||
|
||||
export function isEnabled(name: ConfigKeyType): boolean {
|
||||
return get(config, [name, 'enabled'], false);
|
||||
export function isEnabled(
|
||||
name: ConfigKeyType,
|
||||
// when called from UI component, provide redux config (items.remoteConfig)
|
||||
reduxConfig?: ConfigMapType
|
||||
): boolean {
|
||||
return get(reduxConfig ?? config, [name, 'enabled'], false);
|
||||
}
|
||||
|
||||
export function getValue(name: ConfigKeyType): string | undefined {
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
} from '../selectors/items';
|
||||
import { DEFAULT_AUTO_DOWNLOAD_ATTACHMENT } from '../../textsecure/Storage';
|
||||
import { DEFAULT_CONVERSATION_COLOR } from '../../types/Colors';
|
||||
import { isBackupFeatureEnabledForRedux } from '../../util/isBackupEnabled';
|
||||
import { isBackupFeatureEnabled } from '../../util/isBackupEnabled';
|
||||
import { format } from '../../types/PhoneNumber';
|
||||
import {
|
||||
getIntl,
|
||||
@@ -68,7 +68,7 @@ import { SmartToastManager } from './ToastManager';
|
||||
import { useToastActions } from '../ducks/toast';
|
||||
import { DataReader } from '../../sql/Client';
|
||||
import { deleteAllMyStories } from '../../util/deleteAllMyStories';
|
||||
import { isLocalBackupsEnabledForRedux } from '../../util/isLocalBackupsEnabled';
|
||||
import { isLocalBackupsEnabled } from '../../util/isLocalBackupsEnabled';
|
||||
import { SmartPreferencesDonations } from './PreferencesDonations';
|
||||
import { useDonationsActions } from '../ducks/donations';
|
||||
import { generateDonationReceiptBlob } from '../../util/generateDonationReceipt';
|
||||
@@ -519,12 +519,8 @@ export function SmartPreferences(): JSX.Element | null {
|
||||
Settings.isContentProtectionSupported(OS);
|
||||
const isContentProtectionNeeded = Settings.isContentProtectionNeeded(OS);
|
||||
|
||||
const backupFeatureEnabled = isBackupFeatureEnabledForRedux(
|
||||
items.remoteConfig
|
||||
);
|
||||
const backupLocalBackupsEnabled = isLocalBackupsEnabledForRedux(
|
||||
items.remoteConfig
|
||||
);
|
||||
const backupFeatureEnabled = isBackupFeatureEnabled(items.remoteConfig);
|
||||
const backupLocalBackupsEnabled = isLocalBackupsEnabled(items.remoteConfig);
|
||||
const donationsFeatureEnabled =
|
||||
items.remoteConfig?.['desktop.internalUser']?.enabled ??
|
||||
items.remoteConfig?.['desktop.donations']?.enabled ??
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import * as RemoteConfig from '../RemoteConfig';
|
||||
import { isTestOrMockEnvironment } from '../environment';
|
||||
import { isStagingServer } from './isStagingServer';
|
||||
import { isNightly } from './version';
|
||||
|
||||
export function areRemoteBackupsTurnedOn(): boolean {
|
||||
return isBackupFeatureEnabled() && window.storage.get('backupTier') != null;
|
||||
@@ -14,18 +15,18 @@ export function canAttemptRemoteBackupDownload(): boolean {
|
||||
return isBackupFeatureEnabled() && isTestOrMockEnvironment();
|
||||
}
|
||||
|
||||
export function isBackupFeatureEnabled(): boolean {
|
||||
if (isStagingServer() || isTestOrMockEnvironment()) {
|
||||
return true;
|
||||
}
|
||||
return Boolean(RemoteConfig.isEnabled('desktop.backup.credentialFetch'));
|
||||
}
|
||||
|
||||
export function isBackupFeatureEnabledForRedux(
|
||||
config: RemoteConfig.ConfigMapType | undefined
|
||||
export function isBackupFeatureEnabled(
|
||||
reduxConfig?: RemoteConfig.ConfigMapType
|
||||
): boolean {
|
||||
if (isStagingServer() || isTestOrMockEnvironment()) {
|
||||
return true;
|
||||
}
|
||||
return Boolean(config?.['desktop.backup.credentialFetch']?.enabled);
|
||||
|
||||
if (isNightly(window.getVersion())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return Boolean(
|
||||
RemoteConfig.isEnabled('desktop.backup.credentialFetch', reduxConfig)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,31 +6,14 @@ import { isTestOrMockEnvironment } from '../environment';
|
||||
import { isStagingServer } from './isStagingServer';
|
||||
import { isNightly } from './version';
|
||||
|
||||
export function isLocalBackupsEnabled(): boolean {
|
||||
if (isStagingServer() || isTestOrMockEnvironment()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (RemoteConfig.isEnabled('desktop.internalUser')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const version = window.getVersion?.();
|
||||
if (version != null) {
|
||||
return isNightly(version);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isLocalBackupsEnabledForRedux(
|
||||
config: Pick<RemoteConfig.ConfigMapType, 'desktop.internalUser'> | undefined
|
||||
export function isLocalBackupsEnabled(
|
||||
reduxConfig?: RemoteConfig.ConfigMapType
|
||||
): boolean {
|
||||
if (isStagingServer() || isTestOrMockEnvironment()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (config?.['desktop.internalUser']?.enabled) {
|
||||
if (RemoteConfig.isEnabled('desktop.internalUser', reduxConfig)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user