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 library sorts again, the entity pages keep their ⋯, and a creator opens from the line that names them
Vojtěch Škopek7af661093918
diff --git a/AGENTS.md b/AGENTS.mdindex 31d4174a..206962bd 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -11,9 +11,9 @@ A Theos tweak (Objective-C + Logos) injected into the decrypted Spotify iOS app.Home gradient, AMOLED switch, accent colour...).- **Redesigned**: the mod's own Liquid Glass look, from a clean sheet. It includes the glass tab bar,search field and now playing bar, the redesigned player and lyrics page with Apple Music style lyrics- always on, a decluttered Home, Search's categories on tinted glass, a Library with one large title and no- filter pills, the playlist, album and artist pages the way the Music app lays them out, black throughout, and its- own accent colour. No native tweak runs.+ always on, a decluttered Home, Search's categories on tinted glass, a Library with one large title, the+ playlist, album and artist pages the way the Music app lays them out with one pinned ⋯ over each, black+ throughout, and its own accent colour. No native tweak runs.Anything that doesn't draw on Spotify's screens works the same under both: ads, privacy, lyricssources, gestures, blocked artists, flags, Vibrations, Speed and pitch, and the Live Activity. Thosediff --git a/docs/tweaks.md b/docs/tweaks.mdindex 6665f160..45f97167 100644--- a/docs/tweaks.md+++ b/docs/tweaks.md@@ -181,16 +181,20 @@ Redesigned:has it without the camera, and each card as Liquid Glass tinted by its own colour, read off the Box'sshape layer (Search.h lists its files)Library/ Your Library the way Home and Search have their headers: a large title at the leading edge, the avatar- at the trailing edge with the search and create buttons before it, the filter chips and the header's- scrim gone and the header closed up by the band they leave, each row's artwork at the Kit's radius- with a circular one left round, a hairline between the rows, and the search inside the library on- glass capsules (Library.h lists its files)+ at the trailing edge with the search and create buttons before it, the header's scrim gone, each row's+ artwork at the Kit's radius with a circular one left round, a hairline between the rows, and the search+ inside the library on glass capsules (Library.h lists its files). The filter chips under the row stay+ Spotify's: they were taken out when this was first built and put back in 0.21 (issue #20), since+ sorting a library is not something the page can do without, and Spotify already draws them on the+ system's own glassPlaylist/ the playlist page (Liked Songs and one's own too, all three being the same page) the way the Musicapp lays one out: the cover full bleed across the top dissolving into the page's field with no seam,the title, the creator and the length centred under it, one row of glass controls (shuffle, a- prominent Play capsule taking its glyph and its word from Spotify's own button, add, more), the find- bar and the curation pills gone, and the track rows on the field with a hairline between them- (Playlist.h lists its files). Laid out on the Mac against harness/playlist/+ prominent Play capsule taking its glyph and its word from Spotify's own button, add), the find bar+ and the curation pills gone, and the track rows on the field with a hairline between them+ (Playlist.h lists its files). Sort and Mix, the two of those pills the ⋯ menu does not already offer,+ are put on that menu's own sheet instead, above Spotify's rows, and fire Spotify's own buttons.+ Laid out on the Mac against harness/playlist/Album/ the album page laid out the same way, on the page the Creative Work Platform builds rather than theplaylist's, so it shares nothing with Playlist/ but the Kit: the cover full bleed dissolving into thefield, the title, the artist and the kind and date centred under it, and the same row of glass@@ -222,7 +226,7 @@ and Live Activity. The root page in `App/ModSettings.x` holds the Appearance car## Make targets- make build # out/Spotify-<version>-glass.ipa with FLEX in it+ make build # out/spoti.pw-<version>.ipa with FLEX in itmake release # the same without FLEXmake install # build without FLEX, sign with your certificate, install over USBmake install FLEX=1 # the same with FLEX, which is what make trees reads throughdiff --git a/harness/album/main.m b/harness/album/main.mindex 06cc39e6..b09fcd64 100644--- a/harness/album/main.m+++ b/harness/album/main.m@@ -416,6 +416,28 @@ static NSString *trailingLabel(UIView *root) {NSLog(@"[harness] hero %@, title stack %@, action row %@",NSStringFromCGRect([cover.window convertRect:cover.bounds fromView:cover]),NSStringFromCGRect(self->_titleStack.frame), NSStringFromCGRect(self->_actionRow.frame));++ // The ⋯ the redesign pins over the page, outside the scroll, and the artist line under the title,+ // which opens whoever made the album (issues #57 and #56).+ UIView *pinned = nil;+ for (UIView *sub in page.subviews) {+ if ([NSStringFromClass(sub.class) isEqualToString:@"SGRMirrorButton"]) pinned = sub;+ }+ NSLog(@"[harness] pinned more: %@ on the page, hidden=%d",+ pinned ? NSStringFromCGRect(pinned.frame) : @"MISSING", pinned.hidden);+ __block UIView *info = nil, *artist = nil;+ void (^__block walk)(UIView *) = ^(UIView *v) {+ if ([NSStringFromClass(v.class) isEqualToString:@"SGRHeaderInfo"]) info = v;+ for (UIView *sub in v.subviews) walk(sub);+ };+ walk(root.view);+ for (UIView *sub in info.subviews) {+ if ([sub isKindOfClass:UILabel.class] && [((UILabel *)sub).text isEqualToString:@"The Weeknd"]) artist = sub;+ }+ UIView *onName = [info hitTest:CGPointMake(CGRectGetMidX(info.bounds), CGRectGetMidY(artist.frame)) withEvent:nil];+ UIView *beside = [info hitTest:CGPointMake(24, CGRectGetMidY(artist.frame)) withEvent:nil];+ NSLog(@"[harness] artist line: on the name %@, beside it %@", onName ? NSStringFromClass(onName.class) : @"through",+ beside ? NSStringFromClass(beside.class) : @"through");});// Spotify lays the header out again after the redesign has moved things: the title block, its stack anddiff --git a/harness/artist/main.m b/harness/artist/main.mindex c345ace5..8b74cc32 100644--- a/harness/artist/main.m+++ b/harness/artist/main.m@@ -311,6 +311,14 @@ static NSArray<NSArray *> *musicList(void) {UIView *card = band.subviews.lastObject;NSLog(@"[harness] carousel bg %@, fade masked %d, card bg %@", band.backgroundColor, fade.layer.mask != nil, card.backgroundColor);NSLog(@"[harness] strip a=%.2f, pages moved %.0f, list bg %@", strip.alpha, pages.transform.ty, list.backgroundColor);+ // ⋯ is pinned to the page now, not to the header's container, so it holds its place as the page+ // scrolls and the header collapses (issue #57), and it is the back button's 44pt glass.+ UIView *pinned = nil;+ for (UIView *sub in page.subviews) {+ if ([NSStringFromClass(sub.class) isEqualToString:@"SGRMirrorButton"]) pinned = sub;+ }+ NSLog(@"[harness] pinned more: %@ on the page, a=%.2f",+ pinned ? NSStringFromCGRect(pinned.frame) : @"MISSING", pinned.alpha);});return YES;}diff --git a/harness/library/main.m b/harness/library/main.mindex 2ac6b38d..a71e9e5f 100644--- a/harness/library/main.m+++ b/harness/library/main.m@@ -299,8 +299,12 @@ static UIView *chips(UIView *filters) {if ([sub isMemberOfClass:UILabel.class]) title = (UILabel *)sub;}CGFloat textRight = title ? CGRectGetMinX(title.frame) + MIN(title.bounds.size.width, [title.text sizeWithAttributes:@{NSFontAttributeName: title.font}].width) : 0;- HLog(@"%@: %@; title text %.0f-%.0f, header %.0fpt, list inset %.0f", moment, [parts componentsJoinedByString:@", "],- CGRectGetMinX(title.frame), textRight, header.bounds.size.height, self.page.list.contentInset.top);+ UIView *filters = [header valueForKey:@"filters"];+ HLog(@"%@: %@; title text %.0f-%.0f, header %.0fpt, list inset %.0f, chips %@", moment,+ [parts componentsJoinedByString:@", "], CGRectGetMinX(title.frame), textRight,+ header.bounds.size.height, self.page.list.contentInset.top,+ !filters ? @"missing" : (filters.alpha < 0.5 ? @"HIDDEN" : [NSString stringWithFormat:@"%.0fpt at y=%.0f",+ filters.bounds.size.height, filters.frame.origin.y]));}- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)options {diff --git a/harness/playlist/build.sh b/harness/playlist/build.shindex 495ad470..845697ca 100755--- a/harness/playlist/build.sh+++ b/harness/playlist/build.sh@@ -4,7 +4,7 @@ SRC=/Users/vojta/Documents/quick/custom_spotify/custom_spotify/tweak/SourcesOUT=$(dirname "$0")/buildrm -rf "$OUT"; mkdir -p "$OUT/gen" "$OUT/PlaylistHarness.app"-for f in Redesigned/Playlist/PlaylistField.x Redesigned/Playlist/PlaylistHeader.x Redesigned/Playlist/PlaylistRows.x; do+for f in Redesigned/Playlist/PlaylistField.x Redesigned/Playlist/PlaylistHeader.x Redesigned/Playlist/PlaylistRows.x Redesigned/Playlist/PlaylistMenu.x; doname=$(basename "$f" .x)"$THEOS/bin/logos.pl" -c generator=internal "$SRC/$f" > "$OUT/gen/$name.m"donediff --git a/harness/playlist/main.m b/harness/playlist/main.mindex a38a74c4..57417245 100644--- a/harness/playlist/main.m+++ b/harness/playlist/main.m@@ -4,8 +4,14 @@#pragma mark - Spotify's classes, by name-@interface _TtC35ListUXPlatform_FreeTierPlaylistImpl17FTPViewController : UIViewController @end-@implementation _TtC35ListUXPlatform_FreeTierPlaylistImpl17FTPViewController @end+@interface _TtC35ListUXPlatform_FreeTierPlaylistImpl17FTPViewController : UIViewController+- (void)sgr_creatorFired;+- (void)sgr_pillFired:(UIView *)pill;+@end+@implementation _TtC35ListUXPlatform_FreeTierPlaylistImpl17FTPViewController+- (void)sgr_creatorFired { NSLog(@"[harness] the creator line opened the playlist's owner"); }+- (void)sgr_pillFired:(UIView *)pill { NSLog(@"[harness] the sheet fired Spotify's %@ pill", pill.accessibilityLabel); }+@end@interface _TtC35ListUXPlatform_FreeTierPlaylistImpl32FTPTouchCancellingCollectionView : UIScrollView @end@implementation _TtC35ListUXPlatform_FreeTierPlaylistImpl32FTPTouchCancellingCollectionView @end@@ -81,6 +87,51 @@@interface _TtGC13Element_UIKit11ElementViewT_P_P__ : UIView @end@implementation _TtGC13Element_UIKit11ElementViewT_P_P__ @end+// What the element framework wraps a cell's content in, and what the device's tree shows between the+// playlist's Refresh cell and the black it paints (trees/continuous/1.txt:1919). It is a cell of its own,+// the full width of the one around it, so a clear that stops at the first nested cell stops before the paint.+@interface MockElementContentView : UICollectionViewCell @end+@implementation MockElementContentView @end++// A card inside a carousel: a cell too, but its own width, and its own colour to keep.+@interface MockCardCell : UICollectionViewCell @end+@implementation MockCardCell @end++// Encore's glyph view and the icon it is built from, which answers its own name: how the curation row tells+// Sort from Edit without reading the word on it.+@interface MockEncoreIcon : NSObject+@property (nonatomic, copy) NSString *name;+@end+@implementation MockEncoreIcon @end++@interface SPTEncoreIconView : UIView {+@public+ id icon;+}+@end+@implementation SPTEncoreIconView @end++@interface _TtC19LegacyUI_ECMCoreKit10ScrollView : UIScrollView @end+@implementation _TtC19LegacyUI_ECMCoreKit10ScrollView @end++// The header view the find-on-page toolbar sits in, which PlaylistHeader.x conceals whole.+@interface _TtCO19LegacyUI_ECMCoreKit5Views10HeaderView : UIView @end+@implementation _TtCO19LegacyUI_ECMCoreKit5Views10HeaderView @end++// Spotify's ⋯ sheet: a table of rows the mod cannot read, whose header is what PlaylistMenu.x sets.+@interface _TtC24ContextMenu_InternalImpl25ContextMenuViewController : UIViewController+@property (nonatomic, strong) UITableView *table;+@end+@implementation _TtC24ContextMenu_InternalImpl25ContextMenuViewController+- (void)viewDidLoad {+ [super viewDidLoad];+ self.view.backgroundColor = [UIColor colorWithWhite:0.1 alpha:1];+ _table = [[UITableView alloc] initWithFrame:CGRectMake(0, 200, self.view.bounds.size.width, 400)];+ _table.backgroundColor = UIColor.clearColor;+ [self.view addSubview:_table];+}+@end+// The plain UIView Liked Songs' shuffle stack sits in: its own pass puts the stack back where Spotify's// constraints want it, on the right of the row, which is what made the shuffle flash there on the phone.@interface MockRightHost : UIView @end@@ -154,7 +205,18 @@ static UIView *actionButton(UIView *row, CGRect frame, NSString *identifier, NSSUIImageView *glyph = [[UIImageView alloc] initWithFrame:CGRectInset(button.bounds, 12, 12)];NSDictionary *glyphs = @{@"Components.UI.AddToButton": @"plus", @"Components.UI.ContextMenuButton": @"ellipsis",@"DownloadButton.Granular.None": @"arrow.down.circle", @"Components.UI.WatchFeedEntityExplorerButton": @"play.rectangle"};- glyph.image = [UIImage systemImageNamed:glyphs[identifier] ?: @"circle"];+ // Encore bakes the colour into what it draws, and ⋯ sits in a Tertiary button, which draws it grey+ // (device 2026-09-20): drawn as an image of that colour, not as a template to be tinted.+ BOOL tertiary = [identifier isEqualToString:@"Components.UI.ContextMenuButton"];+ UIImage *symbol = [UIImage systemImageNamed:glyphs[identifier] ?: @"circle"];+ if (tertiary) {+ UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:symbol.size];+ symbol = [[renderer imageWithActions:^(UIGraphicsImageRendererContext *ctx) {+ [[UIColor colorWithWhite:0.70 alpha:1] set];+ [symbol drawInRect:(CGRect){CGPointZero, symbol.size}];+ }] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];+ }+ glyph.image = symbol;glyph.tintColor = UIColor.whiteColor;[button addSubview:glyph];return action;@@ -301,6 +363,9 @@ static void buildLikedSongs(UIViewController *page, CGFloat W) {UIViewController *page = [_TtC35ListUXPlatform_FreeTierPlaylistImpl17FTPViewController new];page.view.backgroundColor = [UIColor colorWithWhite:0.07 alpha:1];self.window.rootViewController = page;+ // The device's page counts the navigation bar into its own safe area -- 116 against the window's 62 --+ // which is what put the pinned ⋯ a bar's height below the back button (trees/continuous/1.txt 2026-09-20).+ page.additionalSafeAreaInsets = UIEdgeInsetsMake(54, 0, 0, 0);// the listUIScrollView *list = (UIScrollView *)box(page.view, _TtC35ListUXPlatform_FreeTierPlaylistImpl32FTPTouchCancellingCollectionView.class,@@ -309,9 +374,11 @@ static void buildLikedSongs(UIViewController *page, CGFloat W) {NSArray<NSArray<NSString *> *> *tracks = @[@[@"Cry For Me", @"The Weeknd"], @[@"I Can't Fucking Sing", @"The Weeknd"],@[@"São Paulo", @"The Weeknd, Anitta"], @[@"Until We're Skin & Bones", @"The Weeknd"],@[@"Baptized In Fear", @"The Weeknd"]];+ // The curation row stands over the first track, where Spotify's list has it, and the tracks start under it.+ CGFloat tracksTop = 564;for (NSUInteger i = 0; i < tracks.count; i++) {UIView *cell = box(list, _TtC35ListUXPlatform_FreeTierPlaylistImpl25ElementCollectionViewCell.class,- CGRectMake(0, 512 + i * 64, W, 64), @"Playlist.ItemCell");+ CGRectMake(0, tracksTop + i * 64, W, 64), @"Playlist.ItemCell");cell.backgroundColor = [UIColor colorWithWhite:0.07 alpha:1];UIView *row = box(cell, UIView.class, cell.bounds, @"Encore.ListRow");row.backgroundColor = [UIColor colorWithWhite:0.07 alpha:1];@@ -326,7 +393,7 @@ static void buildLikedSongs(UIViewController *page, CGFloat W) {// The extender under the tracks (device, trees/continuous/2.txt 2026-09-20): Recommended songs, its// rows and Refresh, each cell painting the black the AMOLED made of Spotify's base surface over the// field. Only the paint is mocked -- what the clear has to take off and what it has to leave.- CGFloat extenderTop = 512 + tracks.count * 64;+ CGFloat extenderTop = tracksTop + tracks.count * 64;UIView *heading = box(list, _TtC35ListUXPlatform_FreeTierPlaylistImpl25ElementCollectionViewCell.class,CGRectMake(0, extenderTop, W, 68), nil);UIView *headingPaint = box(heading, UIView.class, heading.bounds, @"PlaylistExtender.Heading");@@ -344,18 +411,70 @@ static void buildLikedSongs(UIViewController *page, CGFloat W) {badge.backgroundColor = UIColor.blackColor;badge.layer.cornerRadius = 13;+ // A card in a carousel: a cell of its own inside the row, narrower than the page, whose colour is its own+ // and stays.+ UIView *card = box(extenderRow, MockCardCell.class, CGRectMake(16, 8, 140, 48), @"PlaylistExtender.Card");+ card.layer.backgroundColor = UIColor.blackColor.CGColor;++ // Refresh, nested the way the device has it: the cell, the element framework's own content cell the full+ // width of it, the element view, and the black on the layer rather than through the view+ // (trees/continuous/1.txt:1919-1922). Both of those are what the first clear walked past.UIView *refresh = box(list, _TtC35ListUXPlatform_FreeTierPlaylistImpl25ElementCollectionViewCell.class,CGRectMake(0, extenderTop + 132, W, 48), nil);- UIView *refreshPaint = box(refresh, UIView.class, refresh.bounds, @"PlaylistExtender.Refresh");- refreshPaint.backgroundColor = UIColor.blackColor;+ UIView *refreshContent = box(refresh, MockElementContentView.class, refresh.bounds, nil);+ UIView *refreshElement = box(refreshContent, _TtGC13Element_UIKit11ElementViewT_P_P__.class, refresh.bounds, nil);+ UIView *refreshPaint = box(refreshElement, UIView.class, refresh.bounds, @"PlaylistExtender.Refresh");+ refreshPaint.layer.backgroundColor = UIColor.blackColor.CGColor;UIView *button = box(refreshPaint, UIView.class, CGRectMake(W / 2 - 36, 8, 72, 32), @"section-header-button");button.backgroundColor = UIColor.whiteColor;button.layer.cornerRadius = 16;+ // The curation row over the first track (own-playlist/01.txt:33): Add, Mix, Notes, Video, Edit, Sort and+ // Name & details in a scroll view, of which the redesign keeps Sort and Mix.+ UIView *curation = box(list, _TtC35ListUXPlatform_FreeTierPlaylistImpl25ElementCollectionViewCell.class,+ CGRectMake(0, tracksTop - 52, W, 52), nil);+ UIView *toolbar = box(curation, UIView.class, curation.bounds, @"PlaylistCuration.Row.CurationActionsToolbar");+ toolbar.layer.backgroundColor = [UIColor colorWithWhite:0.07 alpha:1].CGColor;+ UIScrollView *pillScroll = (UIScrollView *)box(box(toolbar, UIView.class, toolbar.bounds, nil),+ _TtC19LegacyUI_ECMCoreKit10ScrollView.class,+ CGRectMake(0, 10, W, 32), nil);+ UIView *pillContent = box(pillScroll, UIView.class, CGRectMake(0, 0, 527, 32), nil);+ UIView *pillStack = box(pillContent, _TtC19LegacyUI_ECMCoreKit19AutoLayoutStackView.class, pillContent.bounds, nil);+ UIView *pillRow = box(pillStack, UIView.class, pillStack.bounds, nil);+ pillScroll.contentSize = pillContent.bounds.size;+ NSArray<NSArray<NSString *> *> *pills = @[@[@"Add", @"PlaylistCuration.AddButton", @"plus"],+ @[@"Mix", @"ListPlatform.ToolbarActions.MixButton", @"mix"],+ @[@"Video", @"Encore.Button.Primary", @"video"],+ @[@"Edit", @"Encore.Button.Primary", @"edit"],+ @[@"Sort", @"Encore.Button.Primary", @"sortDown"],+ @[@"Name & details", @"Encore.Button.Primary", @"playlist"]];+ CGFloat pillX = 0;+ NSMutableArray<UIView *> *pillViews = [NSMutableArray array];+ for (NSArray<NSString *> *pill in pills) {+ CGFloat width = 40 + pill[0].length * 6;+ UIView *wrapper = box(pillRow, _TtGC13Element_UIKit11ElementViewT_P_P__.class, CGRectMake(pillX, 0, width, 32), nil);+ UIButton *pillButton = (UIButton *)box(wrapper, UIButton.class, wrapper.bounds, pill[1]);+ pillButton.accessibilityLabel = pill[0];+ [pillButton addTarget:page action:@selector(sgr_pillFired:) forControlEvents:UIControlEventTouchUpInside];+ pillButton.layer.backgroundColor = [UIColor colorWithWhite:1 alpha:0.14].CGColor;+ pillButton.layer.cornerRadius = 16;+ SPTEncoreIconView *icon = (SPTEncoreIconView *)box(pillButton, SPTEncoreIconView.class, CGRectMake(10, 10, 12, 12), @"Encore.IconView");+ MockEncoreIcon *glyph = [MockEncoreIcon new];+ glyph.name = pill[2];+ icon->icon = glyph;+ label(pillButton, CGRectMake(26, 8, width - 32, 16), pill[0], 11, UIColor.whiteColor, @"Encore.Label");+ [pillViews addObject:wrapper];+ pillX += width + 8;+ }+dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{- NSLog(@"[harness] extender paint: heading %@ row-badge %@ refresh %@",- headingPaint.backgroundColor ?: @"clear", badge.backgroundColor ?: @"clear",- refreshPaint.backgroundColor ?: @"clear");+ // Cleared means an alpha of 0, whether the colour was taken off the layer or the view: the clear+ // colour lands on both and reads back with no alpha at all.+ CGFloat (^alpha)(UIView *) = ^(UIView *v) {+ return v.layer.backgroundColor ? CGColorGetAlpha(v.layer.backgroundColor) : 0;+ };+ NSLog(@"[harness] extender paint: heading a=%.0f row-badge a=%.0f card a=%.0f refresh a=%.0f",+ alpha(headingPaint), alpha(badge), alpha(card), alpha(refreshPaint));});if ([NSProcessInfo.processInfo.arguments containsObject:@"liked"]) {@@ -442,7 +561,10 @@ static void buildLikedSongs(UIViewController *page, CGFloat W) {description.textContainer.lineFragmentPadding = 0;UIView *creatorRow = box(column, UIView.class, CGRectMake(0, 69, columnWidth, 34), nil);- UIView *creator = box(creatorRow, UIView.class, CGRectMake(0, 0, 109.67, 34), nil);+ UIButton *creator = (UIButton *)box(creatorRow, UIButton.class, CGRectMake(0, 0, 109.67, 34),+ @"Components.PlaylistHeader.collaboratorsButton");+ creator.accessibilityLabel = @"Playlist created by The Weeknd";+ [creator addTarget:page action:@selector(sgr_creatorFired) forControlEvents:UIControlEventTouchUpInside];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;@@ -492,6 +614,18 @@ static void buildLikedSongs(UIViewController *page, CGFloat W) {shuffleGlyph.tintColor = UIColor.whiteColor;[shuffle addSubview:shuffleGlyph];+ // The find-on-page toolbar the header conceals, whose Sort button is what the ⋯ sheet fires: one+ // identifier, in the header rather than in a cell the list reuses (trees/continuous/1.txt:1000).+ UIView *topAccessory = box(headerLayout, UIView.class, CGRectMake(0, 16, W, 134), @"_topAccessoryViewContainer");+ UIView *toolbarHeader = box(topAccessory, _TtCO19LegacyUI_ECMCoreKit5Views10HeaderView.class, CGRectMake(0, 0, W, 134), nil);+ UIView *toolbarContent = box(toolbarHeader, UIView.class, CGRectMake(16, 98, W - 32, 36), @"Components.Header.UI.Toolbar.Content");+ UIView *sortContainer = box(toolbarContent, UIView.class, CGRectMake(W - 94, 0, 62, 36), @"Components.Header.UI.Toolbar.ButtonContainer");+ sortContainer.hidden = YES;+ UIButton *headerSort = (UIButton *)box(sortContainer, UIButton.class, CGRectMake(16, 0, 30, 36), @"Components.Header.UI.Toolbar.Button");+ [headerSort setTitle:@"Sort" forState:UIControlStateNormal];+ [headerSort addTarget:page action:@selector(sgr_pillFired:) forControlEvents:UIControlEventTouchUpInside];+ headerSort.accessibilityLabel = @"Sort";+// the play button, in the header's foreground planeUIView *foreground = box(headerLayout, UIView.class, headerLayout.bounds, @"_foregroundViewContainer");UIView *playHost = box(foreground, UIView.class, CGRectMake(W - 64, 457.33, 64, 48), nil);@@ -571,6 +705,78 @@ static void buildLikedSongs(UIViewController *page, CGFloat W) {cover.alpha, cover.layer.hidden, gradient.alpha, gradient.layer.hidden);});+ // The ⋯ the redesign pins over the page: outside the list and the header both, so it holds its place+ // while the header collapses and the list scrolls (issue #57). Tapped, it fires Spotify's own.+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{+ UIView *pinned = nil;+ for (UIView *sub in page.view.subviews) {+ if ([NSStringFromClass(sub.class) isEqualToString:@"SGRMirrorButton"]) pinned = sub;+ }+ UIImageView *pinnedGlyph = nil;+ for (UIView *sub in pinned.subviews) {+ if ([sub isKindOfClass:UIImageView.class]) pinnedGlyph = (UIImageView *)sub;+ }+ NSLog(@"[harness] pinned more: %@ on the page, hidden=%d, glyph %@ tinted %@",+ pinned ? NSStringFromCGRect(pinned.frame) : @"MISSING", pinned.hidden,+ pinnedGlyph.image.renderingMode == UIImageRenderingModeAlwaysTemplate ? @"template" : @"as Spotify drew it",+ pinnedGlyph.tintColor);+ UIView *hit = [page.view hitTest:CGPointMake(CGRectGetMidX(pinned.frame), CGRectGetMidY(pinned.frame)) withEvent:nil];+ NSLog(@"[harness] pinned more takes the touch: %@", NSStringFromClass(hit.class));+ // The creator line: a tap on the name, nowhere else.+ UIView *info = nil;+ for (UIView *v = block; v; v = nil) {+ for (UIView *sub in v.subviews) if ([NSStringFromClass(sub.class) isEqualToString:@"SGRHeaderInfo"]) info = sub;+ }+ UIView *name = nil;+ for (UIView *sub in info.subviews) {+ if ([sub isKindOfClass:UILabel.class] && [((UILabel *)sub).text isEqualToString:@"The Weeknd"]) name = sub;+ }+ UIView *onName = [info hitTest:CGPointMake(CGRectGetMidX(name.bounds) + name.frame.origin.x, CGRectGetMidY(name.frame)) withEvent:nil];+ UIView *besideName = [info hitTest:CGPointMake(24, CGRectGetMidY(name.frame)) withEvent:nil];+ NSLog(@"[harness] creator line: on the name %@, beside it %@", onName ? NSStringFromClass(onName.class) : @"through",+ besideName ? NSStringFromClass(besideName.class) : @"through");+ for (UIGestureRecognizer *tap in name.gestureRecognizers) {+ [tap.view.superview performSelector:NSSelectorFromString(@"sgr_creatorTapped")];+ }+ // The list asks every cell how tall it wants to be, which is where the curation row answers 0 and+ // closes up: the harness's list is a plain scroll view, so it asks the way ListLayout does.+ UICollectionViewLayoutAttributes *wanted = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:+ [NSIndexPath indexPathForItem:0 inSection:0]];+ wanted.frame = curation.frame;+ CGSize answered = [(UICollectionViewCell *)curation preferredLayoutAttributesFittingAttributes:wanted].size;+ curation.frame = CGRectMake(0, curation.frame.origin.y, answered.width, answered.height);+ NSLog(@"[harness] the curation row answered %.0fpt tall", answered.height);+ });++ // The ⋯ sheet: tapping the pinned button records the page, and the menu that opens a moment later takes+ // Sort and Mix into its table's header (issue #53). Then Sort is tapped, which has to fire Spotify's own+ // pill even though its cell is closed up to nothing.+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{+ UIControl *pinnedMore = nil;+ for (UIView *sub in page.view.subviews) {+ if ([NSStringFromClass(sub.class) isEqualToString:@"SGRMirrorButton"]) pinnedMore = (UIControl *)sub;+ }+ [pinnedMore sendActionsForControlEvents:UIControlEventTouchUpInside];+ _TtC24ContextMenu_InternalImpl25ContextMenuViewController *menu =+ [_TtC24ContextMenu_InternalImpl25ContextMenuViewController new];+ [page presentViewController:menu animated:NO completion:^{+ [menu.view setNeedsLayout];+ [menu.view layoutIfNeeded];+ [menu.table layoutIfNeeded];+ UIView *block = menu.table.tableHeaderView;+ NSMutableArray<NSString *> *rows = [NSMutableArray array];+ for (UIView *row in block.subviews) {+ if (!row.hidden) [rows addObject:[NSString stringWithFormat:@"%@ %@", row.accessibilityLabel,+ NSStringFromCGRect(row.frame)]];+ }+ NSLog(@"[harness] the sheet's header is %@ %.0fpt: %@", block ? NSStringFromClass(block.class) : @"MISSING",+ block.bounds.size.height, [rows componentsJoinedByString:@", "]);+ for (UIView *row in block.subviews) {+ if (!row.hidden) [(UIControl *)row sendActionsForControlEvents:UIControlEventTouchUpInside];+ }+ }];+ });+// Spotify lays the column and the action row out again after the header's pass: their children go back// where its own layout put them, and the redesign has to take them again from its own watch on each.dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{diff --git a/tweak/Sources/Redesigned/Album/AlbumField.x b/tweak/Sources/Redesigned/Album/AlbumField.xindex 874d22eb..595dd448 100644--- a/tweak/Sources/Redesigned/Album/AlbumField.x+++ b/tweak/Sources/Redesigned/Album/AlbumField.x@@ -136,10 +136,12 @@ static SGRArtworkField *fieldIn(UIView *page) {%ctor {// Registered whatever the switch says: the flag rows elsewhere lock to these while it is on.SGRedesignForceFlags(@"album", @{- // The Music app keeps share and more out of the row under the cover; this is Spotify's own way of- // moving the more button up into the navigation bar, and the action row is laid out from whichever- // of the buttons it still finds, so it reads either way.- @"ios-album-albumfeatureproperties-impl.context_menu_in_navigation_bar_enabled": @YES,+ // More stays in Spotify's own header row, blanked with the rest of the column, and the redesign pins+ // its own glass ⋯ over the page (Kit/SGRActionRow.h). In the navigation bar -- which this flag is+ // Spotify's own way of putting it, and which the redesign forced until 2026-09-20 -- it was gone as+ // soon as the page was scrolled (the playlist's tree caught the bar's trailing slot empty,+ // trees/continuous/1.txt, issue #57).+ @"ios-album-albumfeatureproperties-impl.context_menu_in_navigation_bar_enabled": @NO,@"ios-album-albumfeatureproperties-impl.share_in_action_row_enabled": @NO,// A row is a title and its artists. The video badge is neither.@"ios-creativeworkcommons-retrievalrow-impl.track_video_indicator_enabled": @NO,diff --git a/tweak/Sources/Redesigned/Album/AlbumHeader.x b/tweak/Sources/Redesigned/Album/AlbumHeader.xindex 16b1376b..ecc94da6 100644--- a/tweak/Sources/Redesigned/Album/AlbumHeader.x+++ b/tweak/Sources/Redesigned/Album/AlbumHeader.x@@ -37,7 +37,7 @@ static const CGFloat kMinHero = 120, kMinCover = 80;static char kHeaderKey, kCoverKey, kTitleKey, kParentKey, kMetaKey, kAddKey, kDownloadKey, kPlayKey, kShuffleKey;static char kHeroKey, kHeroHeightKey, kHeaderHeightKey, kInfoKey, kHeaderWatchedKey, kRetryKey;-static char kExploreKey, kRowWatchedKey;+static char kExploreKey, kRowWatchedKey, kMoreKey, kPinnedMoreKey;#pragma mark - moving Spotify's views@@ -326,6 +326,14 @@ static SGRHeaderInfo *applyInfo(UIView *header, UIView *page) {});}+ // The artist under the title, opened from the line that names them. ParentRow is one control for the+ // whole line however many artists are on the album, so several of them open Spotify's own picker+ // (issue #56).+ [info showCreatorLink: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));+UIView *play = floatingIn(page, @"header-play-button", &kPlayKey);UIView *shuffle = floatingIn(page, @"Components.UI.ShuffleButton", &kShuffleKey);UIView *add = SGRFindByIdentifier(header, @"Components.UI.AddToButton", &kAddKey);diff --git a/tweak/Sources/Redesigned/Artist/ArtistHeader.x b/tweak/Sources/Redesigned/Artist/ArtistHeader.xindex 6fa6d022..86a401ca 100644--- a/tweak/Sources/Redesigned/Artist/ArtistHeader.x+++ b/tweak/Sources/Redesigned/Artist/ArtistHeader.x@@ -25,8 +25,8 @@// Explore, and the headline go with it -- the headline's pre-save is also the list's own Release Countdown// section. The Kit's SGRHeaderInfo reads the name and the listeners off Spotify's concealed labels and draws// and fires Spotify's shuffle, play and Follow, whose word ("Follow", "Following") is its state in the app's-// language. More stays in Spotify's row, where the row needs it (ArtistField.x), and is drawn by a glass-// button of the redesign's in the top trailing corner, level with the back button, firing it.+// language. More stays in Spotify's row, where the row needs it (ArtistField.x), and the Kit's pinned ⋯+// (SGRPinnedMore) draws and fires it from the top trailing corner of the page, level with the back button.#import "Core/SGCore.h"#import "Redesigned/Kit/SGRKit.h"#import "Artist.h"@@ -42,9 +42,6 @@ static const CGFloat kBar = 100, kFade = 150;static char kInfoKey, kHeroKey, kHeroHeightKey, kContainerHeightKey, kRowWatchedKey;static char kTitleKey, kMetaKey, kShuffleKey, kPlayKey, kFollowKey, kArtworkKey, kBarKey, kMoreKey, kMoreButtonKey;-// The back button's glass sits this far under the top of the safe area; more lines up with it.-static const CGFloat kCornerTop = 2, kCornerSide = 12;-#pragma mark - Spotify's views// Drawn by nothing and out of the way of touches, whatever Spotify does to it: an empty mask. Not hidden --@@ -277,27 +274,17 @@ static void applyHeader(UIView *header) {[info showShuffle:shuffle play:play trailing:follow trailingFallback:[UIImage systemImageNamed:@"person.badge.plus"]playColor:SGRArtistFieldColor(container)];- // More, in the top trailing corner of the page. It scrolls away with the photo; collapsed, the page is a- // list and its rows carry their own more.+ // More, in the top trailing corner of the page itself rather than of the container, which scrolls away+ // with the photo: pinned there it is the same button in the same place on the album and the playlist,+ // and the page keeps it however far down the list one is (issue #57).UIView *more = SGRFindByIdentifier(header, @"Components.UI.ContextMenuButton*", &kMoreKey);- SGRMirrorButton *moreButton = objc_getAssociatedObject(container, &kMoreButtonKey);- if (!moreButton) {- moreButton = [[SGRMirrorButton alloc] initWithFrame:CGRectZero];- moreButton.fallbackGlyph = [UIImage systemImageNamed:@"ellipsis"];- objc_setAssociatedObject(container, &kMoreButtonKey, moreButton, OBJC_ASSOCIATION_RETAIN_NONATOMIC);- }- if (moreButton.superview != container) [container addSubview:moreButton];- else if (container.subviews.lastObject != moreButton) [container bringSubviewToFront:moreButton];- if (more) [moreButton feedFrom:more];- moreButton.hidden = more == nil;- CGFloat top = container.window.safeAreaInsets.top + kCornerTop;- setFrame(moreButton, CGRectMake(container.bounds.size.width - kCornerSide - SGRActionHeight, top, SGRActionHeight, SGRActionHeight));+ SGRPinnedMore(SGRArtistPageOf(container), &kMoreButtonKey, more);// Collapsing, the text would pass over Spotify's bar with the name in it: it goes over the last kFade of- // the collapse, from the header's own height, which this pass runs on every step of.+ // the collapse, from the header's own height, which this pass runs on every step of. More stays: it is+ // outside the header and has nothing to pass over.CGFloat alpha = MAX(0, MIN(1, (header.bounds.size.height - kBar) / kFade));if (fabs(info.alpha - alpha) > 0.01) info.alpha = alpha;- if (fabs(moreButton.alpha - alpha) > 0.01) moreButton.alpha = alpha;// The picture reaches to where the content's top is at rest, plus the name. The container keeps its// height as the header collapses, and only ever grows as the page loads.diff --git a/tweak/Sources/Redesigned/Kit/SGRActionRow.h b/tweak/Sources/Redesigned/Kit/SGRActionRow.hindex 40f311d5..0dbbb504 100644--- a/tweak/Sources/Redesigned/Kit/SGRActionRow.h+++ b/tweak/Sources/Redesigned/Kit/SGRActionRow.h@@ -34,6 +34,11 @@@property (nonatomic, weak, readonly) UIView *source;// Drawn, in white, when Spotify's button has no image view to copy (a glyph it draws itself).@property (nonatomic, strong) UIImage *fallbackGlyph;+// The colour to draw the mirrored glyph in, whatever colour Spotify drew it. nil, the default, keeps+// Spotify's -- which is what a glyph that says something by its colour needs (shuffle turns the accent+// colour while it is on). Set it for a glyph whose colour is only the weight Spotify gave the control it+// sat in: Encore bakes the colour into the image it draws, so this re-renders the copy as a template.+@property (nonatomic, copy) UIColor *glyphColor;// The word on Spotify's button instead of a glyph, in a glass capsule as wide as the word asks for: for a// text button such as the artist's Follow, whose word is its state ("Follow", "Following") in the app's// language. Until Spotify's button has a word, the fallback glyph is drawn in the round shape instead. Set@@ -45,3 +50,19 @@// (shuffle turning on). Cheap to call again on every pass.- (void)feedFrom:(UIView *)source;@end++// The ⋯ every redesigned entity page pins to its top trailing corner, level with the back button: one+// button, one size, one place on the playlist, the album and the artist. It is added to `page` -- the+// page's own root view, outside anything that scrolls -- so it stays where it is however far the page is+// scrolled, which is what Spotify's own does not (the navigation bar's slot is emptied on the way down,+// trees/continuous/1.txt 2026-09-20, issue #57) and what a button in a scrolling header cannot.+//+// `source` is Spotify's own ⋯, wherever the page keeps it; nil hides the button until one is found. Kept+// on `page` under `key` and cheap to call again on every pass.+SGRMirrorButton *SGRPinnedMore(UIView *page, const void *key, UIView *source);++// A sheet opening within this long of a tap on a pinned ⋯ is that page's context menu.+static const NSTimeInterval SGRPinnedMoreWindow = 3;+// The page whose pinned ⋯ was tapped within that window, or nil: for a screen that puts rows of its own on+// Spotify's context menu sheet and has to know which page the sheet belongs to.+UIView *SGRPinnedMoreRecentPage(void);diff --git a/tweak/Sources/Redesigned/Kit/SGRActionRow.m b/tweak/Sources/Redesigned/Kit/SGRActionRow.mindex 8a3b11ad..6c47c8d1 100644--- a/tweak/Sources/Redesigned/Kit/SGRActionRow.m+++ b/tweak/Sources/Redesigned/Kit/SGRActionRow.m@@ -22,22 +22,6 @@ static char kCapsuleGlassKey, kMirrorGlassKey, kWordGlassKey;// A word button's padding either side of the word.static const CGFloat kWordPadding = 18;-#pragma mark - firing Spotify's button--// The way a tap on Spotify's own button would: its first control, fired through its actions, and through-// accessibility for an Encore control that reads its touches from a gesture recognizer instead.-static void fire(UIView *source) {- __block UIControl *control = nil;- SGForEachView(source, ^(UIView *v) {- if (!control && [v isKindOfClass:UIControl.class]) control = (UIControl *)v;- });- if (control && SGRFire(control)) return;- id target = control ?: source;- static dispatch_once_t once;- dispatch_once(&once, ^{ SGLog(@"redesign kit: an action row control fired through accessibility on %@", [target class]); });- [target accessibilityActivate];-}-// The glyph Spotify's button draws: an image view of the button's own size that nothing hidden is in the// way of. `side` is the size to match, 0 for any image view that is showing.static UIImageView *glyphIn(UIView *button, CGFloat side) {@@ -167,7 +151,7 @@ static NSString *wordIn(UIView *button) {}- (void)sgr_tap {- fire(self.source);+ SGRActivate(self.source);}@end@@ -199,6 +183,9 @@ static NSString *labelTextIn(UIView *button) {UILabel *_word;__weak UILabel *_watchedWord;__weak UIImageView *_watchedGlyph;+ // Spotify's own image, as it was taken: what the copy is compared against, since a copy re-rendered as+ // a template is no longer the same object.+ UIImage *_takenGlyph;}- (instancetype)initWithFrame:(CGRect)frame {@@ -297,11 +284,17 @@ static NSString *labelTextIn(UIView *button) {UIImageView *glyph = glyphIn(source, 0);NSString *word = source.accessibilityLabel ?: wordIn(source);if (word && ![self.accessibilityLabel isEqualToString:word]) self.accessibilityLabel = word;- if (glyph.image && _glyph.image != glyph.image) _glyph.image = glyph.image;- if (glyph.tintColor && ![_glyph.tintColor isEqual:glyph.tintColor]) _glyph.tintColor = glyph.tintColor;+ if (glyph.image && _takenGlyph != glyph.image) {+ _takenGlyph = glyph.image;+ _glyph.image = self.glyphColor ? [glyph.image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]+ : glyph.image;+ }+ UIColor *tint = self.glyphColor ?: glyph.tintColor;+ if (tint && ![_glyph.tintColor isEqual:tint]) _glyph.tintColor = tint;if (!glyph && self.fallbackGlyph && _glyph.image != self.fallbackGlyph) {+ _takenGlyph = nil;_glyph.image = self.fallbackGlyph;- _glyph.tintColor = SGRPrimary();+ _glyph.tintColor = self.glyphColor ?: SGRPrimary();}// As the capsule does: watched per glyph view, so a reused one reports where it is now.@@ -324,7 +317,7 @@ static NSString *labelTextIn(UIView *button) {}- (void)sgr_tap {- fire(self.source);+ SGRActivate(self.source);// The word is watched where Spotify writes it, but a button that rebuilds its content on the state it// just took writes the new word into a label the watch has never seen. So a tap, and only a tap, asks// the button again a moment later, which also moves the watch onto whatever label it ended up with.@@ -339,3 +332,69 @@ static NSString *labelTextIn(UIView *button) {}@end++#pragma mark - the page's pinned ⋯++// A mirror of the back button, which UIKit draws as a 44pt glass circle at the top of the safe area, 16pt+// in from the leading edge (trees/continuous/1.txt:2554: the navigation bar's own glass at {16, 0} 44x44,+// the bar itself at the safe area's top). ⋯ takes the same size and the same insets on the other side, so+// the two read as one row on every page (issue #57).+static const CGFloat kCornerSide = 16;++// The page whose pinned ⋯ was last tapped, and when: what tells the sheet that opens a moment later which+// page's menu it is. The same trick Shared/Player/SpeedPitchMenu.x plays on the player's more button, but+// from this side of it, since this button is the redesign's own and knows its own page.+static __weak UIView *sg_morePage;+static NSTimeInterval sg_moreTappedAt;+static char kRecorderKey;++UIView *SGRPinnedMoreRecentPage(void) {+ if (!sg_morePage || CACurrentMediaTime() - sg_moreTappedAt > SGRPinnedMoreWindow) return nil;+ return sg_morePage;+}++@interface SGRPinnedMoreRecorder : NSObject+@end+@implementation SGRPinnedMoreRecorder+- (void)sgr_moreTapped:(SGRMirrorButton *)button {+ sg_morePage = button.superview;+ sg_moreTappedAt = CACurrentMediaTime();+}+@end++SGRMirrorButton *SGRPinnedMore(UIView *page, const void *key, UIView *source) {+ if (!page) return nil;+ SGRMirrorButton *button = objc_getAssociatedObject(page, key);+ if (!button) {+ button = [[SGRMirrorButton alloc] initWithFrame:CGRectZero];+ button.fallbackGlyph = [UIImage systemImageNamed:@"ellipsis"];+ // ⋯ sits in an Encore Tertiary button in Spotify's own row, which draws it grey; in the corner of+ // the page it is the one control there and reads white, like the back button opposite it.+ button.glyphColor = SGRPrimary();+ // Held by the button, which is held by the page, so the recorder lives exactly as long as both.+ SGRPinnedMoreRecorder *recorder = [SGRPinnedMoreRecorder new];+ objc_setAssociatedObject(button, &kRecorderKey, recorder, OBJC_ASSOCIATION_RETAIN_NONATOMIC);+ [button addTarget:recorder action:@selector(sgr_moreTapped:) forControlEvents:UIControlEventTouchUpInside];+ objc_setAssociatedObject(page, key, button, OBJC_ASSOCIATION_RETAIN_NONATOMIC);+ }+ // Over the page's list and its header both, and put back on top whenever Spotify adds to the page.+ if (button.superview != page) [page addSubview:button];+ else if (page.subviews.lastObject != button) [page bringSubviewToFront:button];+ if (source) [button feedFrom:source];+ if (button.hidden != (source == nil)) button.hidden = source == nil;++ // Measured in the window and converted back, never from the page's own safe area: a page under a+ // navigation bar counts the bar into its inset, so the playlist's read 116 where the window's reads 62+ // and the button sat a bar's height below the back button (device, trees/continuous/1.txt 2026-09-20).+ UIWindow *window = page.window;+ CGFloat side = SGRGlassCircleSize;+ CGRect frame;+ if (window) {+ CGRect inWindow = CGRectMake(window.bounds.size.width - kCornerSide - side, window.safeAreaInsets.top, side, side);+ frame = [page convertRect:inWindow fromView:nil];+ } else {+ frame = CGRectMake(page.bounds.size.width - kCornerSide - side, page.safeAreaInsets.top, side, side);+ }+ if (!CGRectIsEmpty(frame) && !CGRectEqualToRect(button.frame, frame)) button.frame = frame;+ return button;+}diff --git a/tweak/Sources/Redesigned/Kit/SGRHeaderInfo.h b/tweak/Sources/Redesigned/Kit/SGRHeaderInfo.hindex 984d24de..e1311ae8 100644--- a/tweak/Sources/Redesigned/Kit/SGRHeaderInfo.h+++ b/tweak/Sources/Redesigned/Kit/SGRHeaderInfo.h@@ -22,6 +22,11 @@ extern const CGFloat SGRHeaderInfoTitleRise; // 56, of the content over the pic@interface SGRHeaderInfo : UIView// YES when anything shown changed. nil or empty hides that line.- (BOOL)showTitle:(NSString *)title creator:(NSString *)creator length:(NSString *)length about:(NSString *)about;+// Spotify's own control behind the creator line -- the album's artist row, the playlist's collaborators+// button -- so a tap on the line opens whoever made it, and several of them open Spotify's own picker.+// 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;// Spotify's own trailing control is a text button (the artist's Follow): drawn as its word in a capsule.@property (nonatomic) BOOL trailingShowsWord;// Spotify's controls, each drawn from and fired; nil hides that button. Play stays in the middle of thediff --git a/tweak/Sources/Redesigned/Kit/SGRHeaderInfo.m b/tweak/Sources/Redesigned/Kit/SGRHeaderInfo.mindex e29faecc..38e392b1 100644--- a/tweak/Sources/Redesigned/Kit/SGRHeaderInfo.m+++ b/tweak/Sources/Redesigned/Kit/SGRHeaderInfo.m@@ -3,6 +3,7 @@#import "Core/SGCore.h"#import "SGRHeaderInfo.h"#import "SGRActionRow.h"+#import "SGRRestyle.h"#import "SGRTokens.h"const CGFloat SGRHeaderInfoBottom = 14;@@ -34,6 +35,7 @@ static BOOL setText(UILabel *label, NSString *text) {UILabel *_title, *_creator, *_length, *_about;SGRMirrorButton *_shuffle, *_trailing;SGRPlayCapsule *_play;+ __weak UIView *_creatorLink;}- (instancetype)initWithFrame:(CGRect)frame {@@ -60,10 +62,14 @@ static BOOL setText(UILabel *label, NSString *text) {return self;}-// Touches only for the buttons: the text lets a pull or a tap through to the page under it.+// Touches only for the buttons and, where there is one, the creator line: the rest of the text lets a+// pull or a tap through to the page under it.- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {UIView *hit = [super hitTest:point withEvent:event];- return hit == self ? nil : hit;+ // The creator label is the width of the view, so the label itself answers a touch well away from the+ // name; both it and the view answer only where the name is drawn.+ if (hit == self || hit == _creator) return [self sgr_creatorHit:point];+ return hit;}- (BOOL)showTitle:(NSString *)title creator:(NSString *)creator length:(NSString *)length about:(NSString *)about {@@ -76,6 +82,33 @@ static BOOL setText(UILabel *label, NSString *text) {return changed;}+// The creator line, tappable. The label is as wide as the view and centred, so the target is narrowed to+// the text itself -- a tap either side of a short name belongs to the page under it, which a pull down+// starts on. Spotify's own control stays concealed where it is and only fires.+- (void)showCreatorLink:(UIView *)control {+ _creatorLink = control;+ BOOL live = control != nil;+ if (_creator.userInteractionEnabled == live) return;+ _creator.userInteractionEnabled = live;+ _creator.accessibilityTraits = live ? UIAccessibilityTraitButton : UIAccessibilityTraitStaticText;+ if (!live || _creator.gestureRecognizers.count) return;+ [_creator addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(sgr_creatorTapped)]];+}++- (void)sgr_creatorTapped {+ SGRActivate(_creatorLink);+}++// The creator line takes a touch only where its text is; everything else of the view is the page's.+- (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;+}+- (void)showShuffle:(UIView *)shuffle play:(UIView *)play trailing:(UIView *)trailingtrailingFallback:(UIImage *)trailingFallback playColor:(UIColor *)playColor {_trailing.fallbackGlyph = trailingFallback;diff --git a/tweak/Sources/Redesigned/Kit/SGRRestyle.h b/tweak/Sources/Redesigned/Kit/SGRRestyle.hindex e7b11ae4..cd9f2375 100644--- a/tweak/Sources/Redesigned/Kit/SGRRestyle.h+++ b/tweak/Sources/Redesigned/Kit/SGRRestyle.h@@ -68,10 +68,15 @@ SGRShadowPlate *SGRShadowPlateIn(UIView *host, const void *key);// cell's own layout pass, and is cheap enough to.//// Only what is nearly as wide as the cell: a badge's black disc, a card's grey and an image's placeholder-// are their own. A cell nested inside the cell (a card in a carousel) is not walked into: its own row-// decides for it.+// are their own. A cell nested inside the cell and narrower than that (a card in a carousel) is not walked+// into: its own row decides for it.void SGRClearCellPaint(UIView *cell);+// Fires one of Spotify's own buttons the way a tap on it would: the first control under `source`, through+// SGRFire, and through -accessibilityActivate when that control answers its touches some other way. For a+// control the redesign conceals and draws itself (the action row's buttons, a header's creator line).+void SGRActivate(UIView *source);+// Fires a control's action the way a tap would: the actions registered for primary action triggered,// else those for touch up inside. NO when the control has neither (an Encore control that reads its// touches through a gesture recognizer); what was found is logged once per class.diff --git a/tweak/Sources/Redesigned/Kit/SGRRestyle.m b/tweak/Sources/Redesigned/Kit/SGRRestyle.mindex 09e5d66e..d31ac5a9 100644--- a/tweak/Sources/Redesigned/Kit/SGRRestyle.m+++ b/tweak/Sources/Redesigned/Kit/SGRRestyle.m@@ -373,11 +373,22 @@ SGRShadowPlate *SGRShadowPlateIn(UIView *host, const void *key) {// disc is 26pt and an avatar's ring the same.static const CGFloat kPaintedShare = 0.75;+// The layer's colour, not the view's. -[UIView backgroundColor] answers only what was set through the+// view; a view painted straight on its layer reads back nil there, and the first pass of this left the+// playlist's Refresh band black while everything beside it cleared (device, trees/continuous/1.txt+// 2026-09-20). The layer is where the paint really is, and where the Kit's repaint hook watches for it.+//+// A cell nested inside the cell is walked into only while it is as wide as the band being looked for:+// a card in a carousel is its own and narrower, while the element framework wraps a cell's content in+// views of its own that are the full width, and stopping at one of those is stopping before the paint.static void clearPaint(UIView *view, UIView *cell, CGFloat wide) {- if (view != cell && [view isKindOfClass:UICollectionViewCell.class]) return;- if (view.bounds.size.width >= wide) {- UIColor *color = view.backgroundColor;- if (color && SGIsBaseSurface(color.CGColor)) view.backgroundColor = UIColor.clearColor;+ BOOL full = view.bounds.size.width >= wide;+ if (view != cell && !full && [view isKindOfClass:UICollectionViewCell.class]) return;+ if (full) {+ // Read off the layer, written through the view, so the two are left saying the same thing: the+ // clear colour lands on both, and reads back with an alpha the next pass does not take for paint.+ CGColorRef color = view.layer.backgroundColor;+ if (color && SGIsBaseSurface(color)) view.backgroundColor = UIColor.clearColor;if (!view.layer.mask && [NSStringFromClass(view.class) containsString:@"GradientView"]) view.layer.mask = [CALayer layer];}for (UIView *sub in view.subviews) clearPaint(sub, cell, wide);@@ -388,6 +399,27 @@ void SGRClearCellPaint(UIView *cell) {clearPaint(cell, cell, cell.bounds.size.width * kPaintedShare);}+// The way a tap on Spotify's own button would fire it: the first control under it, through the actions+// it registered, and through accessibility for an Encore control that reads its touches from a gesture+// recognizer instead -- which is every one of Spotify's own Swift controls.+void SGRActivate(UIView *source) {+ if (!source) return;+ __block UIControl *control = nil;+ SGForEachView(source, ^(UIView *v) {+ if (!control && [v isKindOfClass:UIControl.class]) control = (UIControl *)v;+ });+ if (control && SGRFire(control)) return;+ id target = control ?: source;+ static NSMutableSet<NSString *> *logged;+ if (!logged) logged = [NSMutableSet set];+ NSString *name = NSStringFromClass([target class]);+ if (![logged containsObject:name]) {+ [logged addObject:name];+ SGLog(@"redesign kit: %@ fired through accessibility", name);+ }+ [target accessibilityActivate];+}+BOOL SGRFire(UIControl *control) {if (![control isKindOfClass:UIControl.class]) return NO;__block UIControlEvents registered = control.allControlEvents;diff --git a/tweak/Sources/Redesigned/Library/LibraryHeader.x b/tweak/Sources/Redesigned/Library/LibraryHeader.xindex b92c753e..39d636b1 100644--- a/tweak/Sources/Redesigned/Library/LibraryHeader.x+++ b/tweak/Sources/Redesigned/Library/LibraryHeader.x@@ -1,8 +1,14 @@// Library redesign: the header of Your Library and of a folder inside it, the way Home and Search have theirs// (Redesigned/Home/HomeHeader.x, Redesigned/Search/SearchPage.x). A large title at the leading edge, the avatar-// that opens the side drawer at the trailing edge, the filter chips gone, and the scrim Spotify lays behind the-// header gone with them, the soft scroll edge (Kit/SGREdgeEffect.x) being what keeps the header clear of the-// list scrolling under it.+// that opens the side drawer at the trailing edge, and the scrim Spotify lays behind the header gone, the soft+// scroll edge (Kit/SGREdgeEffect.x) being what keeps the header clear of the list scrolling under it.+//+// The filter chips under the row stay Spotify's, untouched. They were taken out when the redesign was first+// built and the header closed up by the 49pt they left, and sorting a library turned out to be something the+// page cannot do without (issue #20). Spotify already draws them on the system's own glass+// (Reprise_LiquidGlassKit.LiquidGlass.ChipGlassView, trees/clean/library/03.txt:1210), so they belong here as+// they are; with them back the header keeps the height Spotify gives it and the list keeps Spotify's own inset,+// and there is nothing here to resize or to hold.//// Tree (trees/clean/library/03.txt:1159-1247): YourLibraryView holds YourLibraryContentView, the size of the// page, and after it -- so over it -- YourLibraryHeaderView 402x159.33: LiquidGlass.GradientView (the scrim), a@@ -35,12 +41,7 @@// far each control went since -- over the title, off the screen -- until the page laid out again on the way// back from a playlist (issue #21). So the row the controls stand in is watched too, and every pass of its own// places them again.-//-// The chips leaving takes 49pt off the bottom of the header. What the header is shrunk to is the bottom of its-// control row, which hangs off the safe area rather than off the header and so answers the same on every pass,-// shrunk header or not; the chips' own top would move with the header and shrink it again pass after pass. The-// page under it is then closed up the way that page holds its list: the root insets the list's top by the-// header's height, a folder puts its content view below the header instead.+#import "Core/SGCore.h"#import "Redesigned/Kit/SGRKit.h"#import "Library.h"@@ -51,10 +52,7 @@ NSString *const SGRLibraryListIdentifier = @"YourLibraryContent.collectionView";// 24pt glyph 20pt from the screen, and the 32pt avatar inside its own 48pt box 16pt from it, which is the// margin Home gives the avatar.static const CGFloat kRowInset = 8;-// A header shorter than this has not been laid out yet, and nothing is resized from it.-static const CGFloat kHeaderFloor = 88;--static char kTitleKey, kListKey, kInsetKey, kRowWatchedKey;+static char kTitleKey, kRowWatchedKey;static char kRecentsKey, kSearchKey, kPlusKey, kHeaderTitleKey;static char kBackKey, kMenuKey, kFolderPlusKey, kPlayKey, kPauseKey, kFolderTitleKey;@@ -171,53 +169,6 @@ static void layoutTitle(UIView *header, UIView *spotifyTitle, CGFloat leading, Cif (!CGRectEqualToRect(title.frame, frame)) title.frame = frame;}-#pragma mark - the page closing up--// The header without its chips, and the page under it closed up by what they leave. `control` is any of the-// header's 48pt controls: they fill its control row, so the bottom of one is the bottom of the row.-static void resize(UIView *page, UIView *header, UIView *control, UIView *filters) {- if (!filters || !control) return;- CGFloat wanted = CGRectGetMaxY(SGFrameIn(control, header));- if (wanted < kHeaderFloor || wanted > header.bounds.size.height + 0.5) return;-- CGRect frame = header.frame;- if (fabs(frame.size.height - wanted) > 0.5) {- frame.size.height = wanted;- header.frame = frame;- }-- UIView *content = childNamed(page, @"YourLibraryContentView");- if (!content) return;- if (CGRectGetMinY(content.frame) > 0.5) {- // A folder: its content view starts under the header rather than behind it.- CGRect wantedFrame = CGRectMake(0, wanted, page.bounds.size.width, page.bounds.size.height - wanted);- if (!CGRectEqualToRect(content.frame, wantedFrame)) content.frame = wantedFrame;- return;- }-- // The root: the list rests under the header by an inset of its own. The inset is lowered by the band the- // chips had rather than set to the header's height, since what Spotify counts into it is its own business,- // and it is taken once -- after this pass the header no longer says how tall it was -- and then held by the- // setter hook below, so Spotify setting it again from its own pass is not something to answer pass after- // pass.- UIView *found = SGRFindByIdentifier(content, SGRLibraryListIdentifier, &kListKey);- if (![found isKindOfClass:UIScrollView.class]) return;- UIScrollView *list = (UIScrollView *)found;- if (objc_getAssociatedObject(list, &kInsetKey)) return;- CGFloat drop = CGRectGetMaxY(SGFrameIn(filters, header)) - wanted;- CGFloat top = list.contentInset.top;- // Nothing is taken off an inset that does not hold a header yet: the next pass has one.- if (drop < 1 || top < kHeaderFloor || top < drop) return;- objc_setAssociatedObject(list, &kInsetKey, @(top - drop), OBJC_ASSOCIATION_RETAIN_NONATOMIC);- BOOL atTop = list.contentOffset.y <= -top + 0.5;- UIEdgeInsets inset = list.contentInset;- inset.top = top - drop;- list.contentInset = inset;- // A list resting at its top rests that much higher; one scrolled into its rows does not move at all.- if (atTop) list.contentOffset = CGPointMake(list.contentOffset.x, -inset.top);- SGLog(@"redesign library: the chips took %.0fpt off the header, the list rests at %.0f", drop, inset.top);-}-#pragma mark - the two headersstatic BOOL isFace(UIView *view) {@@ -276,12 +227,9 @@ static void layoutRoot(UIView *page) {if (!header) return;[header layoutIfNeeded];SGRLibraryClearScrim(header);- UIView *filters = childNamed(header, @"YourLibraryHeaderContentFiltersView");- vanish(filters);NSArray<UIView *> *trailing = placeRoot(header);if (!trailing.count) return;- resize(page, header, trailing.firstObject, filters);// The first pass that laid the header out, not the first pass at all: a page appearing lays out before// its controls have a size, and a line off that pass would say the header was left as Spotify's.@@ -291,7 +239,7 @@ static void layoutRoot(UIView *page) {logged = YES;SGLog(@"redesign library: header %@, %lu controls at the trailing edge, avatar %@, chips %@",NSStringFromCGRect(header.frame), (unsigned long)trailing.count, face ? @"found" : @"not found",- filters ? @"gone" : @"not found");+ childNamed(header, @"YourLibraryHeaderContentFiltersView") ? @"Spotify's" : @"not found");}}@@ -300,12 +248,9 @@ static void layoutFolder(UIView *page) {if (!header) return;[header layoutIfNeeded];SGRLibraryClearScrim(header);- UIView *filters = childNamed(header, @"YourLibraryHeaderContentFiltersView");- vanish(filters);NSArray<UIView *> *placed = placeFolder(header);if (!placed.count) return;- resize(page, header, placed.firstObject, filters);UIView *back = SGRFindByIdentifier(header, @"YourLibraryFolderHeader.back", &kBackKey);NSUInteger trailing = placed.count - (back ? 1 : 0);@@ -314,21 +259,10 @@ static void layoutFolder(UIView *page) {logged = YES;SGLog(@"redesign library: folder header %@, back %@, %lu controls at the trailing edge, chips %@",NSStringFromCGRect(header.frame), back ? @"found" : @"not found", (unsigned long)trailing,- filters ? @"gone" : @"not found");+ childNamed(header, @"YourLibraryHeaderContentFiltersView") ? @"Spotify's" : @"not found");}}-// Spotify works the list's top inset out from the header it had before the chips went, and sets it again-// whenever it lays the page out. The list keeps the one this file took instead, so the two never take turns-// setting it: a scroll view laying out again from every set of ours is a loop the page cannot settle out of.-%hook _TtC21YourLibrary_CommonKit25YourLibraryCollectionView-- (void)setContentInset:(UIEdgeInsets)inset {- NSNumber *held = objc_getAssociatedObject(self, &kInsetKey);- if (held) inset.top = held.doubleValue;- %orig(inset);-}-%end-%hook _TtC28YourLibrary_YourLibraryXImpl15YourLibraryView- (void)layoutSubviews {%orig;@@ -349,7 +283,6 @@ static void layoutFolder(UIView *page) {SGRequireClasses(@[@"_TtC28YourLibrary_YourLibraryXImpl15YourLibraryView",@"_TtC22YourLibrary_FolderImpl10FolderView",- @"_TtC21YourLibrary_CommonKit25YourLibraryCollectionView",@"_TtC21YourLibrary_CommonKit35YourLibraryHeaderContentFiltersView",@"_TtC29ListeningActivity_ElementsKit21AdaptiveFaceContainer",]);diff --git a/tweak/Sources/Redesigned/Playlist/Playlist.h b/tweak/Sources/Redesigned/Playlist/Playlist.hindex 6ba8bfda..c17e21e5 100644--- a/tweak/Sources/Redesigned/Playlist/Playlist.h+++ b/tweak/Sources/Redesigned/Playlist/Playlist.h@@ -11,6 +11,8 @@// shuffle, a prominent Play capsule, add, and more where Spotify still has it// PlaylistRows.x the track rows on the field with no surface of their own, rounded artwork, a// hairline between them, and the curation pills collapsed+// PlaylistMenu.x Sort and Mix, the two of the curation pills the ⋯ menu does not already offer,+// put on that menu's own sheet//// Every hook installs only while Redesigned UI is on (SGRedesignedUI); the native look's do not then.// Threading: main thread only.@@ -18,10 +20,21 @@// The page's list (trees/clean/playlist/02.txt:23).extern NSString *const SGRPlaylistListIdentifier;+// PlaylistMenu.x. The row of curation pills over the first track (own-playlist/01.txt:33).+extern NSString *const SGRPlaylistCurationIdentifier;+// The page keeps the curation row the cell `cell` is laying out, so the ⋯ sheet has Spotify's own Sort and+// Mix buttons to fire once the list has scrolled past them. Does nothing for any other cell.+void SGRPlaylistTakeCuration(UIView *cell);+// And keeps Spotify's own Sort button from the header's find-on-page toolbar, which sorts the same list+// and, unlike the pill, is in the header rather than in a cell the list reuses.+void SGRPlaylistTakeSort(UIView *page, UIView *button);// The playlist page `view` is on, or nil: SPTFreeTierPlaylistEncoreHeaderViewController's own view, the one// the tree names PL.Header, for anything under the header, and FTPViewController's view for the list.UIViewController *SGRPlaylistHeaderOf(UIView *view);+// The page `view` is on -- FTPViewController's own view, the one the field and the pinned ⋯ belong to --+// or nil when it is on no playlist page.+UIView *SGRPlaylistPageOf(UIView *view);// PlaylistField.x. The field belongs to the page `view` is on, found by walking up from it, so two playlist// pages on the navigation stack keep a field each.diff --git a/tweak/Sources/Redesigned/Playlist/PlaylistField.x b/tweak/Sources/Redesigned/Playlist/PlaylistField.xindex 620847bc..f8ae853c 100644--- a/tweak/Sources/Redesigned/Playlist/PlaylistField.x+++ b/tweak/Sources/Redesigned/Playlist/PlaylistField.x@@ -90,13 +90,16 @@ static SGRArtworkField *fieldIn(UIView *page) {SGRedesignForceFlags(@"playlist", @{// The page the trees were recorded with (trees/clean/playlist/02.txt).@"ios-feature-freetierplaylist.use_collection_view": @YES,- // The Music app keeps share and more out of the row under the cover; this is Spotify's own way of- // moving the more button up into the navigation bar, and the action row is laid out from whichever- // of the buttons it still finds, so it reads either way.- @"ios-feature-freetierplaylist.context_menu_in_navigation_bar_enabled": @YES,+ // More stays in Spotify's own header row, concealed with the rest of the block, and the redesign+ // pins its own glass ⋯ over the page (Kit/SGRActionRow.h). Moving it into the navigation bar --+ // which this flag is Spotify's own way of doing, and which the redesign forced until 2026-09-20 --+ // put it somewhere Spotify empties on the way down the page: scrolled, the bar's trailing slot held+ // an empty 48x44 view and there was no ⋯ anywhere (trees/continuous/1.txt, issue #57).+ @"ios-feature-freetierplaylist.context_menu_in_navigation_bar_enabled": @NO,// A row is a cover, a title and an artist. The video badge is none of them.@"ios-feature-freetierplaylist.hide_video_badge_for_tracks": @YES,- // The curation pills are collapsed (PlaylistRows.x); pinned they would be collapsed on every scroll.+ // The curation row keeps Sort and Mix and gives the rest up to ⋯ (PlaylistRows.x). It scrolls away+ // with the tracks rather than pinning itself over them, as the Music app's sort does.@"ios-feature-freetierplaylist.pin_curation_actions": @NO,});if (!SGRedesignedUI()) return;diff --git a/tweak/Sources/Redesigned/Playlist/PlaylistHeader.x b/tweak/Sources/Redesigned/Playlist/PlaylistHeader.xindex 8ad60de8..8c95677c 100644--- a/tweak/Sources/Redesigned/Playlist/PlaylistHeader.x+++ b/tweak/Sources/Redesigned/Playlist/PlaylistHeader.x@@ -42,7 +42,7 @@ static const CGFloat kMinHero = 120, kMinCover = 80;static char kCoverKey, kMetaKey, kPlayKey, kLayoutKey, kToolbarKey, kScrimKey, kBarScrimKey;static char kShuffleKey, kAddKey, kDownloadKey, kInfoKey, kBlockHeightKey, kBlockWatchedKey;-static char kHeroKey, kHeroHeightKey, kRowKey, kRowWatchedKey;+static char kHeroKey, kHeroHeightKey, kRowKey, kRowWatchedKey, kMoreKey, kCreatorKey, kPinnedMoreKey, kSortKey;#pragma mark - finding things@@ -52,6 +52,17 @@ static char kHeroKey, kHeroHeightKey, kRowKey, kRowWatchedKey;@implementation SGRWeakView@end+// The page the header is on: FTPViewController's own view, which holds the field, the list and the header+// and does not scroll. Walked from the header rather than taken off sgr_playlistRoot, so a playlist under+// another one on the stack pins its own ⋯ and not the one on top.+UIView *SGRPlaylistPageOf(UIView *view) {+ for (UIResponder *r = view; r; r = r.nextResponder) {+ if (![r isKindOfClass:UIViewController.class]) continue;+ if ([NSStringFromClass(r.class) containsString:@"FTPViewController"]) return ((UIViewController *)r).viewIfLoaded;+ }+ return nil;+}+UIViewController *SGRPlaylistHeaderOf(UIView *view) {for (UIResponder *r = view; r; r = r.nextResponder) {if (![r isKindOfClass:UIViewController.class]) continue;@@ -366,6 +377,17 @@ static void showPlaylist(SGRHeaderInfo *info, UIView *block, UIView *root, id mo// Only what the button draws goes: a concealed layer still sends the actions the capsule fires.conceal(play);+ // 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)];++ // 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.+ UIView *page = SGRPlaylistPageOf(root);+ SGRPinnedMore(page, &kPinnedMoreKey, SGRFindByIdentifier(block, @"Components.UI.ContextMenuButton*", &kMoreKey));+ SGRPlaylistTakeSort(page, SGRFindByIdentifier(root, @"Components.Header.UI.Toolbar.Button", &kSortKey));+static BOOL logged;if (!logged && info.window && (title || play)) {logged = YES;diff --git a/tweak/Sources/Redesigned/Playlist/PlaylistMenu.x b/tweak/Sources/Redesigned/Playlist/PlaylistMenu.xnew file mode 100644index 00000000..a51e1e05--- /dev/null+++ b/tweak/Sources/Redesigned/Playlist/PlaylistMenu.x@@ -0,0 +1,373 @@+// Playlist redesign: Sort and Mix on the playlist's ⋯ sheet, where the rest of Spotify's curation row+// already is.+//+// Spotify puts seven pills over the first track -- Add, Mix, Notes, Video, Edit, Sort, Name & details+// (own-playlist/01.txt:33) -- and the Music app has none of them: its playlist sorts from its own ⋯ menu.+// So PlaylistRows.x closes the row up and these two rows stand in its place, because Sort and Mix are the+// only two of the seven the ⋯ menu does not already offer.+//+// **Why these are rows of the mod's own and not rows of Spotify's menu.** The sheet is+// ContextMenu_InternalImpl.ContextMenuViewController, a table whose rows come from Swift item factories+// with no ObjC surface: nothing can be read out of them and nothing can be put between them. What can be+// set is the table's header or footer view, which is how Speed and pitch has ridden on the player's menu+// since it shipped (Shared/Player/SpeedPitchMenu.x). So the block goes in the header, above Spotify's own+// rows, and is laid out by hand at the table's width.+//+// **And why not a menu of the redesign's own instead.** Building the sheet would mean owning its contents:+// every row Spotify offers for a playlist, which varies by whose playlist it is, by market, by account and+// by flag, each in the app's language and each doing something only Spotify's own code knows how to do.+// None of that can be read off the item factories, so it would have to be a hard-coded list in one+// language that goes stale the day Spotify adds a row -- the same trap the album's footer and the artist's+// sections are written to avoid. Spotify keeps its rows; the mod adds to them.+//+// Which sheet is the playlist's: the ⋯ that opened it is the redesign's own pinned button+// (Kit/SGRActionRow.h), so it records its page as it is tapped and a sheet that appears within+// SGRPinnedMoreWindow of that belongs to it. Under the native look nothing pins a ⋯ and nothing here runs.+//+// What each row does is fire Spotify's own pill, so the action, the sheet Sort opens and the state Mix+// keeps are all Spotify's; the words are read off the pills for the same reason. The pills sit in a list+// cell closed up to nothing, which the page hands over as it lays out (SGRPlaylistTakeCuration) and which+// is held from the page, so they are still there to fire once the list has scrolled past them.+#import "Core/SGCore.h"+#import "Redesigned/Kit/SGRKit.h"+#import "Playlist.h"++NSString *const SGRPlaylistCurationIdentifier = @"PlaylistCuration.Row.CurationActionsToolbar";++// Mix says what it is in its identifier; Sort is an Encore.Button.Primary like Video, Edit and Name &+// details, and its only word is the word in the app's language, so it is told apart by the glyph it draws+// (SpotifyShared has `sort`, `sortDown`, `sortUp` and `arrowUpDown`, and Encore's icon knows its own name).+static NSString *const kMixIdentifier = @"ListPlatform.ToolbarActions.MixButton";++// The sheet's own measures and type: this draws on Spotify's sheet, not on a page of the redesign's, so it+// takes the sheet's side margin and row height rather than the Kit's tokens, as Speed and pitch does.+static const CGFloat kRowHeight = 56, kSideMargin = 16, kGlyphSide = 24, kGlyphGap = 16;++static char kToolbarKey, kSortKey, kBlockKey, kDecidedKey;++#pragma mark - Spotify's pills++// The SPTEncoreIcon an Encore icon view was built with, which knows its own name. Encore keeps it in a+// Swift ivar with no getter, as Redesigned/Navbar/TabBar.x found -- but not always the same one: the view+// holds both `icon` and `experimentalIcon` (nm on SpotifyShared), and reading `icon` alone left the Sort+// pill unrecognised on the phone while Mix, which is known by its identifier, came through+// (device 2026-09-20). So every object ivar the view has is asked, and the first that knows a name answers.+static NSString *glyphName(UIView *iconView) {+ unsigned int count = 0;+ Ivar *ivars = class_copyIvarList(iconView.class, &count);+ NSString *found = nil;+ for (unsigned int i = 0; i < count && !found; i++) {+ const char *type = ivar_getTypeEncoding(ivars[i]);+ if (!type || type[0] != '@') continue;+ id value = object_getIvar(iconView, ivars[i]);+ if (![value respondsToSelector:@selector(name)]) continue;+ NSString *name = [value name];+ if ([name isKindOfClass:NSString.class] && name.length) found = name;+ }+ free(ivars);+ return found;+}++static NSString *pillGlyph(UIView *pill) {+ static Class iconClass;+ if (!iconClass) iconClass = NSClassFromString(@"SPTEncoreIconView");+ __block NSString *name = nil;+ SGForEachView(pill, ^(UIView *v) {+ if (!name && iconClass && [v isKindOfClass:iconClass]) name = glyphName(v);+ });+ return name;+}++static NSString *pillWord(UIView *pill) {+ __block NSString *word = nil;+ SGForEachView(pill, ^(UIView *v) {+ if (word || ![v isKindOfClass:UILabel.class]) return;+ NSString *text = [((UILabel *)v).text stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet];+ if (text.length) word = text;+ });+ return word ?: pill.accessibilityLabel;+}++// The two pills of the row, in the order they are to read on the sheet. Either may be missing: a playlist+// of someone else's has no Mix, and a build without sorting has no Sort.+static BOOL isSortGlyph(NSString *glyph) {+ NSString *name = glyph.lowercaseString;+ return [name containsString:@"sort"] || [name containsString:@"arrowupdown"] || [name containsString:@"filter"];+}++static void pillsIn(UIView *toolbar, UIView **sort, UIView **mix) {+ __block UIView *foundSort = nil, *foundMix = nil;+ __block NSMutableArray<NSString *> *seen = [NSMutableArray array];+ SGForEachView(toolbar, ^(UIView *v) {+ NSString *identifier = v.accessibilityIdentifier;+ // The pills, and only the pills: the toolbar itself carries an identifier too, and the first glyph+ // under it is whichever pill comes first.+ if (!identifier.length || [identifier isEqualToString:SGRPlaylistCurationIdentifier]) return;+ if (!foundMix && [identifier containsString:kMixIdentifier]) {+ foundMix = v;+ return;+ }+ NSString *glyph = pillGlyph(v);+ if (glyph) [seen addObject:[NSString stringWithFormat:@"%@=%@", pillWord(v) ?: identifier, glyph]];+ if (!foundSort && isSortGlyph(glyph)) foundSort = v;+ });+ // Said once, so a build that renames the sort glyph says what it calls it instead of going quiet.+ static BOOL logged;+ if (!logged && seen.count) {+ logged = YES;+ SGLog(@"redesign playlist: the curation pills draw %@; sort %@", [seen componentsJoinedByString:@", "],+ foundSort ? @"found" : @"NOT FOUND");+ }+ *sort = foundSort;+ *mix = foundMix;+}++void SGRPlaylistTakeSort(UIView *page, UIView *button) {+ if (page && button && objc_getAssociatedObject(page, &kSortKey) != button) {+ objc_setAssociatedObject(page, &kSortKey, button, OBJC_ASSOCIATION_RETAIN_NONATOMIC);+ }+}++// The cell that carries the curation row, as it lays out. Held from the page rather than from the cell: the+// list reuses the cell once it has scrolled past, and the sheet is opened from the top of a page one is+// usually well down. Held strongly for the same reason -- the element view Spotify binds to the toolbar is+// the toolbar's own, so it goes on answering wherever the cell it was in ends up.+void SGRPlaylistTakeCuration(UIView *cell) {+ UIView *toolbar = SGRFindByIdentifier(cell, SGRPlaylistCurationIdentifier, &kToolbarKey);+ UIView *page = toolbar ? SGRPlaylistPageOf(cell) : nil;+ if (!page || objc_getAssociatedObject(page, &kToolbarKey) == toolbar) return;+ objc_setAssociatedObject(page, &kToolbarKey, toolbar, OBJC_ASSOCIATION_RETAIN_NONATOMIC);+ UIView *sort = nil, *mix = nil;+ pillsIn(toolbar, &sort, &mix);+ static BOOL logged;+ if (!logged) {+ logged = YES;+ SGLog(@"redesign playlist: the curation row is the page's, sort %@, mix %@",+ sort ? pillWord(sort) : @"not found", mix ? pillWord(mix) : @"not found");+ }+}++#pragma mark - the block on the sheet++// One row: a glyph, a word, and the whole width of the sheet to be tapped on. Spotify's own rows are drawn+// by its table, so this only has to read as one of them.+@interface SGRMenuRow : UIControl+@property (nonatomic, weak) UIView *pill;+@end++@implementation SGRMenuRow {+ UIImageView *_glyph;+ UILabel *_word;+}++- (instancetype)initWithFrame:(CGRect)frame {+ if (!(self = [super initWithFrame:frame])) return nil;+ _glyph = [UIImageView new];+ _glyph.contentMode = UIViewContentModeScaleAspectFit;+ _glyph.tintColor = UIColor.whiteColor;+ _glyph.userInteractionEnabled = NO;+ [self addSubview:_glyph];++ _word = [UILabel new];+ _word.textColor = UIColor.whiteColor;+ _word.font = [UIFont systemFontOfSize:[UIFont preferredFontForTextStyle:UIFontTextStyleBody].pointSize+ weight:UIFontWeightRegular];+ _word.userInteractionEnabled = NO;+ [self addSubview:_word];++ self.isAccessibilityElement = YES;+ self.accessibilityTraits = UIAccessibilityTraitButton;+ [self addTarget:self action:@selector(sgr_down) forControlEvents:UIControlEventTouchDown];+ [self addTarget:self action:@selector(sgr_up)+ forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside | UIControlEventTouchCancel];+ return self;+}++- (void)showWord:(NSString *)word symbol:(NSString *)symbol {+ if (![_word.text isEqualToString:word]) {+ _word.text = word;+ self.accessibilityLabel = word;+ }+ if (!_glyph.image) _glyph.image = [UIImage systemImageNamed:symbol];+}++- (void)layoutSubviews {+ [super layoutSubviews];+ CGRect bounds = self.bounds;+ _glyph.frame = CGRectMake(kSideMargin, round((bounds.size.height - kGlyphSide) / 2), kGlyphSide, kGlyphSide);+ CGFloat lead = kSideMargin + kGlyphSide + kGlyphGap;+ [_word sizeToFit];+ _word.frame = CGRectMake(lead, round((bounds.size.height - _word.bounds.size.height) / 2),+ MAX(0, bounds.size.width - lead - kSideMargin), _word.bounds.size.height);+}++- (void)sgr_down {+ self.backgroundColor = [UIColor colorWithWhite:1 alpha:0.10];+}++- (void)sgr_up {+ self.backgroundColor = UIColor.clearColor;+}++@end++@interface SGRMenuBlock : UIView+@property (nonatomic, weak) UIViewController *menu;+- (void)showSort:(UIView *)sort mix:(UIView *)mix;+- (CGFloat)wantedHeight;+@end++@implementation SGRMenuBlock {+ SGRMenuRow *_sort, *_mix;+}++- (instancetype)initWithFrame:(CGRect)frame {+ if (!(self = [super initWithFrame:frame])) return nil;+ _sort = [[SGRMenuRow alloc] initWithFrame:CGRectZero];+ _mix = [[SGRMenuRow alloc] initWithFrame:CGRectZero];+ for (SGRMenuRow *row in @[_sort, _mix]) {+ row.hidden = YES;+ [row addTarget:self action:@selector(sgr_rowTapped:) forControlEvents:UIControlEventTouchUpInside];+ [self addSubview:row];+ }+ return self;+}++// The glyphs are the system's rather than Spotify's: Encore draws its own into a view of its own, and a+// copy of one is a snapshot to keep right, where these two say the same thing on every build. The words+// stay Spotify's, so the rows are in the app's language.+- (void)showSort:(UIView *)sort mix:(UIView *)mix {+ _sort.pill = sort;+ _mix.pill = mix;+ if (sort) [_sort showWord:pillWord(sort) symbol:@"arrow.up.arrow.down"];+ if (mix) [_mix showWord:pillWord(mix) symbol:@"slider.horizontal.3"];+ _sort.hidden = sort == nil;+ _mix.hidden = mix == nil;+ [self setNeedsLayout];+}++- (CGFloat)wantedHeight {+ CGFloat height = 0;+ for (SGRMenuRow *row in @[_sort, _mix]) height += row.hidden ? 0 : kRowHeight;+ return height;+}++- (void)layoutSubviews {+ [super layoutSubviews];+ CGFloat y = 0;+ for (SGRMenuRow *row in @[_sort, _mix]) {+ if (row.hidden) continue;+ row.frame = CGRectMake(0, y, self.bounds.size.width, kRowHeight);+ y += kRowHeight;+ }+}++// Spotify's Sort opens a sheet of its own and its Mix changes the page under this one, so the menu closes+// first and the pill is fired once it has: firing under an open sheet would put Spotify's next sheet behind+// this one.+- (void)sgr_rowTapped:(SGRMenuRow *)row {+ UIView *pill = row.pill;+ UIViewController *menu = self.menu;+ void (^fire)(void) = ^{+ SGRActivate(pill);+ static BOOL logged;+ if (!logged) {+ logged = YES;+ SGLog(@"redesign playlist: the sheet fired %@, still on screen: %@", row.accessibilityLabel,+ pill.window ? @"yes" : @"no");+ }+ };+ UIViewController *presented = menu.navigationController ?: menu;+ if (presented.presentingViewController) [presented dismissViewControllerAnimated:YES completion:fire];+ else fire();+}++@end++#pragma mark - the sheet's pass++static UITableView *tableIn(UIView *root, int depth) {+ if ([root isKindOfClass:UITableView.class]) return (UITableView *)root;+ if (depth > 5) return nil;+ for (UIView *child in root.subviews) {+ UITableView *table = tableIn(child, depth + 1);+ if (table) return table;+ }+ return nil;+}++// The page this sheet belongs to, decided once: the pinned ⋯ that opened it says which page it is on, and+// only for the few seconds after its tap.+static UIView *pageFor(UIViewController *menu) {+ id decided = objc_getAssociatedObject(menu, &kDecidedKey);+ if (decided) return decided == NSNull.null ? nil : decided;+ UIView *page = SGRPinnedMoreRecentPage();+ if (page && !objc_getAssociatedObject(page, &kToolbarKey)) page = nil;+ objc_setAssociatedObject(menu, &kDecidedKey, page ?: (id)NSNull.null, OBJC_ASSOCIATION_RETAIN_NONATOMIC);+ return page;+}++static void install(UIViewController *menu) {+ UIView *root = menu.viewIfLoaded;+ UIView *page = root ? pageFor(menu) : nil;+ if (!page) return;+ UITableView *table = tableIn(root, 0);+ CGFloat width = table.bounds.size.width;+ if (!table || width <= 0) return;+ // Spotify already uses the header on some sheets; there the rows go under its own instead.+ SGRMenuBlock *block = objc_getAssociatedObject(menu, &kBlockKey);+ BOOL inFooter = block ? [objc_getAssociatedObject(block, &kBlockKey) boolValue] : NO;+ if (!block) {+ BOOL headerFree = !table.tableHeaderView || table.tableHeaderView.bounds.size.height < 1;+ inFooter = !headerFree;+ if (inFooter && table.tableFooterView && table.tableFooterView.bounds.size.height >= 1) {+ SGLog(@"redesign playlist: the sheet's header and footer are both Spotify's, sort and mix left out");+ objc_setAssociatedObject(menu, &kDecidedKey, NSNull.null, OBJC_ASSOCIATION_RETAIN_NONATOMIC);+ return;+ }+ block = [[SGRMenuBlock alloc] initWithFrame:CGRectZero];+ block.menu = menu;+ objc_setAssociatedObject(block, &kBlockKey, @(inFooter), OBJC_ASSOCIATION_RETAIN_NONATOMIC);+ objc_setAssociatedObject(menu, &kBlockKey, block, OBJC_ASSOCIATION_RETAIN_NONATOMIC);+ }++ // Sort is Spotify's own header button where the page has one -- one identifier, in the header, never+ // reused -- and the curation pill only where it has not, which is how it was found before the header's+ // button was (device 2026-09-20: the pill's glyph did not answer and the row went missing).+ UIView *sort = nil, *mix = nil;+ pillsIn(objc_getAssociatedObject(page, &kToolbarKey), &sort, &mix);+ sort = objc_getAssociatedObject(page, &kSortKey) ?: sort;+ [block showSort:sort mix:mix];+ CGFloat height = [block wantedHeight];+ if (height < 1) {+ objc_setAssociatedObject(menu, &kDecidedKey, NSNull.null, OBJC_ASSOCIATION_RETAIN_NONATOMIC);+ return;+ }++ CGRect frame = CGRectMake(0, 0, width, height);+ UIView *placed = inFooter ? table.tableFooterView : table.tableHeaderView;+ if (placed == block && CGRectEqualToRect(block.frame, frame)) return;+ block.frame = frame;+ if (inFooter) table.tableFooterView = block;+ else table.tableHeaderView = block;+ [table invalidateIntrinsicContentSize];+ static BOOL logged;+ if (!logged) {+ logged = YES;+ SGLog(@"redesign playlist: the ⋯ sheet took %.0fpt of sort and mix in its %@", height,+ inFooter ? @"footer" : @"header");+ }+}++%hook _TtC24ContextMenu_InternalImpl25ContextMenuViewController+- (void)viewDidLayoutSubviews {+ %orig;+ install((UIViewController *)self);+}+%end++%ctor {+ if (!SGRedesignedUI()) return;+ %init;+ SGRequireClasses(@[@"_TtC24ContextMenu_InternalImpl25ContextMenuViewController"]);+}diff --git a/tweak/Sources/Redesigned/Playlist/PlaylistRows.x b/tweak/Sources/Redesigned/Playlist/PlaylistRows.xindex 781fe472..a287921e 100644--- a/tweak/Sources/Redesigned/Playlist/PlaylistRows.x+++ b/tweak/Sources/Redesigned/Playlist/PlaylistRows.x@@ -10,9 +10,11 @@// Spotify's type and its spacing are left alone: the row is 64pt for a title of 18pt, and a larger font of// the Kit's would be cut off by the box the element framework measured for it.//-// The pills over the first row of a playlist of one's own (Add, Mix, Notes, Video, Edit, Sort, Name &-// details -- own-playlist/01.txt:33) are a cell of the list. ListUXPlatform_LayoutKit.ListLayout gives every-// item its height, so the cell can only close up where the layout asks it how tall it wants to be.+// The pills over the first row (own-playlist/01.txt:33) are a cell of the list: Add, Mix, Notes, Video,+// Edit, Sort and Name & details. The row is closed up -- ListUXPlatform_LayoutKit.ListLayout gives every+// item its height, so the cell can only close up where the layout asks it how tall it wants to be -- and+// Sort and Mix are put on the ⋯ sheet instead (PlaylistMenu.x), where the rest of the row already is. The+// cell is handed over as it lays out, so the sheet has Spotify's own buttons to fire.//// Not every cell of the list is a track row. Under the tracks Spotify puts the extender -- Recommended// songs, its rows and Refresh (ListUXPlatformConsumers_PlaylistExtenderImpl) -- and its heading and its@@ -26,7 +28,7 @@// Under the text rather than the whole row, as the Music app draws it; the trailing end clears the page margin.static const CGFloat kHairline = 0.5, kHairlineGap = 12;-static char kRowKey, kArtKey, kSubtitleKey, kLineKey;+static char kRowKey, kArtKey, kSubtitleKey, kLineKey, kToolbarKey;static UIView *identified(UIView *root, NSString *identifier, const void *cacheKey) {return SGRFindByIdentifier(root, identifier, cacheKey);@@ -90,12 +92,13 @@ static void applyRow(UIView *cell) {UIView *cell = (UIView *)self;if (!SGRPlaylistHeaderOf(cell)) return;SGRClearCellPaint(cell);+ SGRPlaylistTakeCuration(cell);applyRow(cell);}- (UICollectionViewLayoutAttributes *)preferredLayoutAttributesFittingAttributes:(UICollectionViewLayoutAttributes *)attributes {UICollectionViewLayoutAttributes *result = %orig;- if (!SGRFindByIdentifier((UIView *)self, @"PlaylistCuration.Row.CurationActionsToolbar", NULL)) return result;+ if (!SGRFindByIdentifier((UIView *)self, SGRPlaylistCurationIdentifier, &kToolbarKey)) return result;result.size = CGSizeMake(result.size.width, 0);((UIView *)self).clipsToBounds = YES;static dispatch_once_t once;