diff --git a/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m b/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m index 22f1e2944..3c6f0709f 100644 --- a/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m +++ b/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m @@ -193,20 +193,8 @@ 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; - SUPPRESS_DEADSTORE_WARNING(showBackup); -#ifdef DEBUG - showBackup = YES; -#endif + BOOL showBackup = (OWSBackup.isFeatureEnabled && isBackupEnabled); if (showBackup) { [section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_BACKUP", @"Label for the backup view in app settings.") diff --git a/Signal/src/ViewControllers/DebugUI/DebugUIProfile.swift b/Signal/src/ViewControllers/DebugUI/DebugUIProfile.swift index ce718ddaa..5377de584 100644 --- a/Signal/src/ViewControllers/DebugUI/DebugUIProfile.swift +++ b/Signal/src/ViewControllers/DebugUI/DebugUIProfile.swift @@ -35,6 +35,11 @@ class DebugUIProfile: DebugUIPage { OWSTableItem(title: "Log User Profiles") { profileManager.logUserProfiles() }, + OWSTableItem(title: "Log Profile Key") { + let localProfileKey = profileManager.localProfileKey() + Logger.info("localProfileKey: \(localProfileKey.keyData.hexadecimalString)") + profileManager.logUserProfiles() + }, OWSTableItem(title: "Regenerate Profile/ProfileKey") { profileManager.regenerateLocalProfile() }, diff --git a/Signal/src/util/Backup/OWSBackup.h b/Signal/src/util/Backup/OWSBackup.h index c81a55d6b..b1b235edf 100644 --- a/Signal/src/util/Backup/OWSBackup.h +++ b/Signal/src/util/Backup/OWSBackup.h @@ -51,6 +51,8 @@ NSError *OWSBackupErrorWithDescription(NSString *description); @property (nonatomic, readonly, nullable) NSString *backupExportDescription; @property (nonatomic, readonly, nullable) NSNumber *backupExportProgress; ++ (BOOL)isFeatureEnabled; + - (BOOL)isBackupEnabled; - (void)setIsBackupEnabled:(BOOL)value; diff --git a/Signal/src/util/Backup/OWSBackup.m b/Signal/src/util/Backup/OWSBackup.m index 49b9190db..68699580c 100644 --- a/Signal/src/util/Backup/OWSBackup.m +++ b/Signal/src/util/Backup/OWSBackup.m @@ -186,6 +186,11 @@ NSError *OWSBackupErrorWithDescription(NSString *description) return SSKEnvironment.shared.tsAccountManager; } ++ (BOOL)isFeatureEnabled +{ + return NO; +} + #pragma mark - Backup Export - (void)tryToExportBackup @@ -349,6 +354,10 @@ NSError *OWSBackupErrorWithDescription(NSString *description) { OWSAssertIsOnMainThread(); + if (!OWSBackup.isFeatureEnabled) { + return; + } + if (!CurrentAppContext().isMainApp) { return; } diff --git a/SignalMessaging/profiles/OWSProfileManager.m b/SignalMessaging/profiles/OWSProfileManager.m index eb95ce2f5..332d73c6e 100644 --- a/SignalMessaging/profiles/OWSProfileManager.m +++ b/SignalMessaging/profiles/OWSProfileManager.m @@ -860,6 +860,7 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error); { OWSUserProfile *userProfile = self.localUserProfile; [userProfile clearWithProfileKey:[OWSAES256Key generateRandomKey] dbConnection:self.dbConnection completion:nil]; + [self.tsAccountManager updateAccountAttributes]; } - (void)addUserToProfileWhitelist:(NSString *)recipientId diff --git a/SignalServiceKit/src/Network/WebSockets/OWSWebSocket.m b/SignalServiceKit/src/Network/WebSockets/OWSWebSocket.m index 60470630e..873e89066 100644 --- a/SignalServiceKit/src/Network/WebSockets/OWSWebSocket.m +++ b/SignalServiceKit/src/Network/WebSockets/OWSWebSocket.m @@ -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 { OWSAssertIsOnMainThread(); @@ -756,7 +767,7 @@ NSString *const kNSNotification_OWSWebSocketStateDidChange = @"kNSNotification_O __block OWSBackgroundTask *_Nullable backgroundTask = [OWSBackgroundTask backgroundTaskWithLabelStr:__PRETTY_FUNCTION__]; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + dispatch_async(self.serialQueue, ^{ BOOL success = NO; @try { NSData *_Nullable decryptedPayload =