Skip to content

Commit

Permalink
Merge pull request #20 from internxt/feature/debug-network-requests
Browse files Browse the repository at this point in the history
Add debug mode to Network facade functions
  • Loading branch information
PixoDev authored Jun 20, 2024
2 parents d45590c + 589a7d4 commit 1bbfcaa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public struct NetworkFacade {
fileKey: [UInt8],
iv: [UInt8],
bucketId: String,
progressHandler: @escaping ProgressHandler
progressHandler: @escaping ProgressHandler,
debug: Bool = false
) async throws -> FinishUploadResponse {
guard let encryptedOutputStream = OutputStream(url: encryptedOutput, append: true) else {
throw NetworkFacadeError.FailedToOpenEncryptOutputStream
Expand Down Expand Up @@ -185,7 +186,7 @@ public struct NetworkFacade {
return finishUpload
}

public func downloadFile(bucketId: String, fileId: String, encryptedFileDestination: URL, destinationURL: URL, progressHandler: @escaping ProgressHandler) async throws -> URL {
public func downloadFile(bucketId: String, fileId: String, encryptedFileDestination: URL, destinationURL: URL, progressHandler: @escaping ProgressHandler, debug: Bool = false) async throws -> URL {

func downloadProgressHandler(downloadProgress: Double) {
let downloadMaxProgress = 0.9;
Expand All @@ -198,7 +199,8 @@ public struct NetworkFacade {
bucketId:bucketId,
fileId: fileId,
destination: encryptedFileDestination,
progressHandler: downloadProgressHandler
progressHandler: downloadProgressHandler,
debug: debug
)


Expand Down
2 changes: 1 addition & 1 deletion Sources/InternxtSwiftCore/Services/Network/Upload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class Upload: NSObject {
}


func start(index: [UInt8], bucketId: String, mnemonic: String, encryptedFileURL: URL, debug: Bool = false, progressHandler: ProgressHandler? = nil) async throws -> FinishUploadResponse {
func start(index: [UInt8], bucketId: String, mnemonic: String, encryptedFileURL: URL, progressHandler: ProgressHandler? = nil, debug: Bool = false) async throws -> FinishUploadResponse {
let source = encryptedFileURL

let fileSize = source.fileSize
Expand Down

0 comments on commit 1bbfcaa

Please sign in to comment.