* * @param {string[]} uris
(uris)
| 309 | * @param {string[]} uris |
| 310 | */ |
| 311 | function toggleThrow(uris) { |
| 312 | const uri = uris[0]; |
| 313 | const uriObj = Spicetify.URI.fromString(uri); |
| 314 | const type = uriObj.type; |
| 315 | |
| 316 | const list = type === Spicetify.URI.Type.TRACK ? trashSongList : trashArtistList; |
| 317 | |
| 318 | if (!list[uri]) { |
| 319 | list[uri] = true; |
| 320 | if (shouldSkipCurrentTrack(uri, type)) Spicetify.Player.next(); |
| 321 | Spicetify.Player.data?.item.uri === uri && setWidgetState(true); |
| 322 | Spicetify.showNotification(type === Spicetify.URI.Type.TRACK ? "Song added to trashbin" : "Artist added to trashbin"); |
| 323 | } else { |
| 324 | delete list[uri]; |
| 325 | Spicetify.Player.data?.item.uri === uri && setWidgetState(false); |
| 326 | Spicetify.showNotification(type === Spicetify.URI.Type.TRACK ? "Song removed from trashbin" : "Artist removed from trashbin"); |
| 327 | } |
| 328 | |
| 329 | putDataLocal(); |
| 330 | } |
| 331 | |
| 332 | /** |
| 333 | * Only accept one track or artist URI |
nothing calls this directly
no test coverage detected