diff --git a/internal/app/app.go b/internal/app/app.go index 0f98a8383124274d8aaae12b40146411ed969c8d..96750a453e63c79b7363fef5b3aa9b09632de940 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -40,6 +40,13 @@ import ( "github.com/charmbracelet/x/term" ) +// UpdateAvailableMsg is sent when a new version is available. +type UpdateAvailableMsg struct { + CurrentVersion string + LatestVersion string + IsDevelopment bool +} + type App struct { Sessions session.Service Messages message.Service @@ -452,7 +459,7 @@ func (app *App) checkForUpdates(ctx context.Context) { if err != nil || !info.Available() { return } - app.events <- pubsub.UpdateAvailableMsg{ + app.events <- UpdateAvailableMsg{ CurrentVersion: info.Current, LatestVersion: info.Latest, IsDevelopment: info.IsDevelopment(), diff --git a/internal/pubsub/events.go b/internal/pubsub/events.go index 016cc10c9f8a51039ce9eeda6210f5f59bdc1e6c..827158d52fd671aeda828c0383fce98850e27fc7 100644 --- a/internal/pubsub/events.go +++ b/internal/pubsub/events.go @@ -26,10 +26,3 @@ type ( Publish(EventType, T) } ) - -// UpdateAvailableMsg is sent when a new version is available. -type UpdateAvailableMsg struct { - CurrentVersion string - LatestVersion string - IsDevelopment bool -} diff --git a/internal/tui/tui.go b/internal/tui/tui.go index e91fae5592b8d51963e524d0662d868cbfed6869..519b0e6aca73fb276d4137e00830b29798a391c7 100644 --- a/internal/tui/tui.go +++ b/internal/tui/tui.go @@ -385,7 +385,7 @@ func (a *appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } return a, tea.Batch(cmds...) // Update Available - case pubsub.UpdateAvailableMsg: + case app.UpdateAvailableMsg: // Show update notification in status bar statusMsg := fmt.Sprintf("Crush update available: v%s → v%s.", msg.CurrentVersion, msg.LatestVersion) if msg.IsDevelopment {