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

feat: save on someone else's playlist turns into download once it is saved

My-Name-Is-Jeffaef453e8424b
diff --git a/harness/playlist/README.md b/harness/playlist/README.md
index e8486475..6ac75e58 100644
--- a/harness/playlist/README.md
+++ b/harness/playlist/README.md
@@ -34,6 +34,12 @@ subview of HeaderActionsRow, which lays out nothing above the row. At 3 s the lo
right: "Like" once `PlaylistHeader.x` watches the row, "Download" before it did (issue #19). The scripted states
from 4 s on lay the header out and would hide the difference, so read it before then.
+`other saved` gives save the Encore object behind it (`../download-mock.h`), so the redesign can read whether the
+playlist is saved, and plays save turning into download. Each change is heard through the header controller's
+`-update`, with nothing laid out, as on the phone. The log reads, on Play's right: "Save to Your Library" at 2 s,
+"Download" once saved, "Save to Your Library" once removed, and "Remove from Your Library" (save's checkmark) when
+it is saved again with Spotify's download button disabled, as for an account that cannot download.
+
`mix` on the launch line builds a playlist Spotify makes (Indie Rock Mix), from `trees/continuous/4.txt`
(2026-09-20): no cover square anywhere, and in its place a `HeaderFullbleedCentralView` holding the picture,
the fade under it and Spotify's own 45pt title. Before any other pass it runs the one the page opens with,
diff --git a/harness/playlist/main.m b/harness/playlist/main.m
index 7ea435de..e557980c 100644
--- a/harness/playlist/main.m
+++ b/harness/playlist/main.m
@@ -59,6 +59,8 @@
}
// Spotify's own is what reports a scroll to the header; here it only gives the hook something to run after.
- (void)entityHeaderViewController:(id)controller didUpdateVisibleRect:(CGRect)rect {}
+// Spotify's runs when the page's model changes (a save); here it only gives PlaylistHeader.x's hook a method.
+- (void)update {}
@end
@interface _TtC28EncoreConsumerMobile_BaseKit19HeaderContentLayout : UIView @end
@@ -634,6 +636,9 @@ static void buildLikedSongs(UIViewController *page, CGFloat W) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSLog(@"[harness] late: Play's right shows \"%@\"", trailingLabel(page.view));
});
+ } else if ([NSProcessInfo.processInfo.arguments containsObject:@"saved"]) {
+ // Save with the Encore object behind it (download-mock.h), so the redesign can read whether it is saved.
+ mockAddToButton(box(actions, UIView.class, CGRectMake(58, 0, 48, 48), nil));
} else {
actionButton(actions, CGRectMake(58, 0, 48, 48), @"Components.UI.AddToButton", @"Like");
}
@@ -730,6 +735,28 @@ static void buildLikedSongs(UIViewController *page, CGFloat W) {
downloadScript();
return YES;
}
+ // `other saved`: save becomes download once the playlist is saved, and save again once it is removed, each
+ // change heard through the header controller's -update as on the phone (nothing is laid out).
+ if ([NSProcessInfo.processInfo.arguments containsObject:@"saved"]) {
+ at(2, ^{ NSLog(@"[harness] saved: before, Play's right shows \"%@\"", trailingLabel(page.view)); });
+ at(2.5, ^{
+ setAddTo(1);
+ [(id)headerVC update];
+ });
+ at(3.2, ^{ NSLog(@"[harness] saved: saved, Play's right shows \"%@\"", trailingLabel(page.view)); });
+ at(4.5, ^{
+ setAddTo(0);
+ [(id)headerVC update];
+ });
+ at(5.2, ^{ NSLog(@"[harness] saved: removed, Play's right shows \"%@\"", trailingLabel(page.view)); });
+ at(6, ^{
+ ((UIButton *)sgh_downloadButton).enabled = NO;
+ setAddTo(1);
+ [(id)headerVC update];
+ });
+ at(6.7, ^{ NSLog(@"[harness] saved: saved, download disabled, Play's right shows \"%@\"", trailingLabel(page.view)); });
+ return YES;
+ }
for (NSUInteger i = 0; i < 3; i++) {
NSString *state = @[@"rest", @"collapsed", @"pulled"][i];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)((4 + i * 4) * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
diff --git a/tweak/Sources/Redesigned/Kit/SGRHeaderInfo.m b/tweak/Sources/Redesigned/Kit/SGRHeaderInfo.m
index 8a8d1a07..03ed499b 100644
--- a/tweak/Sources/Redesigned/Kit/SGRHeaderInfo.m
+++ b/tweak/Sources/Redesigned/Kit/SGRHeaderInfo.m
@@ -185,7 +185,13 @@ static const CGFloat kLogoWidthShare = 0.8, kLogoMaxHeight = 64;
if (playColor) _play.contentColor = playColor;
[_play feedFrom:play];
}
- if (trailing) [_trailing feedFrom:trailing];
+ // Another of Spotify's buttons in the trailing place (save becoming download once the playlist is saved) is
+ // a crossfade, a change of what the button is rather than a move.
+ if (trailing && _trailing.source && trailing != _trailing.source && !_trailing.hidden && self.window) {
+ [UIView transitionWithView:_trailing duration:SGRCrossfade options:UIViewAnimationOptionTransitionCrossDissolve
+ animations:^{ [self->_trailing feedFrom:trailing]; } completion:nil];
+ }
+ else if (trailing) [_trailing feedFrom:trailing];
BOOL changed = NO;
NSArray<UIView *> *buttons = @[_shuffle, _play, _trailing];
diff --git a/tweak/Sources/Redesigned/Playlist/PlaylistHeader.x b/tweak/Sources/Redesigned/Playlist/PlaylistHeader.x
index 8f82e9c1..caf5b29a 100644
--- a/tweak/Sources/Redesigned/Playlist/PlaylistHeader.x
+++ b/tweak/Sources/Redesigned/Playlist/PlaylistHeader.x
@@ -310,10 +310,23 @@ static NSString *lengthIn(UIView *block) {
return firstText(SGRFindByIdentifier(block, @"Components.Header.UI.Metadata", &kMetaKey), nil);
}
+// Someone else's playlist shows save until it is in the library, and then download in its place, as the
+// Music app turns add into download once a playlist is added; taking it out of the library again is
+// Spotify's own Remove from Your Library in the ⋯ menu. Download only where Spotify has put its own
+// download button in the row and left it enabled, so an account that cannot download keeps save (and its
+// checkmark) and nothing is offered that Spotify does not offer: the button fires Spotify's. A playlist
+// already downloading or downloaded shows download whatever save says.
+static BOOL showsDownload(UIView *save, UIView *download) {
+ if (![download isKindOfClass:UIControl.class] || !((UIControl *)download).enabled) return NO;
+ BOOL added = NO;
+ SGRDownloadState state = SGRDownloadNone;
+ return (SGRReadAddTo(save, &added) && added) || (SGRReadDownload(download, &state, NULL) && state != SGRDownloadNone);
+}
+
// What the playlist's header shows: the name and the description from the page's model, the creator and the
-// length from Spotify's concealed labels, and on Play's right save for someone else's playlist, download for
-// one's own and for Liked Songs, which Spotify reports as neither owned nor unsaved (isOwnedBySelf NO,
-// formatListType liked-songs).
+// length from Spotify's concealed labels, and on Play's right save for someone else's playlist (download once
+// it is saved, showsDownload), download for one's own and for Liked Songs, which Spotify reports as neither
+// owned nor unsaved (isOwnedBySelf NO, formatListType liked-songs).
static void showPlaylist(SGRHeaderInfo *info, UIView *block, UIView *root, id model) {
NSString *title = modelString(model, @"playlistName") ?: firstText(block, nil);
[info showTitle:title creator:creatorIn(block) length:lengthIn(block)
@@ -324,7 +337,9 @@ static void showPlaylist(SGRHeaderInfo *info, UIView *block, UIView *root, id mo
UIView *shuffle = SGRFindByIdentifier(block, @"Components.UI.ShuffleButton", &kShuffleKey);
UIView *play = SGRFindByIdentifier(root, @"header-play-button", &kPlayKey);
UIView *save = own ? nil : SGRFindByIdentifier(block, @"Components.UI.AddToButton", &kAddKey);
- UIView *download = save ? nil : SGRFindByIdentifier(block, @"DownloadButton.Granular*", &kDownloadKey);
+ UIView *download = SGRFindByIdentifier(block, @"DownloadButton.Granular*", &kDownloadKey);
+ if (save && showsDownload(save, download)) save = nil;
+ if (save) download = nil;
[info showShuffle:shuffle play:play trailing:save ?: download
trailingFallback:[UIImage systemImageNamed:save ? @"plus" : @"arrow.down"] playColor:SGRPlaylistFieldColor(info)];
// Only what the button draws goes: a concealed layer still sends the actions the capsule fires.