Fix compile: await LogStore calls from non-MainActor GiteaClient
Build iOS App / Build .ipa and publish source (push) Successful in 44s

LogStore is @MainActor; GiteaClient.request is not main-actor-isolated, so the
5 LogStore.shared.log calls in the request handler need 'await' under Swift 5
strict concurrency. Without them the build fails at compile time.
This commit is contained in:
Hermes
2026-08-12 19:51:32 +00:00
parent b51b2ee5c8
commit 58eb145717
+5 -5
View File
@@ -78,23 +78,23 @@ struct GiteaClient {
let (data, response) = try await session.data(for: req)
guard let http = response as? HTTPURLResponse else {
LogStore.shared.log(.error, "\(method) \(path) → invalid response")
await LogStore.shared.log(.error, "\(method) \(path) → invalid response")
throw APIError.invalidResponse
}
switch http.statusCode {
case 200...299:
LogStore.shared.log(.info, "\(method) \(path) → \(http.statusCode)")
await LogStore.shared.log(.info, "\(method) \(path) → \(http.statusCode)")
return data
case 401, 403:
LogStore.shared.log(.error, "\(method) \(path) → \(http.statusCode) unauthorized")
await LogStore.shared.log(.error, "\(method) \(path) → \(http.statusCode) unauthorized")
throw APIError.unauthorized
case 404:
LogStore.shared.log(.error, "\(method) \(path) → 404 not found")
await LogStore.shared.log(.error, "\(method) \(path) → 404 not found")
throw APIError.notFound
default:
let message = (try? Self.decoder.decode([String: String].self,
from: data))?["message"]
LogStore.shared.log(.error, "\(method) \(path) → \(http.statusCode) \(message ?? "")")
await LogStore.shared.log(.error, "\(method) \(path) → \(http.statusCode) \(message ?? "")")
throw APIError.httpStatus(http.statusCode, message)
}
}