Skip to content

Commit

Permalink
feat(lyrics-plus): remember song delay (#2068)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyrie25 authored Dec 25, 2022
1 parent 2b72c7a commit 2da867e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CustomApps/lyrics-plus/OptionsMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ const AdjustmentsMenu = react.memo(({ mode }) => {
onChange: (name, value) => {
CONFIG.visual[name] = value;
localStorage.setItem(`${APP_NAME}:visual:${name}`, value);
name === "delay" && localStorage.setItem(`lyrics-delay:${Spicetify.Player.data.track.uri}`, value);
lyricContainerUpdate && lyricContainerUpdate();
}
})
Expand Down
4 changes: 2 additions & 2 deletions CustomApps/lyrics-plus/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class LyricsContainer extends react.Component {
}

resetDelay() {
CONFIG.visual.delay = 0;
CONFIG.visual.delay = Number(localStorage.getItem(`lyrics-delay:${Spicetify.Player.data.track.uri}`)) || 0;
}

async onVersionChange(items, index) {
Expand Down Expand Up @@ -363,7 +363,7 @@ class LyricsContainer extends react.Component {
this.tryServices(nextInfo, this.state.explicitMode);
};

if (Spicetify.Player && Spicetify.Player.data && Spicetify.Player.data.track) {
if (Spicetify.Player?.data?.track) {
this.state.explicitMode = this.state.lockMode;
this.currentTrackUri = Spicetify.Player.data.track.uri;
this.fetchLyrics(Spicetify.Player.data.track, this.state.explicitMode);
Expand Down

0 comments on commit 2da867e

Please sign in to comment.