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: Follow the cover repaints shuffle and repeat on the next cover

My-Name-Is-Jeffe0a910a89ec6
diff --git a/tweak/Sources/Redesigned/Player/PlayerCoverAccent.x b/tweak/Sources/Redesigned/Player/PlayerCoverAccent.x
index a305e330..28c91cbb 100644
--- a/tweak/Sources/Redesigned/Player/PlayerCoverAccent.x
+++ b/tweak/Sources/Redesigned/Player/PlayerCoverAccent.x
@@ -14,7 +14,7 @@
static NSInteger sg_cover = -1; // 0xRRGGBB while a cover gives one, else -1
static __weak UIView *sg_stack; // the bottom stack last painted
-static char kOriginalKey, kTintedKey, kAccentImageKey, kOriginalFillKey, kOriginalStrokeKey;
+static char kOriginalKey, kTintedKey, kTintedCoverKey, kAccentImageKey, kOriginalFillKey, kOriginalStrokeKey;
BOOL SGRPlayerFollowsCover(void) {
static BOOL on;
@@ -98,10 +98,12 @@ static void paintImageView(UIImageView *view) {
objc_setAssociatedObject(view, &kTintedKey, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
return;
}
- if (image == tinted && tinted) return;
+ // A tint made for an earlier cover is drawn again in this one; Spotify's icons only change on a state change.
+ if (image == tinted && tinted && [objc_getAssociatedObject(view, &kTintedCoverKey) integerValue] == sg_cover) return;
UIImage *made = [original imageWithTintColor:coverColor() renderingMode:UIImageRenderingModeAlwaysOriginal];
objc_setAssociatedObject(view, &kOriginalKey, original, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
objc_setAssociatedObject(view, &kTintedKey, made, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+ objc_setAssociatedObject(view, &kTintedCoverKey, @(sg_cover), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
view.image = made;
}