Clean code and add network timeout

This commit is contained in:
Christoph Hagen 2023-08-09 16:27:34 +02:00
parent f451715a11
commit e5ea8c4951
2 changed files with 1 additions and 4 deletions

View File

@ -40,6 +40,7 @@ final class Client {
var request = URLRequest(url: url) var request = URLRequest(url: url)
request.httpBody = data request.httpBody = data
request.httpMethod = "POST" request.httpMethod = "POST"
request.timeoutInterval = 10
return await requestAndDecode(request) return await requestAndDecode(request)
} }

View File

@ -54,23 +54,19 @@ struct HistoryListItem: View {
HStack { HStack {
if let roundTripText { if let roundTripText {
Image(systemSymbol: entry.usedLocalConnection ? .wifi : .network) Image(systemSymbol: entry.usedLocalConnection ? .wifi : .network)
//Image(systemSymbol: .arrowUpArrowDownCircle)
Text(roundTripText) Text(roundTripText)
.font(.subheadline) .font(.subheadline)
} }
//Spacer()
Image(systemSymbol: .personalhotspot) Image(systemSymbol: .personalhotspot)
Text(counterText) Text(counterText)
.font(.subheadline) .font(.subheadline)
if let timeOffsetText { if let timeOffsetText {
//Spacer()
Image(systemSymbol: .stopwatch) Image(systemSymbol: .stopwatch)
Text(timeOffsetText) Text(timeOffsetText)
.font(.subheadline) .font(.subheadline)
} }
}.foregroundColor(.secondary) }.foregroundColor(.secondary)
} }
//.padding()
} }
} }