Skip to content

Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.

C

fix: a lyrics source picked while the song's walk runs stays picked

My-Name-Is-Jeff6610ffc640fb
diff --git a/tweak/Sources/Shared/LyricsSources/LyricsPick.m b/tweak/Sources/Shared/LyricsSources/LyricsPick.m
index 4d398e52..e771b37b 100644
--- a/tweak/Sources/Shared/LyricsSources/LyricsPick.m
+++ b/tweak/Sources/Shared/LyricsSources/LyricsPick.m
@@ -135,6 +135,14 @@ void SGLyricsChooseSource(NSString *trackID, NSString *key) {
show(trackID, lyrics.provider, lyrics.karaokeLines);
}
+void SGLyricsNoteOrderChoice(NSString *trackID, SGLyricsResult *lyrics) {
+ SGLyricsAutomatic *automatic = sg_automatic[trackID];
+ if (!automatic || automatic.kept) return;
+ automatic.kept = lyrics;
+ automatic.credit = lyrics.provider;
+ automatic.lines = lyrics.karaokeLines;
+}
+
void SGLyricsChooseAutomatic(NSString *trackID) {
SGLyricsAutomatic *automatic = trackID ? sg_automatic[trackID] : nil;
if (!automatic) return;
diff --git a/tweak/Sources/Shared/LyricsSources/LyricsSources.h b/tweak/Sources/Shared/LyricsSources/LyricsSources.h
index fb14bf1f..177f2fb0 100644
--- a/tweak/Sources/Shared/LyricsSources/LyricsSources.h
+++ b/tweak/Sources/Shared/LyricsSources/LyricsSources.h
@@ -243,6 +243,8 @@ void SGLyricsOffers(NSString *trackID, NSTimeInterval wait, void (^done)(NSDicti
void SGLyricsChooseSource(NSString *trackID, NSString *key);
// Drops the track's pick and puts back what the order had chosen, shown before the first pick, the same way.
void SGLyricsChooseAutomatic(NSString *trackID);
+// A walk under way at the track's first pick has ended with `lyrics`: that is what Automatic puts back.
+void SGLyricsNoteOrderChoice(NSString *trackID, SGLyricsResult *lyrics);
extern NSNotificationName const SGLyricsSourceChosenNotification;
// LyricsSources.m, for LyricsPick.m: the query a walk would start with, and a picked answer kept as the walk's.
SGLyricsQuery *SGLyricsQueryFor(NSString *trackID);
diff --git a/tweak/Sources/Shared/LyricsSources/LyricsSources.m b/tweak/Sources/Shared/LyricsSources/LyricsSources.m
index 4f158128..996058ab 100644
--- a/tweak/Sources/Shared/LyricsSources/LyricsSources.m
+++ b/tweak/Sources/Shared/LyricsSources/LyricsSources.m
@@ -405,7 +405,13 @@ static void finish(SGLyricsWalk *walk) {
// server's 503 read as "no lyrics" hid a track's lyrics until Spotify was restarted.
BOOL everyoneAsked = !walk.passedOver.count;
BOOL failed = atomic_load(&sg_failures) != walk.failuresAtStart;
- if (lyrics || (everyoneAsked && !failed) || merged.instrumental) {
+ id picked = SGLyricsChosenSource(trackID) ? sg_kept[trackID] : nil;
+ if ([picked isKindOfClass:SGLyricsResult.class]) {
+ // A source was picked from the player's ⋯ while the walk ran: the pick stands, and the walk's answer
+ // is what Automatic puts back.
+ SGLyricsNoteOrderChoice(trackID, lyrics);
+ lyrics = picked;
+ } else if (lyrics || (everyoneAsked && !failed) || merged.instrumental) {
if (sg_kept.count >= kKeptTracks) [sg_kept removeAllObjects];
sg_kept[trackID] = lyrics ?: NSNull.null;
if (!lyrics) {