From e71eb45642591de6de650d1c6f4d7b5fe79edd73 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Fri, 9 Apr 2021 09:18:44 +1000 Subject: [PATCH] Fix success handler not being called --- SessionMessagingKit/Jobs/AttachmentDownloadJob.swift | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/SessionMessagingKit/Jobs/AttachmentDownloadJob.swift b/SessionMessagingKit/Jobs/AttachmentDownloadJob.swift index 7b667193f..ee02092d1 100644 --- a/SessionMessagingKit/Jobs/AttachmentDownloadJob.swift +++ b/SessionMessagingKit/Jobs/AttachmentDownloadJob.swift @@ -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) }