Add a helper to clear the header message after a delay.
(delay time.Duration)
| 183 | |
| 184 | // Add a helper to clear the header message after a delay. |
| 185 | func (h *Header) clearMessageAfterDelay(delay time.Duration) { |
| 186 | go func() { |
| 187 | time.Sleep(delay) |
| 188 | |
| 189 | if h.app != nil { |
| 190 | h.app.QueueUpdateDraw(func() { |
| 191 | // Avoid overriding an active loading indicator that may have started after ShowSuccess/ShowError |
| 192 | h.mu.Lock() |
| 193 | loading := h.isLoading |
| 194 | h.mu.Unlock() |
| 195 | if loading { |
| 196 | return |
| 197 | } |
| 198 | // Restore the current profile if it exists, otherwise reset to default |
| 199 | if h.currentProfile != "" { |
| 200 | h.restoreProfile() |
| 201 | } else { |
| 202 | h.SetText(appName) |
| 203 | } |
| 204 | }) |
| 205 | } |
| 206 | }() |
| 207 | } |
| 208 | |
| 209 | // animateLoading displays an animated loading indicator. |
| 210 | func (h *Header) animateLoading(ctx context.Context) { |
no test coverage detected