Skip to content

Commit

Permalink
fix(wrapper): make the snackbar a priority (#2622)
Browse files Browse the repository at this point in the history
  • Loading branch information
rxri authored Oct 29, 2023
1 parent 77ce158 commit 84d0cf0
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions jsHelper/spicetifyWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,24 +449,25 @@ window.Spicetify = {
// Combine snackbar and notification
(function bindShowNotification() {
if (!Spicetify.Snackbar && !Spicetify.showNotification) {
setTimeout(bindShowNotification, 10);
setTimeout(bindShowNotification, 250);
return;
}

if (Spicetify.Snackbar?.enqueueSnackbar && !Spicetify.showNotification) {
if (Spicetify.Snackbar?.enqueueSnackbar) {
Spicetify.showNotification = (message, isError = false, msTimeout) => {
Spicetify.Snackbar.enqueueSnackbar(message, {
variant: isError ? "error" : "default",
autoHideDuration: msTimeout
});
};
} else {
if (!Spicetify.Snackbar) Spicetify.Snackbar = {};
Spicetify.Snackbar.enqueueSnackbar = (message, { variant = "default", autoHideDuration }) => {
isError = variant === "error";
Spicetify.showNotification(message, isError, autoHideDuration);
};
return;
}

if (!Spicetify.Snackbar) Spicetify.Snackbar = {};
Spicetify.Snackbar.enqueueSnackbar = (message, { variant = "default", autoHideDuration } = {}) => {
isError = variant === "error";
Spicetify.showNotification(message, isError, autoHideDuration);
};
})();

// Image color extractor
Expand Down

0 comments on commit 84d0cf0

Please sign in to comment.