Remove progress: nil extensions
This commit is contained in:
parent
0142d39ef4
commit
035db65d68
@ -514,6 +514,7 @@ class BackupAttachmentUploadQueueRunnerImpl: BackupAttachmentUploadQueueRunner {
|
||||
localAci: localAci,
|
||||
backupKey: backupKey,
|
||||
auth: backupAuth,
|
||||
progress: nil,
|
||||
)
|
||||
}
|
||||
} catch let error {
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -103,6 +103,7 @@ private class IncomingContactSyncJobRunner: JobRunner {
|
||||
case .transient(let downloadMetadata):
|
||||
fileUrl = try await DependenciesBridge.shared.attachmentDownloadManager.downloadTransientAttachment(
|
||||
metadata: downloadMetadata,
|
||||
progress: nil,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -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,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -245,6 +245,7 @@ public class PreparedOutgoingMessage {
|
||||
return {
|
||||
try await DependenciesBridge.shared.attachmentUploadManager.uploadTransitTierAttachment(
|
||||
attachmentId: attachmentId,
|
||||
progress: nil,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,81 +56,6 @@ public protocol AttachmentUploadManager {
|
||||
) async throws
|
||||
}
|
||||
|
||||
extension AttachmentUploadManager {
|
||||
|
||||
public func uploadBackup(
|
||||
localUploadMetadata: Upload.EncryptedBackupUploadMetadata,
|
||||
form: Upload.Form,
|
||||
) async throws -> Upload.Result<Upload.EncryptedBackupUploadMetadata> {
|
||||
try await uploadBackup(
|
||||
localUploadMetadata: localUploadMetadata,
|
||||
form: form,
|
||||
progress: nil,
|
||||
)
|
||||
}
|
||||
|
||||
public func uploadTransientAttachment(
|
||||
dataSource: DataSourcePath,
|
||||
) async throws -> Upload.Result<Upload.LocalUploadMetadata> {
|
||||
try await uploadTransientAttachment(
|
||||
dataSource: dataSource,
|
||||
progress: nil,
|
||||
)
|
||||
}
|
||||
|
||||
public func uploadLinkNSyncAttachment(
|
||||
dataSource: DataSourcePath,
|
||||
) async throws -> Upload.Result<Upload.LinkNSyncUploadMetadata> {
|
||||
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
|
||||
|
||||
@ -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:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user