diff --git a/Package.swift b/Package.swift index 0c2f207..4515c73 100644 --- a/Package.swift +++ b/Package.swift @@ -14,7 +14,7 @@ let package = Package( .package(url: "https://github.com/vapor/vapor.git", from: "4.102.0"), .package(url: "https://github.com/vapor/fluent.git", from: "4.11.0"), .package(url: "https://github.com/vapor/apns.git", from: "4.1.0"), - .package(url: "https://github.com/marmelroy/Zip.git", from: "2.1.2"), + .package(url: "https://github.com/weichsel/ZIPFoundation.git", from: "0.9.19"), // used in tests .package(url: "https://github.com/vapor/fluent-sqlite-driver.git", from: "4.7.4"), ], @@ -25,7 +25,7 @@ let package = Package( .product(name: "Fluent", package: "fluent"), .product(name: "Vapor", package: "vapor"), .product(name: "VaporAPNS", package: "apns"), - .product(name: "Zip", package: "zip"), + .product(name: "ZIPFoundation", package: "zipfoundation"), ], swiftSettings: swiftSettings ), diff --git a/Sources/Orders/OrdersServiceCustom.swift b/Sources/Orders/OrdersServiceCustom.swift index 61e802d..526f33a 100644 --- a/Sources/Orders/OrdersServiceCustom.swift +++ b/Sources/Orders/OrdersServiceCustom.swift @@ -12,7 +12,7 @@ import APNSCore import Fluent import NIOSSL import PassKit -import Zip +import ZIPFoundation /// Class to handle ``OrdersService``. /// @@ -418,6 +418,11 @@ extension OrdersServiceCustom { try Self.generateManifestFile(using: encoder, in: root) try self.generateSignatureFile(in: root) - return try Data(contentsOf: Zip.quickZipFiles([root], fileName: "\(UUID().uuidString).order")) + + let zipFile = tmp.appendingPathComponent("\(UUID().uuidString).order") + try FileManager.default.zipItem(at: root, to: zipFile, shouldKeepParent: false) + defer { _ = try? FileManager.default.removeItem(at: zipFile) } + + return try Data(contentsOf: zipFile) } } diff --git a/Sources/Passes/PassesServiceCustom.swift b/Sources/Passes/PassesServiceCustom.swift index ef69aac..9db604a 100644 --- a/Sources/Passes/PassesServiceCustom.swift +++ b/Sources/Passes/PassesServiceCustom.swift @@ -12,7 +12,7 @@ import APNSCore import Fluent import NIOSSL import PassKit -import Zip +import ZIPFoundation /// Class to handle ``PassesService``. /// @@ -494,7 +494,12 @@ extension PassesServiceCustom { try Self.generateManifestFile(using: encoder, in: root) try self.generateSignatureFile(in: root) - return try Data(contentsOf: Zip.quickZipFiles([root], fileName: "\(UUID().uuidString).pkpass")) + + let zipFile = tmp.appendingPathComponent("\(UUID().uuidString).pkpass") + try FileManager.default.zipItem(at: root, to: zipFile, shouldKeepParent: false) + defer { _ = try? FileManager.default.removeItem(at: zipFile) } + + return try Data(contentsOf: zipFile) } /// Generates a bundle of passes to enable your user to download multiple passes at once. @@ -522,6 +527,10 @@ extension PassesServiceCustom { .write(to: root.appendingPathComponent("pass\(i).pkpass")) } - return try Data(contentsOf: Zip.quickZipFiles([root], fileName: "\(UUID().uuidString).pkpasses")) + let zipFile = tmp.appendingPathComponent("\(UUID().uuidString).pkpasses") + try FileManager.default.zipItem(at: root, to: zipFile, shouldKeepParent: false) + defer { _ = try? FileManager.default.removeItem(at: zipFile) } + + return try Data(contentsOf: zipFile) } }