Skip to content

Commit

Permalink
fix: refreshing clearing read history
Browse files Browse the repository at this point in the history
  • Loading branch information
isabelroses committed Apr 19, 2024
1 parent e717634 commit 74b2345
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions cmd/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,25 +108,40 @@ func (m model) handleKeys(msg tea.KeyMsg) (model, tea.Cmd) {

case key.Matches(msg, m.keys.Refresh):
switch m.context {
case "search":
return m, nil

case "home":
id := m.table.Cursor()
feed := &m.feeds[id]
lib.FetchURL(feed.URL, false)
feed.Posts = lib.GetPosts(feed.URL)
err := error(nil)
m.feeds, err = m.feeds.ReadTracking()
if err != nil {
log.Fatal(err)
}
m = m.loadHome()

case "content":
feed := &m.feed
feed.Posts = lib.GetPosts(feed.URL)
err := error(nil)
m.feeds, err = m.feeds.ReadTracking()
if err != nil {
log.Fatal(err)
}
m = m.loadContent(m.feed.ID)

default:
return m, nil
}

case key.Matches(msg, m.keys.RefreshAll):
if m.context == "home" {
m.feeds = lib.GetAllContent(false)
err := error(nil)
m.feeds, err = m.feeds.ReadTracking()
if err != nil {
log.Fatal(err)
}
m = m.loadHome()
}

Expand Down

0 comments on commit 74b2345

Please sign in to comment.