Fix rebase breakage.

This commit is contained in:
Matthew Chen 2018-01-11 11:15:50 -05:00
parent 5ba8445f05
commit 59933ce1d6
5 changed files with 16 additions and 15 deletions

View file

@ -130,13 +130,13 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
SetRandFunctionSeed();
// XXX - careful when moving this. It must happen before we initialize TSStorageManager.
[self verifyDBKeysAvailableBeforeBackgroundLaunch];
// If a backup restore is in progress, try to complete it.
// Otherwise, cleanup backup state.
[OWSBackup applicationDidFinishLaunching];
// XXX - careful when moving this. It must happen before we initialize TSStorageManager.
[self verifyDBKeysAvailableBeforeBackgroundLaunch];
// Prevent the device from sleeping during database view async registration
// (e.g. long database upgrades).
//

View file

@ -95,15 +95,6 @@ NS_ASSUME_NONNULL_BEGIN
[DebugUIMisc sendUnencryptedDatabase:thread];
}]];
}
[items addObject:[OWSTableItem
subPageItemWithText:@"Export Backup w/ Password"
actionBlock:^(UIViewController *viewController) {
OWSBackupExportViewController *backupViewController =
[OWSBackupExportViewController new];
[backupViewController exportBackup:thread skipPassword:NO];
[viewController.navigationController pushViewController:backupViewController
animated:YES];
}]];
[items addObject:[OWSTableItem
subPageItemWithText:@"Export Backup w/o Password"
actionBlock:^(UIViewController *viewController) {

View file

@ -217,6 +217,7 @@ NS_ASSUME_NONNULL_BEGIN
{
OWSAssert(self.backup.backupPassword.length > 0);
// TODO: We could consider clearing the password from the pasteboard after a certain delay.
[UIPasteboard.generalPasteboard setString:self.backup.backupPassword];
}

View file

@ -667,6 +667,10 @@ NSString *const Keychain_ImportBackupKey = @"ImportBackupKey";
}
self.encryptionKey = [OWSAES256Key keyWithData:encryptionKeyData];
if (![self isValidBackup]) {
return;
}
NSData *_Nullable databasePassword = [self readDataFromFileName:OWSBackup_DatabasePasswordFilename];
if (!databasePassword) {
OWSFail(@"%@ Could not retrieve database password.", self.logTag);
@ -771,6 +775,10 @@ NSString *const Keychain_ImportBackupKey = @"ImportBackupKey";
DDLogInfo(@"%@ restoreDirectoryContents: %@ -> %@", self.logTag, srcDirPath, dstDirPath);
if (![[NSFileManager defaultManager] fileExistsAtPath:srcDirPath]) {
// Not all backups will have both a "app documents" and "shared data container" folder.
// The latter should always be present for "modern" installs, but we are permissive
// here about what we accept so that we can easily apply this branch to historic
// (pre-shared data container) versions of the app and restore from them.
DDLogInfo(@"%@ Skipping restore directory: %@.", self.logTag, srcDirPath);
return YES;
}
@ -861,9 +869,10 @@ NSString *const Keychain_ImportBackupKey = @"ImportBackupKey";
- (NSString *)relativePathforPath:(NSString *)filePath basePath:(NSString *)basePath
{
OWSAssert(filePath.stringByStandardizingPath.length > 0);
OWSAssert([filePath.stringByStandardizingPath hasPrefix:basePath]);
OWSAssert([filePath.stringByStandardizingPath hasPrefix:basePath.stringByStandardizingPath]);
NSString *relativePath = [filePath.stringByStandardizingPath substringFromIndex:basePath.length];
NSString *relativePath =
[filePath.stringByStandardizingPath substringFromIndex:basePath.stringByStandardizingPath.length];
NSString *separator = @"/";
if ([relativePath hasPrefix:separator]) {
relativePath = [relativePath substringFromIndex:separator.length];

View file

@ -9,7 +9,7 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)init NS_UNAVAILABLE;
// TODO: We shouldn't ignore the return value of this method.
+ (BOOL)protectFileOrFolderAtPath:(NSString *)path;
+ (BOOL)protectFileOrFolderAtPath:(NSString *)path __attribute__((warn_unused_result));
+ (NSString *)appDocumentDirectoryPath;