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:
+11
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user