Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.
C
feat: Albums & artists has a switch for each section the redesign hides on album and artist pages
My-Name-Is-Jeff191920801da0
diff --git a/docs/tweaks.md b/docs/tweaks.mdindex 323a07a1..6e313cc6 100644--- a/docs/tweaks.md+++ b/docs/tweaks.md@@ -232,8 +232,9 @@ Redesigned:controls -- play and shuffle float over the album page outside its header, so they are concealedthere 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 also- like, and whatever it adds next -- but the album's own line and its copyright (Album.h lists its- files). A podcast's episode page is the same template, so it is given the same field, and what it+ like, and whatever it adds next -- but the album's own line and its copyright, each section back+ once its switch on the Albums & artists page is off (told apart by its English heading; in another+ language Everything else covers them all; Album.h lists its files). A podcast's episode page is the same template, so it is given the same field, and what itpaints over it is taken off. Laid out on the Mac against harness/album/App:diff --git a/harness/album/README.md b/harness/album/README.mdindex 8c898cc7..e223b65e 100644--- a/harness/album/README.md+++ b/harness/album/README.md@@ -22,8 +22,10 @@ each with the 16pt spacer between them.At 1.5 s it measures the footer the way the page's collection does, asking every cell`preferredLayoutAttributesFittingAttributes:` and stacking the answers: that is where `AlbumSections.x`-answers 0 for what it drops, and the log says how much footer was left (108pt of 1230pt, the album's-own line and its copyright).+answers 0 for what it drops, and the log says how much footer was left (108pt of 1489pt, the album's+own line and its copyright). A switch is turned off from the launch line, as an argument default, and+brings its section back: `-spotifyglass.redesign.album.hide.merch NO` measures 374pt, `.moreBy` 371pt,+`.videos` 412pt, `.youMightLike` 370pt, and `.other` 367pt for Fans also like, the section no switch names.Since 2026-09-18 the header is the Kit's `SGRHeaderInfo` over Spotify's blanked column, so what follows nolonger tests anything the redesign moves; it still shows Spotify's column staying blank. The metadata row'sdiff --git a/harness/album/main.m b/harness/album/main.mindex 005c29d1..a5473945 100644--- a/harness/album/main.m+++ b/harness/album/main.m@@ -333,20 +333,29 @@ static NSString *trailingLabel(UIView *root) {_tracksBottom = y;// and under it the footer Spotify sends: the album's own line, the copyright, and the sections the- // redesign drops -- each with the 16pt spacer Spotify puts between them.+ // redesign drops -- each with the 16pt spacer Spotify puts between them. Fans also like stands for a+ // section no switch names. They sit in a real collection view, which is what AlbumSections.x keeps what+ // it has read of them on._footerCells = [NSMutableArray array];+ UICollectionView *footerList = [[UICollectionView alloc] initWithFrame:collection.bounds+ collectionViewLayout:[UICollectionViewFlowLayout new]];+ footerList.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;+ footerList.backgroundColor = UIColor.clearColor;+ footerList.userInteractionEnabled = NO;+ [collection addSubview:footerList];NSArray *footer = @[@[@"", @16], @[@"Album.ConsumptionExperience", @15.33], @[@"", @16],@[@"heading:More by The Weeknd", @52.67], @[@"cards", @194.33], @[@"", @16],@[@"heading:Related Music Videos", @52.67], @[@"cards", @235.67], @[@"", @16],@[@"heading:Merch", @52.67], @[@"cards", @197], @[@"", @16],@[@"heading:You might also like", @52.67], @[@"cards", @193.33], @[@"", @16],+ @[@"heading:Fans also like", @52.67], @[@"cards", @190], @[@"", @16],@[@"Album.Copyright", @60.67]];for (NSArray *item in footer) {NSString *kind = item[0];CGFloat height = [item[1] doubleValue];_TtC12Element_List18CollectionViewCell *cell =[[_TtC12Element_List18CollectionViewCell alloc] initWithFrame:CGRectMake(0, 0, W, height)];- [collection addSubview:cell];+ [footerList addSubview:cell];UIView *content = box(cell.contentView, MockAlbum_PageImpl20FooterStructuredDataView.class, cell.contentView.bounds, nil);if ([kind isEqualToString:@"Album.ConsumptionExperience"]) {UIView *line = box(content, UIView.class, content.bounds, kind);@@ -557,7 +566,8 @@ static NSString *trailingLabel(UIView *root) {CGFloat y = _tracksBottom;for (_TtC12Element_List18CollectionViewCell *cell in _footerCells) {CGFloat natural = cell.bounds.size.height;- UICollectionViewLayoutAttributes *attributes = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]];+ NSIndexPath *path = [NSIndexPath indexPathForItem:[_footerCells indexOfObject:cell] inSection:0];+ UICollectionViewLayoutAttributes *attributes = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:path];attributes.frame = CGRectMake(0, y, width, natural);UICollectionViewLayoutAttributes *answer = [cell preferredLayoutAttributesFittingAttributes:attributes];cell.frame = CGRectMake(0, y, width, answer.size.height);diff --git a/tweak/Sources/Redesigned/Album/Album.h b/tweak/Sources/Redesigned/Album/Album.hindex 86a8d375..ed351fd7 100644--- a/tweak/Sources/Redesigned/Album/Album.h+++ b/tweak/Sources/Redesigned/Album/Album.h@@ -14,7 +14,8 @@// SGRHeaderInfo over it -- title, artist, kind and date, shuffle, a white Play, add// AlbumRows.x the track rows on the field with no surface of their own and a hairline between them// AlbumSections.x everything under the tracks dropped but the album's own line and its copyright: no-// more by the artist, no videos, no concerts, no merch, no you might also like+// more by the artist, no videos, no concerts, no merch, no you might also like, each+// back once its switch is off//// Every hook installs only while Redesigned UI is on (SGRedesignedUI); the native look's do not then.// Threading: main thread only.@@ -26,6 +27,15 @@#define SGRKeyArtistLogo @"spotifyglass.redesign.artist.logo"UIViewController *SGRAlbumSettingsPage(void);+// AlbumSections.x. The sections under the tracks, one switch each, all dropped until switched off; the last+// is every section none of the others names.+#define SGRKeyAlbumHideMoreBy @"spotifyglass.redesign.album.hide.moreBy"+#define SGRKeyAlbumHideVideos @"spotifyglass.redesign.album.hide.videos"+#define SGRKeyAlbumHideConcerts @"spotifyglass.redesign.album.hide.concerts"+#define SGRKeyAlbumHideMerch @"spotifyglass.redesign.album.hide.merch"+#define SGRKeyAlbumHideYouMightLike @"spotifyglass.redesign.album.hide.youMightLike"+#define SGRKeyAlbumHideOther @"spotifyglass.redesign.album.hide.other"+// The album page `view` is on, or nil: the CreativeWorkTemplateView that carries the header, the list and// the two floating controls (trees/clean/album/01.txt:22).UIView *SGRAlbumPageOf(UIView *view);diff --git a/tweak/Sources/Redesigned/Album/AlbumSections.x b/tweak/Sources/Redesigned/Album/AlbumSections.xindex 3ccdbaeb..83e29fd0 100644--- a/tweak/Sources/Redesigned/Album/AlbumSections.x+++ b/tweak/Sources/Redesigned/Album/AlbumSections.x@@ -14,6 +14,12 @@//// The tracks themselves are the same cell class over RetrievalListStructuredData and are never touched here.//+// A section comes back when its switch is off (AlbumSettings.m). Which one a cell is in is read the way the+// native look's Album.x reads it: the nearest heading above it, by its title in English. Those are the only+// names there are -- more by and you might also like are the same carousel of cards -- so in any other+// language every section is the last switch's, the one for the sections no other switch names. With every+// switch on, which is how they come, nothing is read and the rule is the one above.+//// A dropped cell is 0 tall, but what it holds keeps the height it measured at, hidden and cut off by the// cell: Spotify's content squeezed to 0 with the cell breaks its own required constraints on every layout// pass, which is what held the main thread where dropped sections scrolled in on Home (2026-09-17). The two@@ -80,6 +86,98 @@ static void unsettle(UICollectionViewCell *cell) {cell.accessibilityElementsHidden = NO;}+#pragma mark - the switches++static const struct { __unsafe_unretained NSString *title, *key; BOOL prefix; } kSections[] = {+ {@"More by ", SGRKeyAlbumHideMoreBy, YES},+ {@"Related Music Videos", SGRKeyAlbumHideVideos, NO},+ {@"Concerts", SGRKeyAlbumHideConcerts, NO},+ {@"Merch", SGRKeyAlbumHideMerch, NO},+ {@"You might also like", SGRKeyAlbumHideYouMightLike, NO},+};+static const NSInteger kOther = sizeof(kSections) / sizeof(kSections[0]);++// What a cell is to the sections, kept per list by index path: a heading's section is its index in kSections+// or kOther.+static const NSInteger kNoHeading = -1, kBoundary = -2;++// Bit i set when section i is switched back on, bit kOther for the rest; read once, as switches are.+static NSUInteger shownSections(void) {+ static NSUInteger shown = NSUIntegerMax;+ if (shown != NSUIntegerMax) return shown;+ shown = 0;+ for (NSInteger i = 0; i < kOther; i++) {+ if (!SGEnabled(kSections[i].key)) shown |= 1u << i;+ }+ if (!SGEnabled(SGRKeyAlbumHideOther)) shown |= 1u << kOther;+ return shown;+}++static NSInteger sectionTitled(NSString *title) {+ for (NSInteger i = 0; i < kOther; i++) {+ NSString *wanted = kSections[i].title;+ BOOL match = kSections[i].prefix+ ? [title.lowercaseString hasPrefix:wanted.lowercaseString]+ : [title caseInsensitiveCompare:wanted] == NSOrderedSame;+ if (match) return i;+ }+ return kOther;+}++// The section a heading opens, by any of its labels, or kNoHeading. Concerts may come under Spotify's events+// heading (Components.UI.EventsSectionHeadingHome), so any SectionHeadingHome counts.+static NSInteger headingIn(UIView *content) {+ __block BOOL heading = NO;+ NSMutableArray<NSString *> *titles = [NSMutableArray array];+ SGForEachView(content, ^(UIView *v) {+ if ([v.accessibilityIdentifier containsString:@"SectionHeadingHome"] ||+ [NSStringFromClass(v.class) containsString:@"SectionHeadingHome"]) heading = YES;+ NSString *title = [v isKindOfClass:UILabel.class] ? ((UILabel *)v).text : v.accessibilityLabel;+ if (title.length) [titles addObject:title];+ });+ if (!heading) return kNoHeading;+ for (NSString *title in titles) {+ NSInteger section = sectionTitled(title);+ if (section != kOther) return section;+ }+ return kOther;+}++static NSMutableDictionary<NSIndexPath *, NSNumber *> *cellsOf(UICollectionView *list) {+ static char key;+ NSMutableDictionary *cells = objc_getAssociatedObject(list, &key);+ if (!cells) {+ cells = [NSMutableDictionary dictionary];+ objc_setAssociatedObject(list, &key, cells, OBJC_ASSOCIATION_RETAIN_NONATOMIC);+ }+ return cells;+}++// The nearest heading at or above `path`, or kNoHeading under the album's own line, before anything above it+// is known, or with no list.+static NSInteger sectionOf(UICollectionView *list, NSIndexPath *path) {+ NSDictionary<NSIndexPath *, NSNumber *> *cells = cellsOf(list);+ for (NSInteger item = path.item; item >= 0; item--) {+ NSNumber *cell = cells[[NSIndexPath indexPathForItem:item inSection:path.section]];+ if (!cell || cell.integerValue == kBoundary) return kNoHeading;+ if (cell.integerValue != kNoHeading) return cell.integerValue;+ }+ return kNoHeading;+}++// Records what the cell is and answers whether its section is switched back on.+static BOOL shown(UICollectionViewCell *cell, UIView *content, NSIndexPath *path, BOOL kept) {+ NSUInteger switched = shownSections();+ UICollectionView *list = nil;+ for (UIView *v = cell.superview; v && !list; v = v.superview) {+ if ([v isKindOfClass:UICollectionView.class]) list = (UICollectionView *)v;+ }+ if (!switched || !list || !path) return NO;+ cellsOf(list)[path] = @(kept ? kBoundary : headingIn(content));+ NSInteger section = sectionOf(list, path);+ return section != kNoHeading && (switched & (1u << section));+}+static void logOnce(NSString *what) {static NSMutableSet<NSString *> *logged;if (!logged) logged = [NSMutableSet set];@@ -100,9 +198,13 @@ static void logOnce(NSString *what) {UICollectionViewLayoutAttributes *result = %orig;CGFloat natural = MAX(1, result.size.height);if (isKept(content)) {+ shown(cell, content, attributes.indexPath, YES);settle(cell, natural, kLead);result.size = CGSizeMake(result.size.width, natural + kLead);logOnce(@"the album's own line and its copyright kept under the tracks");+ } else if (shown(cell, content, attributes.indexPath, NO)) {+ if (objc_getAssociatedObject(cell, &kSettledKey)) unsettle(cell);+ logOnce(@"a section under the tracks shown, its switch off");} else {settle(cell, natural, 0);result.size = CGSizeMake(result.size.width, 0);diff --git a/tweak/Sources/Redesigned/Album/AlbumSettings.m b/tweak/Sources/Redesigned/Album/AlbumSettings.mindex a7d3520c..72444f29 100644--- a/tweak/Sources/Redesigned/Album/AlbumSettings.m+++ b/tweak/Sources/Redesigned/Album/AlbumSettings.m@@ -1,8 +1,9 @@// The redesign's Albums & artists page: Apple Music's animated covers on album pages and its logos on-// artist pages, and whether their downloads run in Low Data Mode.+// artist pages, whether their downloads run in Low Data Mode, and what the redesign takes off both pages.#import "Core/SGCore.h"#import "Settings/SGModPage.h"#import "Shared/AnimatedArtwork/AnimatedArtwork.h"+#import "Redesigned/Artist/Artist.h"#import "Album.h"UIViewController *SGRAlbumSettingsPage(void) {@@ -12,5 +13,18 @@ UIViewController *SGRAlbumSettingsPage(void) {SGSwitchRow(@"Artist logos", @"In place of the name on an artist's page", SGRKeyArtistLogo),SGOptionRow(@"Download in Low Data Mode", nil, SGKeyMotionLowData),], @"Only the album's or artist's name is sent to Apple Music."),+ SGNotedSection(@"Hide under an album's tracks", @[+ SGSwitchRow(@"More by the artist", nil, SGRKeyAlbumHideMoreBy),+ SGSwitchRow(@"Related music videos", nil, SGRKeyAlbumHideVideos),+ SGSwitchRow(@"Concerts", nil, SGRKeyAlbumHideConcerts),+ SGSwitchRow(@"Merch", nil, SGRKeyAlbumHideMerch),+ SGSwitchRow(@"You might also like", nil, SGRKeyAlbumHideYouMightLike),+ SGSwitchRow(@"Everything else", @"Any other section Spotify sends", SGRKeyAlbumHideOther),+ ], @"Sections are told apart by their English names. With Spotify in another language, Everything else "+ @"covers them all."),+ SGSection(@"Hide on an artist's page", @[+ SGSwitchRow(@"Videos", @"In the Music list, and in the Video tab", SGRKeyArtistHideVideos),+ SGSwitchRow(@"Music, Video and Merch tabs", @"Without them the Music list is the page", SGRKeyArtistHideTabs),+ ]),] footer:nil];}diff --git a/tweak/Sources/Redesigned/Artist/Artist.h b/tweak/Sources/Redesigned/Artist/Artist.hindex 7fa384c1..aa033a8c 100644--- a/tweak/Sources/Redesigned/Artist/Artist.h+++ b/tweak/Sources/Redesigned/Artist/Artist.h@@ -17,6 +17,11 @@// Threading: main thread only.#import <UIKit/UIKit.h>+// What the redesign takes off the page, on until switched off (Redesigned/Album/AlbumSettings.m): the videos+// in the Music list (ArtistSections.x) and the Music / Video / Merch strip (ArtistField.x).+#define SGRKeyArtistHideVideos @"spotifyglass.redesign.artist.hide.videos"+#define SGRKeyArtistHideTabs @"spotifyglass.redesign.artist.hide.tabs"+// The artist page `view` is on, or nil: the TemplateView with the identifier creator-page.UIView *SGRArtistPageOf(UIView *view);diff --git a/tweak/Sources/Redesigned/Artist/ArtistField.x b/tweak/Sources/Redesigned/Artist/ArtistField.xindex ad9c8201..7f64f9e1 100644--- a/tweak/Sources/Redesigned/Artist/ArtistField.x+++ b/tweak/Sources/Redesigned/Artist/ArtistField.x@@ -11,7 +11,7 @@// and the merch have their own tabs only so that they can be left out, so the strip goes and the Music list// stays. The strip sits in an AutoLayoutStackView, which traps when a view in it hides, so it goes invisible// and the pages under it move up into its place and stop paging, the way the native look's switch does it-// (Native/Artist/Artist.x).+// (Native/Artist/Artist.x). With its switch off (SGRKeyArtistHideTabs) the strip and the paging stay Spotify's.#import "Core/SGCore.h"#import "Redesigned/Kit/SGRKit.h"#import "Artist.h"@@ -22,6 +22,7 @@ static NSString *const kPageIdentifier = @"creator-page";static const UIEdgeInsets kBleed = {600, 0, 600, 0};static char kFieldKey;+static BOOL hideTabs;#pragma mark - the page@@ -117,7 +118,7 @@ static void hideStrip(UIView *strip) {%orig;for (UIView *v = ((UIView *)self).superview; v; v = v.superview) {if (![v.accessibilityIdentifier isEqualToString:@"Components.UI.TabsSectionHeading"]) continue;- if (SGRArtistPageOf(v)) hideStrip(v);+ if (hideTabs && SGRArtistPageOf(v)) hideStrip(v);return;}}@@ -130,6 +131,7 @@ static void hideStrip(UIView *strip) {// updateConstraints], OverflowStackViewLayoutBuilder.Line.tallestView nil). The row stays Spotify's, and// ArtistHeader.x draws more itself.if (!SGRedesignedUI()) return;+ hideTabs = SGEnabled(SGRKeyArtistHideTabs);%init;SGRequireClasses(@[@"_TtC32CreativeWorkPlatform_TemplateKit12TemplateView",diff --git a/tweak/Sources/Redesigned/Artist/ArtistSections.x b/tweak/Sources/Redesigned/Artist/ArtistSections.xindex 0cbac89e..80aa0a26 100644--- a/tweak/Sources/Redesigned/Artist/ArtistSections.x+++ b/tweak/Sources/Redesigned/Artist/ArtistSections.x@@ -11,7 +11,8 @@// So the rule is by kind, never by the heading's words, which are the app's language: a video shelf reports// no height, and so do the heading and the spacer in the two cells before it. They were sized before it, so// the list is asked to lay out again once they are known. Every carousel is the same kind whatever it holds,-// so the carousels all stay; merch has a tab of its own, which ArtistField.x takes away.+// so the carousels all stay; merch has a tab of its own, which ArtistField.x takes away. With the videos'+// switch off (SGRKeyArtistHideVideos) a video shelf is any other cell and stays.//// A dropped cell is 0 tall but what it holds keeps the height it measured at, hidden and cut off by the// cell: content squeezed to 0 breaks Spotify's required constraints on every pass (Album/AlbumSections.x).@@ -20,6 +21,7 @@#import "Artist.h"static char kSettledKey, kKindsKey, kDroppedKey;+static BOOL hideVideos;typedef NS_ENUM(NSInteger, SGRArtistCell) {SGRArtistCellOther,@@ -142,6 +144,7 @@ static void logOnce(NSString *what) {NSIndexPath *path = attributes.indexPath;UIView *content = cell.contentView.subviews.firstObject ?: cell.contentView;SGRArtistCell kind = kindOf(content, result.size.height);+ if (kind == SGRArtistCellVideos && !hideVideos) kind = SGRArtistCellOther;kindsOf(list)[path] = @(kind);BOOL drop = kind == SGRArtistCellVideos || [droppedOf(list) containsObject:path];@@ -181,6 +184,7 @@ static void logOnce(NSString *what) {%ctor {if (!SGRedesignedUI()) return;+ hideVideos = SGEnabled(SGRKeyArtistHideVideos);%init;SGRequireClasses(@[@"_TtC12Element_List18CollectionViewCell"]);}