Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.
C
feat: the owner's and the artist's picture sit beside their names on playlist and album pages
My-Name-Is-Jeff91a314a67af4
diff --git a/harness/album/README.md b/harness/album/README.mdindex 49ff1f13..e440a045 100644--- a/harness/album/README.md+++ b/harness/album/README.md@@ -65,3 +65,10 @@ in the title with no "feat.", one not at all). At 2.5 s the log says, row by rowdropped, how far the title moved and where the badge was drawn against the end of the title's text; at 4 s the firstrow is prepared for reuse and has to come back as Spotify drew it, then be dropped again by its next pass. At 3 sthe log also says the first card of each carousel, painted the base surface, was cleared and the grey one was not.++The artist row's picture (an `Encore.ImageView`) gets its image at 1.5 s, after the header has laid out. At 2.2 s the+log says where the redesign drew it: a round picture a line high just before the name, the two centred together+(`{{139, 368}, {21, 21}}` and the name at `{{168, 368}, {96, 21}}` on an iPhone 17 Pro).++`stubs.m` also stands in for `SGRegisterCustomFont`, which `Shared/Fonts/Fonts.x` calls and which lives in a file+that pulls in the settings rows.diff --git a/harness/album/main.m b/harness/album/main.mindex 43809d6b..0f41b7e9 100644--- a/harness/album/main.m+++ b/harness/album/main.m@@ -270,9 +270,32 @@ static NSString *trailingLabel(UIView *root) {UIView *parentElement = box(_titleStack, UIView.class, CGRectMake(0, 33.33, 96, 24), nil);UIView *parentRow = box(parentElement, MockEncoreButton.class, parentElement.bounds, @"CreativeWorkPlatform.Components.UI.ParentRow");parentRow.accessibilityLabel = @"The Weeknd";- UIView *avatar = box(parentRow, UIView.class, CGRectMake(0, 0, 24, 24), @"Encore.ImageView");+ UIImageView *avatar = (UIImageView *)box(parentRow, UIImageView.class, CGRectMake(0, 0, 24, 24), @"Encore.ImageView");avatar.backgroundColor = [UIColor colorWithWhite:0.8 alpha:1];avatar.layer.cornerRadius = 12;+ // The artist's picture lands at 1.5 s, after the header has laid out; at 2.2 s the log says where the+ // redesign drew it.+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{+ avatar.image = [[[UIGraphicsImageRenderer alloc] initWithSize:CGSizeMake(48, 48)] imageWithActions:^(UIGraphicsImageRendererContext *c) {+ [UIColor.orangeColor setFill];+ UIRectFill(CGRectMake(0, 0, 48, 48));+ }];+ });+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{+ UIView *info = nil;+ for (UIView *v = avatar; v && !info; v = v.superview) {+ for (UIView *sub in v.subviews) {+ if ([NSStringFromClass(sub.class) isEqualToString:@"SGRHeaderInfo"]) info = sub;+ }+ }+ UIView *picture = nil, *name = nil;+ for (UIView *sub in info.subviews) {+ if ([sub isKindOfClass:UIImageView.class] && !sub.hidden && ((UIImageView *)sub).image) picture = sub;+ if ([sub isKindOfClass:UILabel.class] && [((UILabel *)sub).text isEqualToString:@"The Weeknd"]) name = sub;+ }+ NSLog(@"[harness] artist picture: %@, name at %@", picture ? NSStringFromCGRect(picture.frame) : @"none",+ NSStringFromCGRect(name.frame));+ });label(parentRow, CGRectMake(32, 4.33, 72, 15.33), @"The Weeknd", 11, UIColor.whiteColor, @"Encore.Label");UIView *bottomGroup = box(outer, UIView.class, CGRectMake(0, 329.33, W, 71.33), nil);diff --git a/harness/album/stubs.m b/harness/album/stubs.mindex 7f27ceb9..45c332fe 100644--- a/harness/album/stubs.m+++ b/harness/album/stubs.m@@ -11,3 +11,6 @@ __weak UIView *sgr_albumRoot = nil;// Redesigned/Kit/SGRBridges.x: SGRField.m asks whether the player is opening or closing for its moving field.BOOL SGRPlayerIsTransitioning(void) { return NO; }void SGRObservePlayerTransition(id owner, void (^began)(id owner), void (^ended)(id owner)) {}++// Shared/Fonts/FontImport.m: no font of the user's own in the harness.+NSString *SGRegisterCustomFont(void) { return nil; }diff --git a/harness/playlist/README.md b/harness/playlist/README.mdindex 6ac75e58..497659aa 100644--- a/harness/playlist/README.md+++ b/harness/playlist/README.md@@ -64,3 +64,7 @@ again, it fired the old row's Mix ("still on screen: no").The extender paint line at 3 s also covers a recommendations heading mounted the way This Is playlists have it,a plain UICollectionViewCell straight in the list: "plain heading a=0" once the list's pass has cleared it.++The owner's picture is an image view inside the creator button's facepile, filled at 1.5 s, after the header has+laid out. At 2.2 s the log line "owner picture" says where the redesign drew it: round, a line high, just before+the name, the two centred together. "none" means the late image was missed.diff --git a/harness/playlist/main.m b/harness/playlist/main.mindex e557980c..4bf8818d 100644--- a/harness/playlist/main.m+++ b/harness/playlist/main.m@@ -244,6 +244,28 @@ static NSString *trailingLabel(UIView *root) {return @"no header";}+// Where the redesign's header drew the creator's picture and name, or that it drew none.+static NSString *creatorPictureState(UIView *root) {+ NSMutableArray<UIView *> *stack = [NSMutableArray arrayWithObject:root];+ while (stack.count) {+ UIView *v = stack.lastObject;+ [stack removeLastObject];+ if ([NSStringFromClass(v.class) isEqualToString:@"SGRHeaderInfo"]) {+ UIImageView *picture = nil;+ UILabel *name = nil;+ for (UIView *sub in v.subviews) {+ if ([sub isKindOfClass:UIImageView.class] && !sub.hidden && ((UIImageView *)sub).image) picture = (UIImageView *)sub;+ if ([sub isKindOfClass:UILabel.class] && [((UILabel *)sub).text isEqualToString:@"The Weeknd"]) name = (UILabel *)sub;+ }+ if (!picture) return [NSString stringWithFormat:@"none, name at %@", NSStringFromCGRect(name.frame)];+ return [NSString stringWithFormat:@"drawn at %@ radius %.0f, name at %@", NSStringFromCGRect(picture.frame),+ picture.layer.cornerRadius, NSStringFromCGRect(name.frame)];+ }+ [stack addObjectsFromArray:v.subviews];+ }+ return @"no header";+}+// Liked Songs (trees/continuous/1.txt, 2026-09-18): the same page with no cover, a 238pt header, a column of// only the title and the count (the count in a stack of its own, 314pt of label and a 56pt spacer), no add or// more in the row, the play button 80x48 with its 48pt disc at x=16, and LiquidGlass.gradientContainer, the@@ -608,7 +630,19 @@ static void buildLikedSongs(UIViewController *page, CGFloat W) {UIView *face = box(creator, _TtCE13Encore_FaceKitO16EncoreFoundation6Encore12FacepileView.class, CGRectMake(0, 5, 24, 24), nil);face.backgroundColor = [UIColor colorWithWhite:0.8 alpha:1];face.layer.cornerRadius = 12;+ // The owner's picture, in an image view inside the facepile, landing at 1.5 s after the header has laid out.+ UIImageView *facePicture = [[UIImageView alloc] initWithFrame:face.bounds];+ [face addSubview:facePicture];label(creator, CGRectMake(32, 9, 77, 16), @"The Weeknd", 13, UIColor.whiteColor, @"Encore.Label");+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{+ facePicture.image = [[[UIGraphicsImageRenderer alloc] initWithSize:CGSizeMake(48, 48)] imageWithActions:^(UIGraphicsImageRendererContext *c) {+ [UIColor.orangeColor setFill];+ UIRectFill(CGRectMake(0, 0, 48, 48));+ }];+ });+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{+ NSLog(@"[harness] owner picture: %@", creatorPictureState(page.view));+ });box(creatorRow, UIView.class, CGRectMake(109.67, 0, columnWidth - 109.67, 34), nil);UIView *lengthRow = box(column, UIView.class, CGRectMake(0, 107, columnWidth, 15.33), nil);diff --git a/tweak/Sources/Redesigned/Album/AlbumHeader.x b/tweak/Sources/Redesigned/Album/AlbumHeader.xindex 669cd76d..c795eab5 100644--- a/tweak/Sources/Redesigned/Album/AlbumHeader.x+++ b/tweak/Sources/Redesigned/Album/AlbumHeader.x@@ -436,6 +436,8 @@ static SGRHeaderInfo *applyInfo(UIView *header, UIView *page) {// whole line however many artists are on the album, so several of them open Spotify's own picker// (issue #56).[info showCreatorLink:parent];+ // And the artist's picture before the name, the one Spotify draws at the start of the row.+ [info showCreatorPicture:SGRCreatorPicture(parent)];// More, pinned over the page rather than left in the header, which is blanked and scrolls away.SGRPinnedMore(page, &kPinnedMoreKey, SGRFindByIdentifier(header, @"Components.UI.ContextMenuButton*", &kMoreKey));diff --git a/tweak/Sources/Redesigned/Kit/SGRHeaderInfo.h b/tweak/Sources/Redesigned/Kit/SGRHeaderInfo.hindex 050588a6..f29e7aa7 100644--- a/tweak/Sources/Redesigned/Kit/SGRHeaderInfo.h+++ b/tweak/Sources/Redesigned/Kit/SGRHeaderInfo.h@@ -27,6 +27,11 @@ extern const CGFloat SGRHeaderInfoTitleRise; // 56, of the content over the pic// The line keeps its colour: it is the page's one piece of secondary text, not a link to be tinted. nil// leaves it as text.- (void)showCreatorLink:(UIView *)control;+// The picture of whoever made it -- the album's artist, the playlist's owner -- drawn round, a line high, before+// the creator's name, the two centred together, as Spotify's own facepile sat beside the name. `source` is the+// image view Spotify draws it in (SGRCreatorPicture), followed as Spotify fills it, so a picture that lands+// after the page has laid out still shows. With no picture in it, or nil, the name stands alone.+- (void)showCreatorPicture:(UIImageView *)source;// For a trailing control that shows its state only as a word (the artist's Follow): SGRMirrorButton's// readState and its two symbols. Set before the first -showShuffle:...; -trailingStateChanged redraws it.@property (nonatomic, copy) BOOL (^trailingState)(BOOL *on);@@ -44,3 +49,9 @@ extern const CGFloat SGRHeaderInfoTitleRise; // 56, of the content over the pic// The height the content wants at `width`, from the top of the title to the bottom of the description.- (CGFloat)contentHeightForWidth:(CGFloat)width;@end++// The image view of the leading face on Spotify's creator line `root` -- the playlist header's collaborators+// button, which carries a facepile, or the album header's artist row, which carries an Encore.ImageView: the+// square image view nearest the leading edge, so a badge after the name is not taken for it. nil when there is+// none yet.+UIImageView *SGRCreatorPicture(UIView *root);diff --git a/tweak/Sources/Redesigned/Kit/SGRHeaderInfo.m b/tweak/Sources/Redesigned/Kit/SGRHeaderInfo.mindex 03ed499b..6c11ceb9 100644--- a/tweak/Sources/Redesigned/Kit/SGRHeaderInfo.m+++ b/tweak/Sources/Redesigned/Kit/SGRHeaderInfo.m@@ -33,10 +33,32 @@ static BOOL setText(UILabel *label, NSString *text) {// The most a title picture takes: a share of the text's width, and a height near three lines of the title.static const CGFloat kLogoWidthShare = 0.8, kLogoMaxHeight = 64;+// Between the creator's picture and the name.+static const CGFloat kPictureGap = 8;++// A face is at least this wide, and square give or take a point.+static const CGFloat kMinFace = 16;++UIImageView *SGRCreatorPicture(UIView *root) {+ if (!root) return nil;+ // The faces of a facepile overlap, the leading one first to the eye.+ BOOL rtl = root.effectiveUserInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft;+ __block UIImageView *found = nil;+ __block CGFloat edge = 0;+ SGForEachView(root, ^(UIView *v) {+ CGSize size = v.bounds.size;+ if (![v isKindOfClass:UIImageView.class] || size.width < kMinFace || fabs(size.width - size.height) > 1) return;+ CGFloat x = [v convertPoint:CGPointMake(rtl ? size.width : 0, 0) toView:root].x;+ if (!found || (rtl ? x > edge : x < edge)) found = (UIImageView *)v, edge = x;+ });+ return found;+}@implementation SGRHeaderInfo {UILabel *_title, *_creator, *_length, *_about;UIImageView *_logo;+ UIImageView *_picture; // the creator's, round, before the name+ __weak UIImageView *_pictureSource;UIImage *_titleImage; // what the title's place is laid out for; the logo keeps its picture while it fades outSGRMirrorButton *_shuffle, *_trailing;SGRPlayCapsule *_play;@@ -54,6 +76,11 @@ static const CGFloat kLogoWidthShare = 0.8, kLogoMaxHeight = 64;SGRTertiary(), 1, NSTextAlignmentCenter);_about = infoLabel(self, SGRFont(UIFontTextStyleFootnote, UIFontWeightRegular, UIContentSizeCategoryExtraLarge),SGRSecondary(), 2, NSTextAlignmentNatural);+ _picture = [UIImageView new];+ _picture.contentMode = UIViewContentModeScaleAspectFill;+ _picture.clipsToBounds = YES;+ _picture.hidden = YES;+ [self addSubview:_picture];_shuffle = [[SGRMirrorButton alloc] initWithFrame:CGRectZero];_shuffle.fallbackGlyph = [UIImage systemImageNamed:@"shuffle"];@@ -162,14 +189,37 @@ static const CGFloat kLogoWidthShare = 0.8, kLogoMaxHeight = 64;SGRActivate(_creatorLink);}-// The creator line takes a touch only where its text is; everything else of the view is the page's.+- (void)showCreatorPicture:(UIImageView *)source {+ if (source != _pictureSource) {+ _pictureSource = source;+ __weak SGRHeaderInfo *weakSelf = self;+ if (source) SGRObserveImage(source, ^(UIImageView *view) {+ SGRHeaderInfo *info = weakSelf;+ if (info && view == info->_pictureSource) [info sgr_takePicture:view.image];+ });+ }+ [self sgr_takePicture:source.image];+}++// The picture fades in where it lands with the page on screen; the name makes room for it in the same move.+- (void)sgr_takePicture:(UIImage *)image {+ if (image == _picture.image) return;+ BOOL appears = image && !_picture.image;+ _picture.image = image;+ _picture.hidden = image == nil;+ [self setNeedsLayout];+ if (!appears || !self.window) return;+ _picture.alpha = 0;+ SGRAnimate(SGRMotionFade, ^{ self->_picture.alpha = 1; }, nil);+ SGRAnimate(SGRMotionLayout, ^{ [self layoutIfNeeded]; }, nil);+}++// The creator line takes a touch only where its text and its picture are; everything else of the view is the+// page's. The label is laid out at the text's own width (-layoutSubviews).- (UIView *)sgr_creatorHit:(CGPoint)point {if (!_creator.userInteractionEnabled || _creator.hidden) return nil;- CGSize text = [_creator sizeThatFits:CGSizeMake(_creator.bounds.size.width, CGFLOAT_MAX)];- CGRect frame = _creator.frame;- CGRect word = CGRectInset(CGRectMake(round(CGRectGetMidX(frame) - text.width / 2), frame.origin.y,- MIN(text.width, frame.size.width), frame.size.height), -8, -6);- return CGRectContainsPoint(word, point) ? _creator : nil;+ CGRect line = _picture.hidden ? _creator.frame : CGRectUnion(_creator.frame, _picture.frame);+ return CGRectContainsPoint(CGRectInset(line, -8, -6), point) ? _creator : nil;}- (void)showShuffle:(UIView *)shuffle play:(UIView *)play trailing:(UIView *)trailing@@ -229,6 +279,8 @@ static const CGFloat kLogoWidthShare = 0.8, kLogoMaxHeight = 64;[super layoutSubviews];CGFloat width = self.bounds.size.width, text = MAX(0, width - 2 * kSide);CGFloat y = round(self.bounds.size.height - SGRHeaderInfoBottom - [self contentHeightForWidth:width]);+ // No name, no picture: it belongs to the line.+ _picture.hidden = !_picture.image || _creator.hidden;UILabel *previous = nil;for (UILabel *label in @[_title, _creator, _length]) {@@ -237,6 +289,18 @@ static const CGFloat kLogoWidthShare = 0.8, kLogoMaxHeight = 64;CGSize size = [self sgr_sizeOf:label width:text];CGFloat height = ceil(size.height);label.frame = CGRectMake(kSide, y, text, height);+ // The name at its own width, so a tap beside it is the page's (-sgr_creatorHit:), and before it the+ // picture, a line high so the line keeps its height, the two centred together. The picture leads, so it+ // is on the right in a right-to-left language.+ if (label == _creator) {+ CGFloat picture = _picture.hidden ? 0 : height + kPictureGap;+ CGFloat named = MIN(ceil(size.width), MAX(0, text - picture));+ CGFloat x = round((width - picture - named) / 2);+ BOOL rtl = self.effectiveUserInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft;+ _picture.frame = CGRectMake(rtl ? x + named + kPictureGap : x, y, height, height);+ _picture.layer.cornerRadius = height / 2;+ label.frame = CGRectMake(rtl ? x : x + picture, y, named, height);+ }if (label == _title && _titleImage) {_logo.frame = CGRectMake(round((width - size.width) / 2), y, size.width, height);_logo.accessibilityLabel = _title.text;diff --git a/tweak/Sources/Redesigned/Playlist/PlaylistHeader.x b/tweak/Sources/Redesigned/Playlist/PlaylistHeader.xindex caf5b29a..5ac5c80a 100644--- a/tweak/Sources/Redesigned/Playlist/PlaylistHeader.x+++ b/tweak/Sources/Redesigned/Playlist/PlaylistHeader.x@@ -348,7 +348,10 @@ static void showPlaylist(SGRHeaderInfo *info, UIView *block, UIView *root, id mo// Whoever made the playlist, opened from the line that names them. Spotify's own button carries the// facepile and the name and takes the tap to a profile -- or, for a playlist several people are on, to// the picker it opens itself (issue #56).- [info showCreatorLink:SGRFindByIdentifier(block, @"Components.PlaylistHeader.collaboratorsButton", &kCreatorKey)];+ UIView *creator = SGRFindByIdentifier(block, @"Components.PlaylistHeader.collaboratorsButton", &kCreatorKey);+ [info showCreatorLink:creator];+ // And their picture before their name, the first face of the facepile that button carries.+ [info showCreatorPicture:SGRCreatorPicture(creator)];// More, pinned over the page rather than left in the block, which is concealed and scrolls away; and// Spotify's own Sort, from the find-on-page toolbar this header conceals, for the ⋯ sheet to fire.