chore: updated styles
fce1a96a
1 file(s) · +12 −8
| 55 | 55 | .foregroundColor(canGoBack && !isLoading ? .orange : .gray.opacity(0.4)) |
|
| 56 | 56 | } |
|
| 57 | 57 | .disabled(!canGoBack || isLoading) |
|
| 58 | + | .padding(.trailing, 8) |
|
| 58 | 59 | ||
| 59 | 60 | Button(action: goForward) { |
|
| 60 | 61 | Image(systemName: "chevron.right") |
|
| 62 | 63 | .foregroundColor(canGoForward && !isLoading ? .orange : .gray.opacity(0.4)) |
|
| 63 | 64 | } |
|
| 64 | 65 | .disabled(!canGoForward || isLoading) |
|
| 66 | + | ||
| 65 | 67 | ||
| 66 | 68 | ZStack(alignment: .trailing) { |
|
| 67 | 69 | TextField("Enter Gemini URL", text: $urlText) |
|
| 142 | 144 | } |
|
| 143 | 145 | } |
|
| 144 | 146 | ||
| 145 | - | if historyIndex < history.count - 1 { |
|
| 146 | - | history = Array(history.prefix(historyIndex + 1)) |
|
| 147 | - | } |
|
| 148 | - | ||
| 149 | 147 | urlText = url |
|
| 150 | 148 | fetchContent(addToHistory: true) |
|
| 151 | 149 | } |
|
| 178 | 176 | case .success: |
|
| 179 | 177 | let mimeType = response.meta |
|
| 180 | 178 | ||
| 179 | + | // Add to history on successful navigation (before showing content) |
|
| 180 | + | if addToHistory { |
|
| 181 | + | // Truncate forward history when navigating to a new page |
|
| 182 | + | if historyIndex < history.count - 1 { |
|
| 183 | + | history = Array(history.prefix(historyIndex + 1)) |
|
| 184 | + | } |
|
| 185 | + | history.append(finalURL) |
|
| 186 | + | historyIndex = history.count - 1 |
|
| 187 | + | } |
|
| 188 | + | ||
| 181 | 189 | if MediaType.isMediaContent(mimeType) { |
|
| 182 | 190 | // Handle media content (images, audio) |
|
| 183 | 191 | if let body = response.body { |
|
| 193 | 201 | } else { |
|
| 194 | 202 | // Handle text content (text/gemini, text/plain, etc.) |
|
| 195 | 203 | responseText = response.bodyText ?? "(empty response)" |
|
| 196 | - | if addToHistory { |
|
| 197 | - | history.append(finalURL) |
|
| 198 | - | historyIndex = history.count - 1 |
|
| 199 | - | } |
|
| 200 | 204 | } |
|
| 201 | 205 | case .input: |
|
| 202 | 206 | pendingInputURL = finalURL |
|