feat: Add Share option for artists, albums, and tracks

This feature is only available on the Subsonic media provider. Using a
Jellyfin server will make Supersonic hide the "Share" option.

* Artists: Option available in grid view and in Artist view.
* Albums: Option available in grid view and in Album view.
* Tracks: Option available in tracklist, when a single track is selected.
This commit is contained in:
Michael Manganiello
2024-03-03 20:44:58 -03:00
parent ee0e18e118
commit 9d3725cb51
16 changed files with 174 additions and 6 deletions
+11 -1
View File
@@ -93,6 +93,7 @@ type GridViewState struct {
OnAddToQueue func(id string)
OnAddToPlaylist func(id string)
OnDownload func(id string)
OnShare func(id string)
OnShowItemPage func(id string)
OnShowSecondaryPage func(id string)
@@ -407,8 +408,17 @@ func (g *GridView) showContextMenu(card *GridViewItem, pos fyne.Position) {
}
})
download.Icon = theme.DownloadIcon()
menuItems := []*fyne.MenuItem{play, shuffle, queue, playlist, download}
g.menu = widget.NewPopUpMenu(fyne.NewMenu("", play, shuffle, queue, playlist, download),
if g.OnShare != nil {
share := fyne.NewMenuItem("Share...", func() {
g.OnShare(g.menuGridViewItemId)
})
share.Icon = myTheme.ShareIcon
menuItems = append(menuItems, share)
}
g.menu = widget.NewPopUpMenu(fyne.NewMenu("", menuItems...),
fyne.CurrentApp().Driver().CanvasForObject(g))
}
g.menu.ShowAtPosition(pos)