Dismiss function
This commit is contained in:
@@ -102,6 +102,7 @@ func main() {
|
||||
}
|
||||
|
||||
postsPath := filepath.Join(cfgDir, "posts.json")
|
||||
dismissedPath := filepath.Join(cfgDir, "dismissed.json")
|
||||
|
||||
st, err := state.Load(statePath)
|
||||
if err != nil {
|
||||
@@ -115,6 +116,12 @@ func main() {
|
||||
ps, _ = store.Load(postsPath)
|
||||
}
|
||||
|
||||
ds, err := store.LoadDismissed(dismissedPath)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Warning: could not load dismissed file: %v\n", err)
|
||||
ds, _ = store.LoadDismissed(dismissedPath)
|
||||
}
|
||||
|
||||
// Build API clients — nil if credentials are missing
|
||||
var twClient *twitter.Client
|
||||
if cfg.HasTwitterRead() {
|
||||
@@ -166,7 +173,7 @@ func main() {
|
||||
)
|
||||
}
|
||||
|
||||
model := ui.New(cfg, st, ps, f, cl, poster, liPoster)
|
||||
model := ui.New(cfg, st, ps, ds, f, cl, poster, liPoster)
|
||||
|
||||
p := tea.NewProgram(model, tea.WithAltScreen(), tea.WithMouseCellMotion())
|
||||
if _, err := p.Run(); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user