mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2025-08-06 04:46:49 +02:00
Added an API to add & delete entries from the skippedArtists list in the settings. fixes [#405]
This commit is contained in:
@@ -159,3 +159,25 @@ export const hideSettingsWindow = function () {
|
||||
export const closeSettingsWindow = function () {
|
||||
settingsWindow = null;
|
||||
};
|
||||
|
||||
/**
|
||||
* add artists to the list of skipped artists
|
||||
* @param artists list of artists to append
|
||||
*/
|
||||
export const addSkippedArtists = (artists: string[]) => {
|
||||
const { skippedArtists } = settings;
|
||||
const previousStoreValue = settingsStore.get<string, string[]>(skippedArtists);
|
||||
settingsStore.set(skippedArtists, Array.from(new Set([...previousStoreValue, ...artists])));
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove artists from the list of skipped artists
|
||||
* @param artists list of artists to remove
|
||||
*/
|
||||
export const removeSkippedArtists = (artists: string[]) => {
|
||||
const { skippedArtists } = settings;
|
||||
const previousStoreValue = settingsStore.get<string, string[]>(skippedArtists);
|
||||
const filteredArtists = previousStoreValue.filter((value) => !artists.includes(value));
|
||||
|
||||
settingsStore.set(skippedArtists, filteredArtists);
|
||||
};
|
||||
|
Reference in New Issue
Block a user