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 episode page and the playlist's Recommended songs no longer paint black bands over the page colour
Vojtěch Škopek2edcb6cede3b
diff --git a/docs/tweaks.md b/docs/tweaks.mdindex 77d64208..acad5aa2 100644--- a/docs/tweaks.md+++ b/docs/tweaks.md@@ -164,7 +164,8 @@ Redesigned:there and the row carries the Kit's stand-ins, which draw their glyph and fire them. Under the trackseverything the server sends is dropped -- more by the artist, videos, concerts, merch, you might alsolike, and whatever it adds next -- but the album's own line and its copyright (Album.h lists its- files). Laid out on the Mac against harness/album/+ files). A podcast's episode page is the same template, so it is given the same field, and what it+ paints over it is taken off. Laid out on the Mac against harness/album/Haptics/ Vibrations (Haptics.h lists its files): a tap of UIKit's feedback generators for the player's and the nowplaying bar's controls, the scrubber's tenths and ends, cover swipes, gestures and the lyrics page's tap toseek, at the strength set for them (ControlHaptics.x, SGRFeedback.m); and Music Haptics, Core Hapticsdiff --git a/harness/album/main.m b/harness/album/main.mindex 2d218e3a..06cc39e6 100644--- a/harness/album/main.m+++ b/harness/album/main.m@@ -328,6 +328,38 @@ static NSString *trailingLabel(UIView *root) {[_footerCells addObject:cell];}+ // An episode page is this same template with cells of its own (device, trees/continuous/1.txt+ // 2026-09-20), and every one of them paints the black the AMOLED made of Spotify's base surface over+ // the field. Put under the tracks, clear of the footer the redesign drops: what is proved here is the+ // paint, not the layout. A card inside one of them is a cell of its own and keeps its own black.+ NSArray *episode = @[@[@"Episode Transcript", @50], @[@"", @24], @[@"", @4.67]];+ CGFloat episodeY = _tracksBottom + 140;+ NSMutableArray<UIView *> *episodePaints = [NSMutableArray array];+ for (NSArray *item in episode) {+ CGFloat height = [item[1] doubleValue];+ UICollectionViewCell *cell = [[_TtC12Element_List18CollectionViewCell alloc]+ initWithFrame:CGRectMake(0, episodeY, W, height)];+ [collection addSubview:cell];+ UIView *content = box(cell.contentView, UIView.class, cell.contentView.bounds, nil);+ UIView *paint = box(content, UIView.class, content.bounds, nil);+ paint.backgroundColor = UIColor.blackColor;+ if ([item[0] length]) label(paint, CGRectMake(16, 16, W - 48, 18), item[0], 13, UIColor.whiteColor, @"Encore.Label");+ [episodePaints addObject:paint];+ episodeY += height;+ }+ UICollectionViewCell *carousel = [[_TtC12Element_List18CollectionViewCell alloc]+ initWithFrame:CGRectMake(0, episodeY, W, 80)];+ [collection addSubview:carousel];+ UICollectionViewCell *card = [[_TtC12Element_List18CollectionViewCell alloc] initWithFrame:CGRectMake(16, 0, 153, 80)];+ card.backgroundColor = UIColor.blackColor;+ [carousel.contentView addSubview:card];++ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{+ NSLog(@"[harness] the episode page's paint: %@ %@ %@, and the card inside a cell %@",+ episodePaints[0].backgroundColor ?: @"clear", episodePaints[1].backgroundColor ?: @"clear",+ episodePaints[2].backgroundColor ?: @"clear", card.backgroundColor ?: @"clear");+ });+// the sticky navigation bar, its gradient hidden until the page scrollsUIView *navBar = box(page, _TtC28EncoreConsumerMobile_BaseKit20HeaderNavigationBar.class, CGRectMake(0, 0, W, 118), @"CreativeWorkPlatform.HeaderNavigationBar");UIView *navGradient = box(navBar, _TtC19LegacyUI_ECMCoreKit12GradientView.class, navBar.bounds, nil);diff --git a/harness/playlist/main.m b/harness/playlist/main.mindex b22b06e4..5c2d11f5 100644--- a/harness/playlist/main.m+++ b/harness/playlist/main.m@@ -317,6 +317,41 @@ static void buildLikedSongs(UIViewController *page, CGFloat W) {label(row, CGRectMake(76, 32, W - 130, 18), tracks[i][1], 14, [UIColor colorWithWhite:1 alpha:0.7], @"Track.Row.Content.Subtitle");}+ // 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;+ UIView *heading = box(list, _TtC35ListUXPlatform_FreeTierPlaylistImpl25ElementCollectionViewCell.class,+ CGRectMake(0, extenderTop, W, 68), nil);+ UIView *headingPaint = box(heading, UIView.class, heading.bounds, @"PlaylistExtender.Heading");+ headingPaint.backgroundColor = UIColor.blackColor;+ label(headingPaint, CGRectMake(16, 16, W - 32, 21), @"Recommended songs", 17, UIColor.whiteColor, @"title");+ label(headingPaint, CGRectMake(16, 37, W - 32, 16), @"Based on the songs of this playlist", 11,+ [UIColor colorWithWhite:0.7 alpha:1], @"subtitle");++ UIView *extenderRow = box(list, _TtC35ListUXPlatform_FreeTierPlaylistImpl25ElementCollectionViewCell.class,+ CGRectMake(0, extenderTop + 68, W, 64), nil);+ UIView *extenderPaint = box(extenderRow, UIView.class, extenderRow.bounds, @"PlaylistExtender.Row");+ label(extenderPaint, CGRectMake(76, 22, W - 130, 20), @"Airplanes", 16, UIColor.whiteColor, nil);+ // A badge's disc is its own black and is not as wide as the cell: it stays.+ UIView *badge = box(extenderPaint, UIView.class, CGRectMake(W - 72, 19, 26, 26), @"PlaylistExtender.Badge");+ badge.backgroundColor = UIColor.blackColor;+ badge.layer.cornerRadius = 13;++ 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 *button = box(refreshPaint, UIView.class, CGRectMake(W / 2 - 36, 8, 72, 32), @"section-header-button");+ button.backgroundColor = UIColor.whiteColor;+ button.layer.cornerRadius = 16;++ 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");+ });+if ([NSProcessInfo.processInfo.arguments containsObject:@"liked"]) {buildLikedSongs(page, W);[self.window makeKeyAndVisible];diff --git a/tweak/Sources/Redesigned/Album/AlbumField.x b/tweak/Sources/Redesigned/Album/AlbumField.xindex f3031e85..874d22eb 100644--- a/tweak/Sources/Redesigned/Album/AlbumField.x+++ b/tweak/Sources/Redesigned/Album/AlbumField.x@@ -21,7 +21,12 @@// Spotify's arrives, or for good if it never does, and before either the field is the neutral one.//// The page is the album's by its identifier, which is how Native/Album/Album.x has told it apart since it-// shipped: the artist page is TemplateKit's TemplateView instead, and podcasts are their own framework.+// shipped: the artist page is TemplateKit's TemplateView instead. A podcast's episode page is built from+// this same template (trees/continuous/1.txt 2026-09-20: CreativeWorkTemplateView over Element_List cells+// of EpisodePage_ModernEpisodePageImpl), so it is given the field too, and everything below that holds for+// the album holds for it. What it puts on the field is its own -- a description, a comments card, Episode+// Transcript, See all episodes -- and only the paint is taken off it; AlbumHeader.x and AlbumSections.x+// look for the album's own elements and find none of them there.#import "Core/SGCore.h"#import "Redesigned/Kit/SGRKit.h"#import "Album.h"@@ -42,6 +47,17 @@ UIView *SGRAlbumPageOf(UIView *view) {return nil;}+// A cell of the page's own list rather than a card inside one of its carousels: a card is a cell of the+// same class, and the row that carries the carousel decides for it (Artist/ArtistSections.x). So the walk+// up to the page stops at the first cell it meets on the way.+static BOOL isPageCell(UIView *cell) {+ for (UIView *v = cell.superview; v; v = v.superview) {+ if ([v isKindOfClass:UICollectionViewCell.class]) return NO;+ if ([v.accessibilityIdentifier isEqualToString:kPageIdentifier]) return YES;+ }+ return NO;+}+#pragma mark - the page's fieldstatic SGRArtworkField *fieldOn(UIView *view) {@@ -105,6 +121,18 @@ static SGRArtworkField *fieldIn(UIView *page) {}%end+// Every cell of the list paints the base surface too, and the repaint hook misses it: a cell is painted+// before it is inside the page, and a reused one brings its old paint with it. On the episode page the+// Episode Transcript row, the empty section under it and the rule under that sat on black bands (device,+// trees/continuous/1.txt 2026-09-20).+%hook _TtC12Element_List18CollectionViewCell+- (void)layoutSubviews {+ %orig;+ UIView *cell = (UIView *)self;+ if (isPageCell(cell)) SGRClearCellPaint(cell);+}+%end+%ctor {// Registered whatever the switch says: the flag rows elsewhere lock to these while it is on.SGRedesignForceFlags(@"album", @{@@ -123,5 +151,6 @@ static SGRArtworkField *fieldIn(UIView *page) {SGRequireClasses(@[@"_TtC28CreativeWorkPlatform_PageKit24CreativeWorkTemplateView",@"_TtC32CreativeWorkPlatform_TemplateKit28CreativeWorkTemplateListView",+ @"_TtC12Element_List18CollectionViewCell",]);}diff --git a/tweak/Sources/Redesigned/Artist/ArtistSections.x b/tweak/Sources/Redesigned/Artist/ArtistSections.xindex 50fe6951..0cbac89e 100644--- a/tweak/Sources/Redesigned/Artist/ArtistSections.x+++ b/tweak/Sources/Redesigned/Artist/ArtistSections.x@@ -120,23 +120,6 @@ static void dropHeadingOf(UICollectionView *list, NSIndexPath *path) {dispatch_async(dispatch_get_main_queue(), ^{ [weakList.collectionViewLayout invalidateLayout]; });}-// What a cell of the page paints over the field, cleared: Spotify's base surface, which the redesign's AMOLED-// black has already made black -- the "You liked" row (an Encore ListRow) and every carousel's collection-// (Home_CarouselKit.TouchCancellingCollectionView) sat on black bands (device, trees/continuous/3.txt-// 2026-09-18) -- and the fade Popular's "See more" draws over its last track, a GradientView as wide as the-// page, which the black made a dark band. The repaint hook misses them: the cells are painted before they are-// inside the page. Only what is nearly as wide as the page: a badge's black disc, a card's grey and an-// image's placeholder are their own. The cards of a carousel are cells of their own and are not walked into.-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;- if (!view.layer.mask && [NSStringFromClass(view.class) containsString:@"GradientView"]) view.layer.mask = [CALayer layer];- }- for (UIView *sub in view.subviews) clearPaint(sub, cell, wide);-}-static void logOnce(NSString *what) {static NSMutableSet<NSString *> *logged;if (!logged) logged = [NSMutableSet set];@@ -184,7 +167,9 @@ static void logOnce(NSString *what) {if (settled) settle(cell, settled.doubleValue);UICollectionView *list = listOf(cell);if (list && ![listOf(list) isKindOfClass:UICollectionView.class] && SGRArtistPageOf(cell)) {- clearPaint(cell, cell, cell.bounds.size.width * 0.75);+ // What the cell paints over the field -- the "You liked" row, every carousel's collection and the+ // fade Popular's "See more" draws over its last track (device, trees/continuous/3.txt 2026-09-18).+ SGRClearCellPaint(cell);}}diff --git a/tweak/Sources/Redesigned/Kit/SGRKit.h b/tweak/Sources/Redesigned/Kit/SGRKit.hindex dcb45402..4911db3b 100644--- a/tweak/Sources/Redesigned/Kit/SGRKit.h+++ b/tweak/Sources/Redesigned/Kit/SGRKit.h@@ -9,7 +9,8 @@// SGRGlyph.h bare glyph overlays and glyph buttons// SGRActionRow.h the Play capsule and the stand-in button of a page's action row// SGRHeaderInfo.h a page header's title, creator, length, row and description, the Music app's-// SGRRestyle.h keeping Spotify's views restyled: suppress, digits, lookups, shadows, firing controls+// SGRRestyle.h keeping Spotify's views restyled: suppress, digits, lookups, shadows, firing+// controls, taking a list cell's paint off the field// SGRBridges.h player state, now playing artwork, the player's open and close// SGRRepaint.h the areas the redesign keeps transparent when Spotify repaints them// SGRAccent.h the redesign's accent colour; its AMOLED black is SGRAmoled.x, always ondiff --git a/tweak/Sources/Redesigned/Kit/SGRRestyle.h b/tweak/Sources/Redesigned/Kit/SGRRestyle.hindex 64e8962c..bbe05a71 100644--- a/tweak/Sources/Redesigned/Kit/SGRRestyle.h+++ b/tweak/Sources/Redesigned/Kit/SGRRestyle.h@@ -51,6 +51,18 @@ SGRShadowPlate *SGRShadowPlateIn(UIView *host, const void *key);#pragma mark - Spotify's controls and pages+// The base surface a list cell paints over a page's field, cleared: the #121212 the redesign's AMOLED+// black has already turned black, on the cell and on everything under it nearly as wide as the cell, and+// the full-width fade a "see more" draws over its last row, which the black makes a dark band. The Kit's+// repaint hook misses all of it -- it only hears about a colour when Spotify sets it, and a cell is painted+// before it is inside the page and brings its old paint with it when it is reused -- so this runs from the+// 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.+void SGRClearCellPaint(UIView *cell);+// 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 14095b74..197796af 100644--- a/tweak/Sources/Redesigned/Kit/SGRRestyle.m+++ b/tweak/Sources/Redesigned/Kit/SGRRestyle.m@@ -272,6 +272,27 @@ SGRShadowPlate *SGRShadowPlateIn(UIView *host, const void *key) {#pragma mark - Spotify's controls and pages+// Nearly as wide as the cell. The bands are the width of the page -- a row's surface, a carousel's+// collection, a "see more" fade (artist, trees/continuous/3.txt 2026-09-18; episode page and the+// playlist's Recommended songs, trees/continuous/1.txt and 2.txt 2026-09-20) -- while a badge's black+// disc is 26pt and an avatar's ring the same.+static const CGFloat kPaintedShare = 0.75;++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;+ if (!view.layer.mask && [NSStringFromClass(view.class) containsString:@"GradientView"]) view.layer.mask = [CALayer layer];+ }+ for (UIView *sub in view.subviews) clearPaint(sub, cell, wide);+}++void SGRClearCellPaint(UIView *cell) {+ if (!cell) return;+ clearPaint(cell, cell, cell.bounds.size.width * kPaintedShare);+}+BOOL SGRFire(UIControl *control) {if (![control isKindOfClass:UIControl.class]) return NO;__block UIControlEvents registered = control.allControlEvents;diff --git a/tweak/Sources/Redesigned/Playlist/PlaylistRows.x b/tweak/Sources/Redesigned/Playlist/PlaylistRows.xindex e086359b..781fe472 100644--- a/tweak/Sources/Redesigned/Playlist/PlaylistRows.x+++ b/tweak/Sources/Redesigned/Playlist/PlaylistRows.x@@ -13,6 +13,12 @@// 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.+//+// 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+// Refresh cell paint the base surface over the field, where the black made bands of them (device,+// trees/continuous/2.txt 2026-09-20). So the paint comes off every cell of the page, the Kit's way, and+// only the row below is a row.#import "Core/SGCore.h"#import "Redesigned/Kit/SGRKit.h"#import "Playlist.h"@@ -81,7 +87,10 @@ static void applyRow(UIView *cell) {%hook _TtC35ListUXPlatform_FreeTierPlaylistImpl25ElementCollectionViewCell- (void)layoutSubviews {%orig;- if (SGRPlaylistHeaderOf((UIView *)self)) applyRow((UIView *)self);+ UIView *cell = (UIView *)self;+ if (!SGRPlaylistHeaderOf(cell)) return;+ SGRClearCellPaint(cell);+ applyRow(cell);}- (UICollectionViewLayoutAttributes *)preferredLayoutAttributesFittingAttributes:(UICollectionViewLayoutAttributes *)attributes {