iOS: Update theme colors for FilePreviewView and XtermWebView

This commit is contained in:
Peter Steinberger 2025-06-23 04:16:28 +02:00
parent a94883c891
commit c63da02a98
3 changed files with 24 additions and 11 deletions

View file

@ -14,17 +14,27 @@ struct FilePreviewView: View {
var body: some View {
NavigationStack {
ZStack {
Theme.Colors.background
Theme.Colors.terminalBackground
.ignoresSafeArea()
if isLoading {
ProgressView("Loading...")
.progressViewStyle(CircularProgressViewStyle(tint: Theme.Colors.primaryAccent))
} else if let error = error {
ErrorView(message: error) {
Task {
await loadPreview()
VStack {
Text("Error loading file")
.font(.headline)
.foregroundColor(Theme.Colors.errorAccent)
Text(error)
.font(.subheadline)
.foregroundColor(Theme.Colors.terminalForeground)
.multilineTextAlignment(.center)
Button("Retry") {
Task {
await loadPreview()
}
}
.terminalButton()
}
} else if let preview = preview {
previewContent(for: preview)
@ -213,7 +223,7 @@ struct GitDiffView: View {
var body: some View {
NavigationStack {
ZStack {
Theme.Colors.background
Theme.Colors.terminalBackground
.ignoresSafeArea()
DiffWebView(content: diff.diff)

View file

@ -597,7 +597,8 @@ struct TerminalHostingView: UIViewRepresentable {
if let line = terminalInstance.getLine(row: row) {
var lineText = ""
for col in 0..<terminalInstance.cols {
if let char = line.getChar(at: col) {
if col < line.count {
let char = line[col]
lineText += String(char.getCharacter())
}
}

View file

@ -295,7 +295,7 @@ struct XtermWebView: UIViewRepresentable {
case .output(_, let data):
writeToTerminal(data)
case .resize(_, let dimensions):
case .resize(_, _):
// Handle resize if needed
break
@ -343,9 +343,9 @@ struct XtermWebView: UIViewRepresentable {
// Convert theme to xterm.js format
let themeJS = """
{
background: '\(theme.backgroundColor.hex)',
foreground: '\(theme.textColor.hex)',
cursor: '\(theme.cursorColor.hex)',
background: '\(theme.background.hex)',
foreground: '\(theme.foreground.hex)',
cursor: '\(theme.cursor.hex)',
selection: 'rgba(255, 255, 255, 0.3)'
}
"""
@ -365,7 +365,8 @@ struct XtermWebView: UIViewRepresentable {
// MARK: - SSEClientDelegate
@MainActor
extension XtermWebView.Coordinator: SSEClientDelegate {
func sseClient(_ client: SSEClient, didReceiveEvent event: SSEClient.SSEEvent) {
nonisolated func sseClient(_ client: SSEClient, didReceiveEvent event: SSEClient.SSEEvent) {
Task { @MainActor in
switch event {
case .terminalOutput(_, let type, let data):
if type == "o" { // output
@ -376,6 +377,7 @@ extension XtermWebView.Coordinator: SSEClientDelegate {
case .error(let error):
print("[XtermWebView] SSE error: \(error)")
}
}
}
}