Respond to CR.

pull/1/head
Matthew Chen 7 years ago
parent 3de9a4ea55
commit 0d5b5bc44c

@ -80,9 +80,9 @@ NS_ASSUME_NONNULL_BEGIN
actionBlock:^{
[DebugUISessionState clearSessionAndIdentityStore];
}],
[OWSTableItem itemWithTitle:@"Archive Session and Identity Store"
[OWSTableItem itemWithTitle:@"Snapshot Session and Identity Store"
actionBlock:^{
[DebugUISessionState archiveSessionAndIdentityStore];
[DebugUISessionState snapshotSessionAndIdentityStore];
}],
[OWSTableItem itemWithTitle:@"Restore Session and Identity Store"
actionBlock:^{
@ -105,12 +105,12 @@ NS_ASSUME_NONNULL_BEGIN
});
}
+ (void)archiveSessionAndIdentityStore
+ (void)snapshotSessionAndIdentityStore
{
dispatch_async([OWSDispatch sessionStoreQueue], ^{
[[TSStorageManager sharedManager] archiveSessionStore];
[[TSStorageManager sharedManager] snapshotSessionStore];
dispatch_async(dispatch_get_main_queue(), ^{
[[OWSIdentityManager sharedManager] archiveIdentityState];
[[OWSIdentityManager sharedManager] snapshotIdentityState];
});
});
}

@ -16,6 +16,10 @@
NS_ASSUME_NONNULL_BEGIN
// Hide the "import" directories from exports, etc. by prefixing their name with a period.
//
// OWSBackup backs up files and directories in the "app documents" and "shared data container",
// but ignores any top-level files or directories in those locations whose names start with a
// period ".".
NSString *const OWSBackup_DirNamePrefix = @".SignalBackup.";
NSString *const OWSBackup_FileExtension = @".signalbackup";
NSString *const OWSBackup_EncryptionKeyFilename = @".encryptionKey";

@ -53,8 +53,10 @@ extern const NSUInteger kIdentityKeyLength;
#pragma mark - Debug
#if DEBUG
// Clears everything except the local identity key.
- (void)clearIdentityState;
- (void)archiveIdentityState;
- (void)snapshotIdentityState;
- (void)restoreIdentityState;
#endif

@ -771,17 +771,19 @@ NSString *const kNSNotificationName_IdentityStateDidChange = @"kNSNotificationNa
- (NSString *)identityKeySnapshotFilePath
{
// Prefix name with period "." so that backups will ignore these snapshots.
NSString *dirPath = [OWSFileSystem appDocumentDirectoryPath];
return [dirPath stringByAppendingPathComponent:@".identity-key-snapshot"];
}
- (NSString *)trustedKeySnapshotFilePath
{
// Prefix name with period "." so that backups will ignore these snapshots.
NSString *dirPath = [OWSFileSystem appDocumentDirectoryPath];
return [dirPath stringByAppendingPathComponent:@".trusted-key-snapshot"];
}
- (void)archiveIdentityState
- (void)snapshotIdentityState
{
[self.dbConnection snapshotCollection:TSStorageManagerIdentityKeyStoreCollection
snapshotFilePath:self.identityKeySnapshotFilePath];

@ -13,7 +13,7 @@
- (void)resetSessionStore;
#if DEBUG
- (void)archiveSessionStore;
- (void)snapshotSessionStore;
- (void)restoreSessionStore;
#endif
- (void)printAllSessions;

@ -194,6 +194,8 @@ void AssertIsOnSessionStoreQueue()
- (void)resetSessionStore
{
AssertIsOnSessionStoreQueue();
DDLogWarn(@"%@ resetting session store", self.logTag);
[self.sessionDBConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
[transaction removeAllObjectsInCollection:TSStorageManagerSessionStoreCollection];
@ -247,11 +249,12 @@ void AssertIsOnSessionStoreQueue()
#if DEBUG
- (NSString *)snapshotFilePath
{
// Prefix name with period "." so that backups will ignore these snapshots.
NSString *dirPath = [OWSFileSystem appDocumentDirectoryPath];
return [dirPath stringByAppendingPathComponent:@".session-snapshot"];
}
- (void)archiveSessionStore
- (void)snapshotSessionStore
{
AssertIsOnSessionStoreQueue();

Loading…
Cancel
Save