diff --git a/SignalServiceKit/Backups/Attachments/BackupAttachmentUploadQueueRunner.swift b/SignalServiceKit/Backups/Attachments/BackupAttachmentUploadQueueRunner.swift index d6d8cced51..61b0d616f9 100644 --- a/SignalServiceKit/Backups/Attachments/BackupAttachmentUploadQueueRunner.swift +++ b/SignalServiceKit/Backups/Attachments/BackupAttachmentUploadQueueRunner.swift @@ -514,6 +514,7 @@ class BackupAttachmentUploadQueueRunnerImpl: BackupAttachmentUploadQueueRunner { localAci: localAci, backupKey: backupKey, auth: backupAuth, + progress: nil, ) } } catch let error { diff --git a/SignalServiceKit/Contacts/OWSSyncManager.swift b/SignalServiceKit/Contacts/OWSSyncManager.swift index 06ad2266d6..82c26f514b 100644 --- a/SignalServiceKit/Contacts/OWSSyncManager.swift +++ b/SignalServiceKit/Contacts/OWSSyncManager.swift @@ -512,7 +512,10 @@ extension OWSSyncManager: SyncManagerProtocol, SyncManagerProtocolSwift { let dataSource = DataSourcePath(fileUrl: result.syncFileUrl, ownership: .owned) - let uploadResult = try await DependenciesBridge.shared.attachmentUploadManager.uploadTransientAttachment(dataSource: dataSource) + let uploadResult = try await DependenciesBridge.shared.attachmentUploadManager.uploadTransientAttachment( + dataSource: dataSource, + progress: nil, + ) let message = SSKEnvironment.shared.databaseStorageRef.read { tx in return OWSSyncContactsMessage(uploadedAttachment: uploadResult, localThread: thread, tx: tx) } diff --git a/SignalServiceKit/Jobs/IncomingContactSyncJobQueue.swift b/SignalServiceKit/Jobs/IncomingContactSyncJobQueue.swift index 06790c1ea9..a5559b47ae 100644 --- a/SignalServiceKit/Jobs/IncomingContactSyncJobQueue.swift +++ b/SignalServiceKit/Jobs/IncomingContactSyncJobQueue.swift @@ -103,6 +103,7 @@ private class IncomingContactSyncJobRunner: JobRunner { case .transient(let downloadMetadata): fileUrl = try await DependenciesBridge.shared.attachmentDownloadManager.downloadTransientAttachment( metadata: downloadMetadata, + progress: nil, ) } diff --git a/SignalServiceKit/Messages/Attachments/V2/Downloads/AttachmentDownloadManager.swift b/SignalServiceKit/Messages/Attachments/V2/Downloads/AttachmentDownloadManager.swift index 6d54d80dec..cd2010ad5b 100644 --- a/SignalServiceKit/Messages/Attachments/V2/Downloads/AttachmentDownloadManager.swift +++ b/SignalServiceKit/Messages/Attachments/V2/Downloads/AttachmentDownloadManager.swift @@ -200,12 +200,6 @@ public protocol AttachmentDownloadManager { extension AttachmentDownloadManager { - public func downloadTransientAttachment( - metadata: AttachmentDownloads.DownloadMetadata, - ) async throws -> URL { - return try await downloadTransientAttachment(metadata: metadata, progress: nil) - } - public func enqueueDownloadOfAttachmentsForMessage( _ message: TSMessage, tx: DBWriteTransaction, @@ -220,16 +214,4 @@ extension AttachmentDownloadManager { enqueueDownloadOfAttachmentsForStoryMessage(message, priority: .default, tx: tx) } - public func downloadAttachment( - id: Attachment.IDType, - priority: AttachmentDownloadPriority, - source: QueuedAttachmentDownloadRecord.SourceType, - ) async throws { - try await downloadAttachment( - id: id, - priority: priority, - source: source, - progress: nil, - ) - } } diff --git a/SignalServiceKit/Messages/OutgoingMessagePreparer/PreparedOutgoingMessage.swift b/SignalServiceKit/Messages/OutgoingMessagePreparer/PreparedOutgoingMessage.swift index ad395ad2fd..dcf3604fff 100644 --- a/SignalServiceKit/Messages/OutgoingMessagePreparer/PreparedOutgoingMessage.swift +++ b/SignalServiceKit/Messages/OutgoingMessagePreparer/PreparedOutgoingMessage.swift @@ -245,6 +245,7 @@ public class PreparedOutgoingMessage { return { try await DependenciesBridge.shared.attachmentUploadManager.uploadTransitTierAttachment( attachmentId: attachmentId, + progress: nil, ) } } diff --git a/SignalServiceKit/Upload/AttachmentUploadManager.swift b/SignalServiceKit/Upload/AttachmentUploadManager.swift index a10aa68244..a4691c7851 100644 --- a/SignalServiceKit/Upload/AttachmentUploadManager.swift +++ b/SignalServiceKit/Upload/AttachmentUploadManager.swift @@ -56,81 +56,6 @@ public protocol AttachmentUploadManager { ) async throws } -extension AttachmentUploadManager { - - public func uploadBackup( - localUploadMetadata: Upload.EncryptedBackupUploadMetadata, - form: Upload.Form, - ) async throws -> Upload.Result { - try await uploadBackup( - localUploadMetadata: localUploadMetadata, - form: form, - progress: nil, - ) - } - - public func uploadTransientAttachment( - dataSource: DataSourcePath, - ) async throws -> Upload.Result { - try await uploadTransientAttachment( - dataSource: dataSource, - progress: nil, - ) - } - - public func uploadLinkNSyncAttachment( - dataSource: DataSourcePath, - ) async throws -> Upload.Result { - try await uploadLinkNSyncAttachment( - dataSource: dataSource, - progress: nil, - ) - } - - public func uploadTransitTierAttachment( - attachmentId: Attachment.IDType, - ) async throws { - try await uploadTransitTierAttachment( - attachmentId: attachmentId, - progress: nil, - ) - } - - public func uploadMediaTierAttachment( - attachmentId: Attachment.IDType, - uploadEra: String, - localAci: Aci, - backupKey: MediaRootBackupKey, - auth: BackupServiceAuth, - ) async throws { - try await uploadMediaTierAttachment( - attachmentId: attachmentId, - uploadEra: uploadEra, - localAci: localAci, - backupKey: backupKey, - auth: auth, - progress: nil, - ) - } - - public func uploadMediaTierThumbnailAttachment( - attachmentId: Attachment.IDType, - uploadEra: String, - localAci: Aci, - backupKey: MediaRootBackupKey, - auth: BackupServiceAuth, - ) async throws { - try await uploadMediaTierThumbnailAttachment( - attachmentId: attachmentId, - uploadEra: uploadEra, - localAci: localAci, - backupKey: backupKey, - auth: auth, - progress: nil, - ) - } -} - public actor AttachmentUploadManagerImpl: AttachmentUploadManager { private let accountKeyStore: AccountKeyStore diff --git a/SignalServiceKit/tests/Network/Upload/AttachmentUploadManagerTests.swift b/SignalServiceKit/tests/Network/Upload/AttachmentUploadManagerTests.swift index 384a8a0d2d..e3ac90c082 100644 --- a/SignalServiceKit/tests/Network/Upload/AttachmentUploadManagerTests.swift +++ b/SignalServiceKit/tests/Network/Upload/AttachmentUploadManagerTests.swift @@ -45,7 +45,7 @@ class AttachmentUploadManagerTests { helper.addUploadRequestMock(auth: auth, location: resumeLocation, type: .success) } - _ = try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID) + _ = try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID, progress: nil) switch cdn { case .cdn2: @@ -86,7 +86,7 @@ class AttachmentUploadManagerTests { helper.addUploadRequestMock(auth: auth, location: location, type: .success) } - try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID) + try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID, progress: nil) if case let .uploadTask(request) = helper.capturedUploadRequests.last { #expect(request.httpMethod == attempt.resumeUploadHttpMethod) @@ -126,7 +126,7 @@ class AttachmentUploadManagerTests { helper.addUploadRequestMock(auth: auth, location: location, type: .success) } - try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID) + try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID, progress: nil) if case let .uploadTask(request) = helper.capturedUploadRequests[0] { #expect(request.httpMethod == attempt2.uploadHttpMethod) @@ -184,7 +184,7 @@ class AttachmentUploadManagerTests { helper.addUploadRequestMock(auth: auth, location: location, type: .success) } - try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID) + try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID, progress: nil) if case let .uploadTask(request) = helper.capturedUploadRequests[0] { #expect(request.httpMethod == attempt2.uploadHttpMethod) @@ -264,7 +264,7 @@ class AttachmentUploadManagerTests { helper.addUploadRequestMock(auth: auth, location: location, type: .success) } - try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID) + try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID, progress: nil) if case let .uploadTask(request) = helper.capturedUploadRequests.last { #expect(request.url!.absoluteString == attempt.fetchedUploadLocation) @@ -298,7 +298,7 @@ class AttachmentUploadManagerTests { helper.addUploadRequestMock(auth: auth, location: location, type: .success) } - try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID) + try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID, progress: nil) if case let .uploadTask(request) = helper.capturedUploadRequests.last { #expect(request.url!.absoluteString == attempt2.fetchedUploadLocation) @@ -341,7 +341,7 @@ class AttachmentUploadManagerTests { helper.addUploadRequestMock(auth: auth, location: location, type: .success) } - try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID) + try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID, progress: nil) if case let .uploadTask(request) = helper.capturedUploadRequests.last { #expect(request.url!.absoluteString == attempt2.fetchedUploadLocation) @@ -385,7 +385,7 @@ class AttachmentUploadManagerTests { helper.addUploadRequestMock(auth: auth, location: location, type: .success, completedCount: 20) } - try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID) + try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID, progress: nil) #expect(helper.mockSleepTimer.requestedDelays.count == 3) @@ -430,7 +430,7 @@ class AttachmentUploadManagerTests { helper.addUploadRequestMock(auth: auth, location: location, type: .success, completedCount: 20) } - try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID) + try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID, progress: nil) // Since these are network timeouts, and the remote endpoint is showing progress being made // there shouldn't be any backoff timers fired. @@ -462,7 +462,7 @@ class AttachmentUploadManagerTests { ) do { - try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID) + try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID, progress: nil) Issue.record("Should fail to upload!") } catch { // Success @@ -482,7 +482,7 @@ class AttachmentUploadManagerTests { ).attachment, ) - try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID) + try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID, progress: nil) #expect(helper.capturedRequests.isEmpty) } @@ -508,7 +508,7 @@ class AttachmentUploadManagerTests { helper.addUploadRequestMock(auth: auth, location: location, type: .success) } - _ = try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID) + _ = try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID, progress: nil) switch cdn { case .cdn2: @@ -578,7 +578,7 @@ class AttachmentUploadManagerTests { helper.addUploadRequestMock(auth: auth, location: location, type: .success) } - _ = try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID) + _ = try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID, progress: nil) switch cdn { case .cdn2: @@ -644,7 +644,7 @@ class AttachmentUploadManagerTests { helper.addUploadRequestMock(auth: auth, location: location, type: .success) } - _ = try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID) + _ = try await uploadManager.uploadTransitTierAttachment(attachmentId: attachmentID, progress: nil) switch cdn { case .cdn2: