Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.
C
fix: album cards and the playlist recommendations heading sit on the field
My-Name-Is-Jeff6010e3910c63
diff --git a/harness/album/README.md b/harness/album/README.mdindex e223b65e..49ff1f13 100644--- a/harness/album/README.md+++ b/harness/album/README.md@@ -59,3 +59,9 @@ identifier and in a mock of the Encore object behind it (`currentState`, `progreNone, waiting, downloading (held at 50%), downloaded, shuffle on, removed with shuffle off, error, each held afew seconds and announced with a `[harness] state:` line to take a screenshot on. Nothing in it lays anythingout, as on the phone.++The track rows carry Spotify's explicit badge on some of them and two guests the header does not explain (one named+in the title with no "feat.", one not at all). At 2.5 s the log says, row by row, whether its artist line was+dropped, how far the title moved and where the badge was drawn against the end of the title's text; at 4 s the first+row is prepared for reuse and has to come back as Spotify drew it, then be dropped again by its next pass. At 3 s+the log also says the first card of each carousel, painted the base surface, was cleared and the grey one was not.diff --git a/harness/album/main.m b/harness/album/main.mindex 5cfd28fa..43809d6b 100644--- a/harness/album/main.m+++ b/harness/album/main.m@@ -215,6 +215,7 @@ static NSString *trailingLabel(UIView *root) {NSMutableArray<_TtC12Element_List18CollectionViewCell *> *_footerCells;UIView *_listView;CGFloat _tracksBottom;+ UIView *_baseCard, *_greyCard;}- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)options {@@ -442,6 +443,10 @@ static NSString *trailingLabel(UIView *root) {UIView *card = box(content, UIView.class, CGRectMake(16 + i * 161, 0, 153, height), @"Components.UI.ContentCardAlbum");card.backgroundColor = [UIColor colorWithWhite:0.12 alpha:1];card.layer.cornerRadius = 4;+ // A card's caption backing as the device paints it: the base surface, on its layer.+ if (i == 0) card.layer.backgroundColor = [UIColor colorWithRed:0x12 / 255.0 green:0x12 / 255.0 blue:0x12 / 255.0 alpha:1].CGColor;+ if (i == 0 && !_baseCard) _baseCard = card;+ if (i == 1 && !_greyCard) _greyCard = card;}}[_footerCells addObject:cell];@@ -477,6 +482,9 @@ static NSString *trailingLabel(UIView *root) {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 base-surface album card cleared, the one painted grey left alone.+ NSLog(@"[harness] album cards: base surface a=%.0f, grey a=%.2f",+ CGColorGetAlpha(self->_baseCard.layer.backgroundColor), CGColorGetAlpha(self->_greyCard.layer.backgroundColor));});// the sticky navigation bar, its gradient hidden until the page scrollsdiff --git a/harness/playlist/README.md b/harness/playlist/README.mdindex d98e05e1..e8486475 100644--- a/harness/playlist/README.md+++ b/harness/playlist/README.md@@ -55,3 +55,6 @@ out, as on the phone.was handed leaves the window and a new one, in a cell the redesign never hears about, takes its place. The sheet'slog line has to read "Mix (rebuilt)" and the fired pill has to be "still on screen: yes". Before the sheet lookedagain, it fired the old row's Mix ("still on screen: no").++The extender paint line at 3 s also covers a recommendations heading mounted the way This Is playlists have it,+a plain UICollectionViewCell straight in the list: "plain heading a=0" once the list's pass has cleared it.diff --git a/harness/playlist/main.m b/harness/playlist/main.mindex 693634d1..7ea435de 100644--- a/harness/playlist/main.m+++ b/harness/playlist/main.m@@ -404,6 +404,13 @@ static void buildLikedSongs(UIViewController *page, CGFloat W) {label(headingPaint, CGRectMake(16, 37, W - 32, 16), @"Based on the songs of this playlist", 11,[UIColor colorWithWhite:0.7 alpha:1], @"subtitle");+ // Spotify mounts the recommendations heading of some playlists (This Is ...) as a plain UICollectionViewCell+ // straight into the list, outside visibleCells.+ UIView *plainHeading = box(list, UICollectionViewCell.class, CGRectMake(0, extenderTop + 180, W, 52), nil);+ UIView *plainHeadingPaint = box(plainHeading, UIView.class, plainHeading.bounds, nil);+ plainHeadingPaint.backgroundColor = UIColor.blackColor;+ label(plainHeadingPaint, CGRectMake(16, 16, W - 32, 21), @"Recommended", 17, UIColor.whiteColor, @"title");+UIView *extenderRow = box(list, _TtC35ListUXPlatform_FreeTierPlaylistImpl25ElementCollectionViewCell.class,CGRectMake(0, extenderTop + 68, W, 64), nil);UIView *extenderPaint = box(extenderRow, UIView.class, extenderRow.bounds, @"PlaylistExtender.Row");@@ -496,8 +503,8 @@ static void buildLikedSongs(UIViewController *page, CGFloat W) {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));+ NSLog(@"[harness] extender paint: heading a=%.0f row-badge a=%.0f card a=%.0f refresh a=%.0f plain heading a=%.0f",+ alpha(headingPaint), alpha(badge), alpha(card), alpha(refreshPaint), alpha(plainHeadingPaint));});if ([NSProcessInfo.processInfo.arguments containsObject:@"liked"]) {diff --git a/tweak/Sources/Redesigned/Album/AlbumField.x b/tweak/Sources/Redesigned/Album/AlbumField.xindex 595dd448..954bf1f8 100644--- a/tweak/Sources/Redesigned/Album/AlbumField.x+++ b/tweak/Sources/Redesigned/Album/AlbumField.x@@ -121,6 +121,18 @@ static SGRArtworkField *fieldIn(UIView *page) {}%end+// An album card of a discovery section switched back on (More by, You might also like) paints the base surface+// behind its caption, a black box on the field. Only the card's own paint goes: its artwork, badges and+// placeholder are views of their own. Spotify paints it before the card is attached, so no colour hook hears it;+// it is cleared on the pass of the cell it is in, which a card has to itself when it is reused.+static void clearCards(UIView *cell) {+ SGForEachView(cell, ^(UIView *v) {+ if (![v.accessibilityIdentifier isEqualToString:@"Components.UI.ContentCardAlbum"]) return;+ CGColorRef color = v.layer.backgroundColor;+ if (color && SGIsBaseSurface(color)) v.backgroundColor = UIColor.clearColor;+ });+}+// 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,@@ -130,6 +142,7 @@ static SGRArtworkField *fieldIn(UIView *page) {%orig;UIView *cell = (UIView *)self;if (isPageCell(cell)) SGRClearCellPaint(cell);+ if (SGRAlbumPageOf(cell)) clearCards(cell);}%enddiff --git a/tweak/Sources/Redesigned/Playlist/PlaylistField.x b/tweak/Sources/Redesigned/Playlist/PlaylistField.xindex f8ae853c..6309edab 100644--- a/tweak/Sources/Redesigned/Playlist/PlaylistField.x+++ b/tweak/Sources/Redesigned/Playlist/PlaylistField.x@@ -76,12 +76,18 @@ static SGRArtworkField *fieldIn(UIView *page) {%end// The list paints itself the base surface from its own pass rather than through a layer that the repaint-// hook would hear about, so it is cleared where it is laid out.+// hook would hear about, so it is cleared where it is laid out. So is the recommendations heading at the+// bottom of some playlists (This Is ...): Spotify mounts it as a plain UICollectionViewCell straight into the+// list, outside visibleCells, where nothing else clears it and it sat on a black strip. Only the plain class:+// the track cells are subclasses, which PlaylistRows.x already clears.%hook _TtC35ListUXPlatform_FreeTierPlaylistImpl32FTPTouchCancellingCollectionView- (void)layoutSubviews {%orig;UIScrollView *list = (UIScrollView *)self;if (list.backgroundColor && SGIsBaseSurface(list.backgroundColor.CGColor)) list.backgroundColor = UIColor.clearColor;+ for (UIView *sub in list.subviews) {+ if ([sub isMemberOfClass:UICollectionViewCell.class]) SGRClearCellPaint(sub);+ }}%end