Skip to content

Commit

Permalink
Comment out extractCborBlocks; simplify CBOR print
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterJ93 committed May 16, 2024
1 parent 91d6f1b commit 6eefe7b
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions Sources/ATProtoKit/Utilities/ATCBORManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ public class ATCBORManager {

do {
let items = try decodeItems(from: data)
if let cborBlocks = extractCborBlocks(from: items) {
print("Decoded CBOR:", cborBlocks)
}
// if let cborBlocks = extractCborBlocks(from: items) {
// print("Decoded CBOR:", cborBlocks)
// }
print("Decoded CBOR: \(items)")
} catch {
print("Failed to decode CBOR: \(error)")
}
Expand All @@ -66,18 +67,18 @@ public class ATCBORManager {
return decoded
}

/// <#Description#>
///
/// - Parameter items: <#items description#>
/// - Returns: <#description#>
private func extractCborBlocks(from items: [CBOR]) -> [UInt8]? {
guard let payload = items.last,
let cborBlocks = payload["blocks"],
case .byteString(let array) = cborBlocks else {
return nil
}
return array
}
// /// Extracts a CBOR block for the purpose of decoding.
// ///
// /// - Parameter items: An array of `CBOR` objects.
// /// - Returns: An array of `UInt8` objects.
// private func extractCborBlocks(from items: [CBOR]) -> [UInt8]? {
// guard let payload = items.last,
// let cborBlocks = payload["blocks"],
// case .byteString(let array) = cborBlocks else {
// return nil
// }
// return array
// }

/// A delegate that runs when a CBOR object is decoded.
public typealias OnCarDecoded = (CarProgressStatusEvent) -> Void
Expand Down

0 comments on commit 6eefe7b

Please sign in to comment.