Skip to content

Commit 38774f0

Browse files
committed
fixing Linux builds
1 parent 8740219 commit 38774f0

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

Sources/BushelCloudKit/DataSources/AppleDB/SignedStatus.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ enum SignedStatus: Codable {
3636
case all(Bool) // true = all devices signed
3737
case none // Empty array = not signed
3838

39-
init(from decoder: Decoder) throws {
39+
init(from decoder: any Decoder) throws {
4040
let container = try decoder.singleValueContainer()
4141

4242
// Try decoding as array first
@@ -57,7 +57,7 @@ enum SignedStatus: Codable {
5757
}
5858
}
5959

60-
func encode(to encoder: Encoder) throws {
60+
func encode(to encoder: any Encoder) throws {
6161
var container = encoder.singleValueContainer()
6262
switch self {
6363
case .devices(let devices):

Sources/BushelCloudKit/DataSources/IPSWFetcher.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,23 @@ import IPSWDownloads
3434
import OpenAPIURLSession
3535
import OSVer
3636

37+
#if canImport(FoundationNetworking)
38+
import FoundationNetworking
39+
#endif
40+
3741
/// Fetcher for macOS restore images using the IPSWDownloads package
3842
struct IPSWFetcher: DataSourceFetcher, Sendable {
3943
typealias Record = [RestoreImageRecord]
4044
/// Fetch all VirtualMac2,1 restore images from ipsw.me
4145
func fetch() async throws -> [RestoreImageRecord] {
4246
// Fetch Last-Modified header to know when ipsw.me data was updated
4347
let ipswURL = URL(string: "https://api.ipsw.me/v4/device/VirtualMac2,1?type=ipsw")!
44-
let lastModified = await URLSession.shared.fetchLastModified(from: ipswURL)
48+
let lastModified: Date?
49+
#if canImport(FoundationNetworking)
50+
// Use FoundationNetworking.URLSession directly on Apple platforms
51+
let URLSession = FoundationNetworking.URLSession.self
52+
#endif
53+
lastModified = await URLSession.shared.fetchLastModified(from: ipswURL)
4554

4655
// Create IPSWDownloads client with URLSession transport
4756
let client = IPSWDownloads(

Sources/BushelCloudKit/DataSources/TheAppleWiki/TheAppleWikiFetcher.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ import BushelFoundation
3131
import BushelUtilities
3232
import Foundation
3333

34+
#if canImport(FoundationNetworking)
35+
import FoundationNetworking
36+
#endif
37+
3438
/// Fetcher for macOS restore images using TheAppleWiki.com
3539
@available(
3640
*, deprecated, message: "Use AppleDBFetcher instead for more reliable and up-to-date data"
@@ -42,7 +46,13 @@ internal struct TheAppleWikiFetcher: DataSourceFetcher, Sendable {
4246
// Fetch Last-Modified header from TheAppleWiki API
4347
let apiURL = URL(
4448
string: "https://theapplewiki.com/api.php?action=parse&page=Firmware/Mac&format=json")!
45-
let lastModified = await URLSession.shared.fetchLastModified(from: apiURL)
49+
50+
let lastModified: Date
51+
#if canImport(FoundationNetworking)
52+
// Use FoundationNetworking.URLSession directly on Apple platforms
53+
let URLSession = FoundationNetworking.URLSession.self
54+
#endif
55+
lastModified = await URLSession.shared.fetchLastModified(from: apiURL) ?? Date()
4656

4757
let parser = IPSWParser()
4858

0 commit comments

Comments
 (0)