Don't cull CloudKit records for lazy restoring attachments.
This commit is contained in:
parent
d0c691bb7f
commit
258cdab2df
|
@ -75,7 +75,7 @@ typedef NS_ENUM(NSUInteger, OWSBackupState) {
|
|||
|
||||
#pragma mark - Lazy Restore
|
||||
|
||||
- (NSArray<TSAttachmentStream *> *)attachmentsForLazyRestore;
|
||||
- (NSArray<NSString *> *)attachmentRecordNamesForLazyRestore;
|
||||
|
||||
- (NSArray<NSString *> *)attachmentIdsForLazyRestore;
|
||||
|
||||
|
|
|
@ -486,9 +486,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
#pragma mark - Lazy Restore
|
||||
|
||||
- (NSArray<TSAttachmentStream *> *)attachmentsForLazyRestore
|
||||
- (NSArray<NSString *> *)attachmentRecordNamesForLazyRestore
|
||||
{
|
||||
NSMutableArray<TSAttachmentStream *> *attachments = [NSMutableArray new];
|
||||
NSMutableArray<NSString *> *recordNames = [NSMutableArray new];
|
||||
[self.dbConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
||||
id ext = [transaction ext:TSMessageDatabaseViewExtensionName];
|
||||
if (!ext) {
|
||||
|
@ -506,10 +506,18 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
collection);
|
||||
return;
|
||||
}
|
||||
[attachments addObject:object];
|
||||
TSAttachmentStream *attachmentStream = object;
|
||||
if (attachmentStream.backupRestoreRecordName.length < 1) {
|
||||
OWSProdLogAndFail(@"%@ Invalid object: %@ in collection:%@",
|
||||
self.logTag,
|
||||
[object class],
|
||||
collection);
|
||||
return;
|
||||
}
|
||||
[recordNames addObject:attachmentStream.backupRestoreRecordName];
|
||||
}];
|
||||
}];
|
||||
return attachments;
|
||||
return recordNames;
|
||||
}
|
||||
|
||||
- (NSArray<NSString *> *)attachmentIdsForLazyRestore
|
||||
|
|
|
@ -1029,9 +1029,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
OWSAssert(![activeRecordNames containsObject:self.manifestItem.recordName]);
|
||||
[activeRecordNames addObject:self.manifestItem.recordName];
|
||||
|
||||
// TODO: If we implement "lazy restores" where attachments (etc.) are
|
||||
// restored lazily, we need to include the record names for all
|
||||
// Because we do "lazy attachment restores", we need to include the record names for all
|
||||
// records that haven't been restored yet.
|
||||
NSArray<NSString *> *restoringRecordNames = [OWSBackup.sharedManager attachmentRecordNamesForLazyRestore];
|
||||
[activeRecordNames addObjectsFromArray:restoringRecordNames];
|
||||
|
||||
__weak OWSBackupExportJob *weakSelf = self;
|
||||
[OWSBackupAPI fetchAllRecordNamesWithSuccess:^(NSArray<NSString *> *recordNames) {
|
||||
|
|
Loading…
Reference in New Issue