Backup local profile.
This commit is contained in:
parent
3acfa707d9
commit
c9c76c650f
|
@ -754,7 +754,7 @@ NSError *OWSBackupErrorWithDescription(NSString *description)
|
|||
OWSFailDebug(@"Could not load database view.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
[ext enumerateKeysInGroup:TSLazyRestoreAttachmentsGroup
|
||||
usingBlock:^(NSString *collection, NSString *key, NSUInteger index, BOOL *stop) {
|
||||
[attachmentIds addObject:key];
|
||||
|
|
|
@ -63,13 +63,13 @@ import PromiseKit
|
|||
// complete.
|
||||
@objc
|
||||
public class func saveEphemeralFileToCloudObjc(recipientId: String,
|
||||
fileUrl: URL) -> AnyPromise {
|
||||
fileUrl: URL) -> AnyPromise {
|
||||
return AnyPromise(saveEphemeralFileToCloud(recipientId: recipientId,
|
||||
fileUrl: fileUrl))
|
||||
fileUrl: fileUrl))
|
||||
}
|
||||
|
||||
public class func saveEphemeralFileToCloud(recipientId: String,
|
||||
fileUrl: URL) -> Promise<String> {
|
||||
fileUrl: URL) -> Promise<String> {
|
||||
let recordName = "\(recordNamePrefix(forRecipientId: recipientId))ephemeralFile-\(NSUUID().uuidString)"
|
||||
return saveFileToCloud(fileUrl: fileUrl,
|
||||
recordName: recordName,
|
||||
|
@ -614,7 +614,7 @@ import PromiseKit
|
|||
|
||||
@objc
|
||||
public class func downloadFileFromCloudObjc(recordName: String,
|
||||
toFileUrl: URL) -> AnyPromise {
|
||||
toFileUrl: URL) -> AnyPromise {
|
||||
return AnyPromise(downloadFileFromCloud(recordName: recordName,
|
||||
toFileUrl: toFileUrl))
|
||||
}
|
||||
|
@ -623,7 +623,7 @@ import PromiseKit
|
|||
toFileUrl: URL) -> Promise<Void> {
|
||||
|
||||
return downloadFromCloud(recordName: recordName,
|
||||
remainingRetries: maxRetries)
|
||||
remainingRetries: maxRetries)
|
||||
.then { (asset) -> Promise<Void> in
|
||||
do {
|
||||
try FileManager.default.copyItem(at: asset.fileURL, to: toFileUrl)
|
||||
|
@ -676,7 +676,7 @@ import PromiseKit
|
|||
resolver.fulfill(asset)
|
||||
}.catch { (error) in
|
||||
resolver.reject(error)
|
||||
}.retainUntilComplete()
|
||||
}.retainUntilComplete()
|
||||
})
|
||||
case .failureRetryWithoutDelay:
|
||||
DispatchQueue.global().async {
|
||||
|
|
|
@ -464,7 +464,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
NSError *error = OWSBackupErrorWithDescription(@"Backup export failed.");
|
||||
return resolve(error);
|
||||
}
|
||||
|
||||
|
||||
resolve(@(1));
|
||||
}];
|
||||
}
|
||||
|
@ -1059,7 +1059,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
NSMutableSet<NSString *> *obsoleteRecordNames = [NSMutableSet new];
|
||||
[obsoleteRecordNames addObjectsFromArray:[transaction allKeysInCollection:[OWSBackupFragment collection]]];
|
||||
[obsoleteRecordNames minusSet:activeRecordNames];
|
||||
|
||||
|
||||
[transaction removeObjectsForKeys:obsoleteRecordNames.allObjects inCollection:[OWSBackupFragment collection]];
|
||||
}];
|
||||
}
|
||||
|
|
|
@ -111,12 +111,12 @@ NSString *const kOWSBackup_KeychainService = @"kOWSBackup_KeychainService";
|
|||
return;
|
||||
}
|
||||
self.isComplete = YES;
|
||||
|
||||
|
||||
// There's a lot of asynchrony in these backup jobs;
|
||||
// ensure we only end up finishing these jobs once.
|
||||
OWSAssertDebug(!self.hasSucceeded);
|
||||
self.hasSucceeded = YES;
|
||||
|
||||
|
||||
[self.delegate backupJobDidSucceed:self];
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue