From d215499435bb79508ada7eca1dc7bc99f7b378d2 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Tue, 20 Mar 2018 12:26:17 -0400 Subject: [PATCH] Show backup UI in release builds if backup is enabled. --- .../AppSettings/AppSettingsViewController.m | 24 +++++++++++++++---- Signal/src/util/OWSBackupAPI.swift | 2 ++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m b/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m index 26f94e5e9..97b37ab0f 100644 --- a/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m +++ b/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m @@ -7,6 +7,7 @@ #import "AdvancedSettingsTableViewController.h" #import "DebugUITableViewController.h" #import "NotificationSettingsViewController.h" +#import "OWSBackup.h" #import "OWSBackupSettingsViewController.h" #import "OWSLinkedDevicesTableViewController.h" #import "OWSNavigationController.h" @@ -188,13 +189,26 @@ actionBlock:^{ [weakSelf showAdvanced]; }]]; + // Show backup UI in debug builds OR if backup has already been enabled. + // + // NOTE: Backup format is not yet finalized and backups are not yet + // properly encrypted, so these debug backups should only be + // done on test devices and will not be usable if/when we ship + // backup to production. + // + // TODO: Always show backup when we go to production. + BOOL isBackupEnabled = [OWSBackup.sharedManager isBackupEnabled]; + BOOL showBackup = isBackupEnabled; #ifdef DEBUG - [section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_BACKUP", - @"Label for the backup view in app settings.") - actionBlock:^{ - [weakSelf showBackup]; - }]]; + showBackup = YES; #endif + if (showBackup) { + [section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_BACKUP", + @"Label for the backup view in app settings.") + actionBlock:^{ + [weakSelf showBackup]; + }]]; + } [section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_ABOUT", @"") actionBlock:^{ [weakSelf showAbout]; diff --git a/Signal/src/util/OWSBackupAPI.swift b/Signal/src/util/OWSBackupAPI.swift index ebead95ab..5979a025b 100644 --- a/Signal/src/util/OWSBackupAPI.swift +++ b/Signal/src/util/OWSBackupAPI.swift @@ -10,6 +10,8 @@ import CloudKit // If we change the record types, we need to ensure indices // are configured properly in the CloudKit dashboard. + // + // TODO: Change the record types when we ship to production. static let signalBackupRecordType = "signalBackup" static let manifestRecordName = "manifest" static let payloadKey = "payload"