Skip to content

Commit

Permalink
Pass optional scheduler to attachment downloader convenience method
Browse files Browse the repository at this point in the history
  • Loading branch information
mvasilak committed Sep 9, 2024
1 parent 4e4babd commit 2716d6b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,9 @@ final class AttachmentDownloader: NSObject {
}
}

func downloadIfNeeded(attachment: Attachment, parentKey: String?, completion: @escaping (Result<(), Swift.Error>) -> Void) {
func downloadIfNeeded(attachment: Attachment, parentKey: String?, scheduler: SchedulerType = MainScheduler.instance, completion: @escaping (Result<(), Swift.Error>) -> Void) {
observable
.observe(on: MainScheduler.instance)
.observe(on: scheduler)
.subscribe(onNext: { [weak self] update in
guard let self, update.libraryId == attachment.libraryId && update.key == attachment.key else { return }
switch update.kind {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class UploadFixSyncAction: SyncAction {
subscriber(.failure(Error.expired))
return Disposables.create()
}
self.attachmentDownloader.downloadIfNeeded(attachment: attachment, parentKey: nil) { result in
self.attachmentDownloader.downloadIfNeeded(attachment: attachment, parentKey: nil, scheduler: scheduler) { result in
switch result {
case .success:
subscriber(.success(()))
Expand Down

0 comments on commit 2716d6b

Please sign in to comment.