Fix success handler not being called

This commit is contained in:
Niels Andriesse 2021-04-09 09:18:44 +10:00
parent 8590e67271
commit e71eb45642
1 changed files with 8 additions and 4 deletions

View File

@ -108,9 +108,11 @@ public final class AttachmentDownloadJob : NSObject, Job, NSCoding { // NSObject
return handleFailure(error)
}
OWSFileSystem.deleteFile(temporaryFilePath.absoluteString)
storage.write { transaction in
storage.write(with: { transaction in
storage.persist(stream, associatedWith: self.tsMessageID, using: transaction)
}
}, completion: {
self.handleSuccess()
})
}.catch(on: DispatchQueue.global()) { error in
handleFailure(error)
}
@ -138,9 +140,11 @@ public final class AttachmentDownloadJob : NSObject, Job, NSCoding { // NSObject
return handleFailure(error)
}
OWSFileSystem.deleteFile(temporaryFilePath.absoluteString)
storage.write { transaction in
storage.write(with: { transaction in
storage.persist(stream, associatedWith: self.tsMessageID, using: transaction)
}
}, completion: {
self.handleSuccess()
})
}.catch(on: DispatchQueue.global()) { error in
handleFailure(error)
}