This commit is contained in:
Max Goedjen
2021-12-11 23:06:24 -08:00
parent 27f0b9b5b0
commit ef691b5170
2 changed files with 22 additions and 3 deletions

View File

@@ -45,8 +45,27 @@ public class Updater: ObservableObject, UpdaterProtocol {
}
@available(macOS, deprecated: 12)
extension URLSession {
// Backport for macOS 11
func data(from url: URL, delegate: URLSessionTaskDelegate? = nil) async throws -> (Data, URLResponse) {
try await withCheckedThrowingContinuation { continuation in
URLSession.shared.dataTask(with: url) { data, response, error in
guard let data = data, let response = response else {
continuation.resume(throwing: error ?? NSError(domain: NSURLErrorDomain, code: NSURLErrorUnknown, userInfo: nil))
return
}
continuation.resume(returning: (data, response))
}
}
}
}
extension Updater {
@MainActor func evaluate(releases: [Release]) {
guard let release = releases
.sorted()