misc: Upgrade Go to v1.21
Upgrade to 1.21 as 1.20 is now unmaintained. Most changes are related to the new `slices` package from standard library, which can replace some existing custom functions.
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
package browsing
|
||||
|
||||
import (
|
||||
"slices"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"github.com/dweymouth/supersonic/backend"
|
||||
"github.com/dweymouth/supersonic/backend/mediaprovider"
|
||||
"github.com/dweymouth/supersonic/sharedutil"
|
||||
"github.com/dweymouth/supersonic/ui/controller"
|
||||
myTheme "github.com/dweymouth/supersonic/ui/theme"
|
||||
"github.com/dweymouth/supersonic/ui/util"
|
||||
@@ -37,7 +38,7 @@ func (a *albumsPageAdapter) Route() controller.Route { return controller.AlbumsR
|
||||
func (a *albumsPageAdapter) SortOrders() ([]string, string) {
|
||||
orders := a.mp.AlbumSortOrders()
|
||||
sortOrder := a.cfg.SortOrder
|
||||
if !sharedutil.SliceContains(orders, sortOrder) {
|
||||
if !slices.Contains(orders, sortOrder) {
|
||||
sortOrder = string(orders[0])
|
||||
}
|
||||
return orders, sortOrder
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"image"
|
||||
"log"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/dweymouth/supersonic/backend"
|
||||
@@ -106,13 +107,13 @@ func NewNowPlayingPage(
|
||||
}
|
||||
a.queueList.OnSetRating = func(trackIDs []string, rating int) {
|
||||
contr.SetTrackRatings(trackIDs, rating)
|
||||
if sharedutil.SliceContains(trackIDs, a.nowPlayingID) {
|
||||
if slices.Contains(trackIDs, a.nowPlayingID) {
|
||||
a.card.SetDisplayedRating(rating)
|
||||
}
|
||||
}
|
||||
a.queueList.OnSetFavorite = func(trackIDs []string, fav bool) {
|
||||
contr.SetTrackFavorites(trackIDs, fav)
|
||||
if sharedutil.SliceContains(trackIDs, a.nowPlayingID) {
|
||||
if slices.Contains(trackIDs, a.nowPlayingID) {
|
||||
a.card.SetDisplayedFavorite(fav)
|
||||
}
|
||||
}
|
||||
@@ -232,7 +233,7 @@ func (a *NowPlayingPage) Tapped(*fyne.PointEvent) {
|
||||
func (a *NowPlayingPage) doSetNewTrackOrder(trackIDs []string, op sharedutil.TrackReorderOp) {
|
||||
idxs := make([]int, 0, len(trackIDs))
|
||||
for i, tr := range a.queue {
|
||||
if sharedutil.SliceContains(trackIDs, tr.ID) {
|
||||
if slices.Contains(trackIDs, tr.ID) {
|
||||
idxs = append(idxs, i)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package browsing
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"slices"
|
||||
|
||||
"github.com/dweymouth/supersonic/backend"
|
||||
"github.com/dweymouth/supersonic/backend/mediaprovider"
|
||||
@@ -183,7 +184,7 @@ func (a *PlaylistPage) doSetNewTrackOrder(op sharedutil.TrackReorderOp) {
|
||||
ids := a.tracklist.SelectedTrackIDs()
|
||||
idxs := make([]int, 0, len(ids))
|
||||
for i, tr := range a.tracks {
|
||||
if sharedutil.SliceContains(ids, tr.ID) {
|
||||
if slices.Contains(ids, tr.ID) {
|
||||
idxs = append(idxs, i)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user