iOS: Add @MainActor to SSEClient.start() and update SystemLogsView theme

This commit is contained in:
Peter Steinberger 2025-06-23 04:12:46 +02:00
parent 10fcf79884
commit 892737e9a3
2 changed files with 15 additions and 4 deletions

View file

@ -31,6 +31,7 @@ final class SSEClient: NSObject, @unchecked Sendable {
self.session = URLSession(configuration: configuration, delegate: self, delegateQueue: .main)
}
@MainActor
func start() {
var request = URLRequest(url: url)
request.setValue("text/event-stream", forHTTPHeaderField: "Accept")

View file

@ -80,7 +80,7 @@ struct SystemLogsView: View {
var body: some View {
NavigationStack {
ZStack {
Theme.Colors.background
Theme.Colors.terminalBackground
.ignoresSafeArea()
VStack(spacing: 0) {
@ -96,10 +96,20 @@ struct SystemLogsView: View {
.progressViewStyle(CircularProgressViewStyle(tint: Theme.Colors.primaryAccent))
.frame(maxWidth: .infinity, maxHeight: .infinity)
} else if let error = error {
ErrorView(message: error) {
Task {
await loadLogs()
VStack {
Text("Error loading logs")
.font(.headline)
.foregroundColor(Theme.Colors.errorAccent)
Text(error)
.font(.subheadline)
.foregroundColor(Theme.Colors.terminalForeground)
.multilineTextAlignment(.center)
Button("Retry") {
Task {
await loadLogs()
}
}
.terminalButton()
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
} else {