Skip to content

Commit

Permalink
Simplify weather widget rendering logic
Browse files Browse the repository at this point in the history
  • Loading branch information
muesli committed Jun 10, 2021
1 parent aa48706 commit d3408c2
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions widget_weather.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,22 +162,14 @@ func (w *WeatherWidget) RequiresUpdate() bool {
// Update renders the widget.
func (w *WeatherWidget) Update(dev *streamdeck.Device) error {
go w.data.Fetch()
if !w.data.Ready() {
if w.data.response == "" {
// show the background image while we wait for initial data
return w.render(dev, nil)
}

return nil
}

cond, err := w.data.Condition()
if err != nil {
return err
return w.render(dev, nil)
}
temp, err := w.data.Temperature()
if err != nil {
return err
return w.render(dev, nil)
}

var iconName string
Expand Down

0 comments on commit d3408c2

Please sign in to comment.