Merge branch 'release/2.32.0'

pull/1/head
Matthew Chen 7 years ago
commit d70aa4418f

@ -193,20 +193,8 @@
actionBlock:^{ actionBlock:^{
[weakSelf showAdvanced]; [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 isBackupEnabled = [OWSBackup.sharedManager isBackupEnabled];
BOOL showBackup = isBackupEnabled; BOOL showBackup = (OWSBackup.isFeatureEnabled && isBackupEnabled);
SUPPRESS_DEADSTORE_WARNING(showBackup);
#ifdef DEBUG
showBackup = YES;
#endif
if (showBackup) { if (showBackup) {
[section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_BACKUP", [section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_BACKUP",
@"Label for the backup view in app settings.") @"Label for the backup view in app settings.")

@ -35,6 +35,11 @@ class DebugUIProfile: DebugUIPage {
OWSTableItem(title: "Log User Profiles") { OWSTableItem(title: "Log User Profiles") {
profileManager.logUserProfiles() profileManager.logUserProfiles()
}, },
OWSTableItem(title: "Log Profile Key") {
let localProfileKey = profileManager.localProfileKey()
Logger.info("localProfileKey: \(localProfileKey.keyData.hexadecimalString)")
profileManager.logUserProfiles()
},
OWSTableItem(title: "Regenerate Profile/ProfileKey") { OWSTableItem(title: "Regenerate Profile/ProfileKey") {
profileManager.regenerateLocalProfile() profileManager.regenerateLocalProfile()
}, },

@ -51,6 +51,8 @@ NSError *OWSBackupErrorWithDescription(NSString *description);
@property (nonatomic, readonly, nullable) NSString *backupExportDescription; @property (nonatomic, readonly, nullable) NSString *backupExportDescription;
@property (nonatomic, readonly, nullable) NSNumber *backupExportProgress; @property (nonatomic, readonly, nullable) NSNumber *backupExportProgress;
+ (BOOL)isFeatureEnabled;
- (BOOL)isBackupEnabled; - (BOOL)isBackupEnabled;
- (void)setIsBackupEnabled:(BOOL)value; - (void)setIsBackupEnabled:(BOOL)value;

@ -186,6 +186,11 @@ NSError *OWSBackupErrorWithDescription(NSString *description)
return SSKEnvironment.shared.tsAccountManager; return SSKEnvironment.shared.tsAccountManager;
} }
+ (BOOL)isFeatureEnabled
{
return NO;
}
#pragma mark - Backup Export #pragma mark - Backup Export
- (void)tryToExportBackup - (void)tryToExportBackup
@ -349,6 +354,10 @@ NSError *OWSBackupErrorWithDescription(NSString *description)
{ {
OWSAssertIsOnMainThread(); OWSAssertIsOnMainThread();
if (!OWSBackup.isFeatureEnabled) {
return;
}
if (!CurrentAppContext().isMainApp) { if (!CurrentAppContext().isMainApp) {
return; return;
} }

@ -860,6 +860,7 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
{ {
OWSUserProfile *userProfile = self.localUserProfile; OWSUserProfile *userProfile = self.localUserProfile;
[userProfile clearWithProfileKey:[OWSAES256Key generateRandomKey] dbConnection:self.dbConnection completion:nil]; [userProfile clearWithProfileKey:[OWSAES256Key generateRandomKey] dbConnection:self.dbConnection completion:nil];
[self.tsAccountManager updateAccountAttributes];
} }
- (void)addUserToProfileWhitelist:(NSString *)recipientId - (void)addUserToProfileWhitelist:(NSString *)recipientId

@ -741,6 +741,17 @@ NSString *const kNSNotification_OWSWebSocketStateDidChange = @"kNSNotification_O
} }
} }
- (dispatch_queue_t)serialQueue
{
static dispatch_queue_t _serialQueue;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_serialQueue = dispatch_queue_create("org.signal.websocket", DISPATCH_QUEUE_SERIAL);
});
return _serialQueue;
}
- (void)processWebSocketRequestMessage:(WebSocketProtoWebSocketRequestMessage *)message - (void)processWebSocketRequestMessage:(WebSocketProtoWebSocketRequestMessage *)message
{ {
OWSAssertIsOnMainThread(); OWSAssertIsOnMainThread();
@ -756,7 +767,7 @@ NSString *const kNSNotification_OWSWebSocketStateDidChange = @"kNSNotification_O
__block OWSBackgroundTask *_Nullable backgroundTask = __block OWSBackgroundTask *_Nullable backgroundTask =
[OWSBackgroundTask backgroundTaskWithLabelStr:__PRETTY_FUNCTION__]; [OWSBackgroundTask backgroundTaskWithLabelStr:__PRETTY_FUNCTION__];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ dispatch_async(self.serialQueue, ^{
BOOL success = NO; BOOL success = NO;
@try { @try {
NSData *_Nullable decryptedPayload = NSData *_Nullable decryptedPayload =

Loading…
Cancel
Save