Skip to content

Commit ecc11f9

Browse files
committed
clean up unused variable
1 parent 477e10a commit ecc11f9

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

Sources/Hub/Downloader.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import Combine
1212
class Downloader: NSObject, ObservableObject {
1313
private(set) var destination: URL
1414

15+
private let chunkSize = 10 * 1024 * 1024 // 10MB
16+
1517
enum DownloadState {
1618
case notStarted
1719
case downloading(Double)
@@ -29,7 +31,17 @@ class Downloader: NSObject, ObservableObject {
2931

3032
private var urlSession: URLSession? = nil
3133

32-
init(from url: URL, to destination: URL, using authToken: String? = nil, inBackground: Bool = false) {
34+
init(
35+
from url: URL,
36+
to destination: URL,
37+
using authToken: String? = nil,
38+
inBackground: Bool = false,
39+
resumeSize: Int = 0,
40+
headers: [String: String]? = nil,
41+
expectedSize: Int? = nil,
42+
timeout: TimeInterval = 10,
43+
numRetries: Int = 5
44+
) {
3345
self.destination = destination
3446
super.init()
3547
let sessionIdentifier = "swift-transformers.hub.downloader"

Sources/Hub/HubApi.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ public extension HubApi {
396396
try prepareDestination()
397397
try prepareMetadataDestination()
398398

399-
let downloader = Downloader(from: source, to: destination, using: hfToken, inBackground: backgroundSession)
399+
let downloader = Downloader(from: source, to: destination, using: hfToken, inBackground: backgroundSession, expectedSize: remoteSize)
400400
let downloadSubscriber = downloader.downloadState.sink { state in
401401
if case .downloading(let progress) = state {
402402
progressHandler(progress)

Tests/HubTests/DownloaderTests.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ final class DownloaderTests: XCTestCase {
4646

4747
let downloader = Downloader(
4848
from: url,
49-
to: destination,
50-
metadataDirURL: tempDir
49+
to: destination
5150
)
5251

5352
// Store subscriber outside the continuation to maintain its lifecycle
@@ -84,7 +83,6 @@ final class DownloaderTests: XCTestCase {
8483
let downloader = Downloader(
8584
from: url,
8685
to: destination,
87-
metadataDirURL: tempDir,
8886
expectedSize: 999999 // Incorrect size
8987
)
9088

@@ -110,7 +108,6 @@ final class DownloaderTests: XCTestCase {
110108
let downloader = Downloader(
111109
from: url,
112110
to: destination,
113-
metadataDirURL: tempDir,
114111
expectedSize: 73194001
115112
)
116113
var threshold = 0.5

0 commit comments

Comments
 (0)