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: the lock screen's progress bar no longer jumps back when lock screen lyrics let a line go

My-Name-Is-Jeff57c099feb443
diff --git a/tweak/Sources/Shared/LockScreenLyrics/LockScreenLyrics.x b/tweak/Sources/Shared/LockScreenLyrics/LockScreenLyrics.x
index c7a906e9..4add156c 100644
--- a/tweak/Sources/Shared/LockScreenLyrics/LockScreenLyrics.x
+++ b/tweak/Sources/Shared/LockScreenLyrics/LockScreenLyrics.x
@@ -85,9 +85,12 @@ static NSString *lineFor(NSDictionary *info, double elapsed) {
return shown;
}
+// Spotify's info with the line in place of the artist, or its own artist for nil. The clock always moves
+// on to `elapsed`: the system takes the elapsed time as now's, so the one Spotify reported a while ago
+// would pull the progress bar back.
static NSDictionary *withLine(NSDictionary *info, NSString *line, double elapsed) {
NSMutableDictionary *shown = [info mutableCopy];
- shown[MPMediaItemPropertyArtist] = line;
+ if (line) shown[MPMediaItemPropertyArtist] = line;
shown[MPNowPlayingInfoPropertyElapsedPlaybackTime] = @(elapsed);
return shown;
}
@@ -106,7 +109,7 @@ static void tick(void) {
if (line == sg_shownLine || [line isEqualToString:sg_shownLine]) return;
sg_shownLine = line;
sg_resending = YES;
- MPNowPlayingInfoCenter.defaultCenter.nowPlayingInfo = line ? withLine(info, line, elapsed) : info;
+ MPNowPlayingInfoCenter.defaultCenter.nowPlayingInfo = withLine(info, line, elapsed);
sg_resending = NO;
}
@@ -154,7 +157,7 @@ static BOOL playingBy(NSDictionary *info) {
double elapsed = elapsedAt(info, now, now);
NSString *line = lineFor(info, elapsed);
sg_shownLine = line;
- %orig(line ? withLine(info, line, elapsed) : info);
+ %orig(withLine(info, line, elapsed));
}
- (NSDictionary *)nowPlayingInfo {