save only page state in history and reconstruct page UI

This commit is contained in:
Drew Weymouth
2023-01-09 20:24:15 -08:00
parent 1d27b70a6f
commit 78862f6bf0
8 changed files with 215 additions and 29 deletions
+20
View File
@@ -57,6 +57,15 @@ func (a *ArtistPage) Reload() {
a.loadAsync()
}
func (a *ArtistPage) Save() SavedPage {
return &savedArtistPage{
artistID: a.artistID,
sm: a.sm,
im: a.im,
nav: a.nav,
}
}
func (a *ArtistPage) onPlayAlbum(albumID string) {
if a.OnPlayAlbum != nil {
a.OnPlayAlbum(albumID, 0)
@@ -88,3 +97,14 @@ func (a *ArtistPage) CreateRenderer() fyne.WidgetRenderer {
a.ExtendBaseWidget(a)
return widget.NewSimpleRenderer(a.container)
}
type savedArtistPage struct {
artistID string
sm *backend.ServerManager
im *backend.ImageManager
nav func(Route)
}
func (s *savedArtistPage) Restore() Page {
return NewArtistPage(s.artistID, s.sm, s.im, s.nav)
}