ref: 4e2bd9a95dc4ac1e4eb7424651d4b28e28c254b1
parent: dc12017f82c0df2d816a36c78546188976d120cf
author: penny <penny@limitedideas.org>
date: Wed Sep 24 14:10:13 EDT 2025
use API dispatcher in Load()
--- a/pages.go
+++ b/pages.go
@@ -23,17 +23,30 @@
page *mastodon.Pagination
}
+type StatusPages struct {+ hc *Hellclient
+ page *mastodon.Pagination
+}
+
type PageItem struct {itemtext string
lines int
}
+func (statusData *StatusPages) Load(limit int) *[]PageItem {+ return nil
+}
+
func (noticeData *NotificationPages) Load(limit int) *[]PageItem { if noticeData.page == nil { noticeData.page = &mastodon.Pagination{}}
noticeData.page.Limit = int64(limit)
- notices, err := noticeData.hc.client.GetNotifications(context.Background(), noticeData.page)
+ var notices []*mastodon.Notification
+ var err error
+ getnotifs := func(job *GenericJob){notices, err = noticeData.hc.client.GetNotifications(context.Background(), noticeData.page)}+ notifjob := noticeData.hc.dispatchFunc(getnotifs)
+ notifjob.Wait()
if err != nil { fmt.Printf("Error getting notification page: %s\n", err)}
@@ -49,9 +62,7 @@
return &itemArray
}
-
-func (page *Page) String() string {- var sb strings.Builder
+func (page *Page) Buffer() { if page.itembuffer == nil { page.itembuffer = &[]PageItem{}}
@@ -59,6 +70,11 @@
*page.itembuffer = append(*page.itembuffer, *page.loader.Load(20)...)
}
+}
+
+func (page *Page) String() string {+ var sb strings.Builder
+ page.Buffer()
var items []PageItem
if len(*page.itembuffer) >= page.index {items = (*page.itembuffer)[page.index:]
@@ -79,7 +95,9 @@
}
func (page *Page) Prev() {- page.index = page.index - 5
+ if(page.index -5 ) >= 0 {+ page.index = page.index - 5
+ }
}
func (page *Page) Current() int {--
⑨