Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.
C
feat: the redesign's Artists page hides Artist pick, Release countdown and About
My-Name-Is-Jeff0a5e765e7fcf
diff --git a/docs/tweaks.md b/docs/tweaks.mdindex 4e51112f..81a28304 100644--- a/docs/tweaks.md+++ b/docs/tweaks.md@@ -565,6 +565,14 @@ Redesigned:once its switch on the Albums page is off (told apart by its English heading; in anotherlanguage 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/+ Artist/ the artist page on the same field and header (Artist.h lists its files), its Music / Video / Merch+ strip gone so the Music list is the page, and off that list its videos (on until switched off) and,+ off until switched on, the Artist pick, the Release Countdown and About+ (spotifyglass.redesign.artist.hide.pick, .countdown, .about). Each is told apart by the identifier+ its content carries in any language (Components.UI.PinnedItemUI, Components.UI.UpcomingReleaseRow,+ Components.UI.CreatorBiographyCard; strings of the 9.1.78 and 9.1.90 binaries) and dropped with its+ heading and spacer (ArtistSections.x). Laid out on the simulator against harness/artist/, whose+ recorded artist has no countdownApp:diff --git a/tweak/Sources/Redesigned/Artist/Artist.h b/tweak/Sources/Redesigned/Artist/Artist.hindex 6c0977b9..c03c972f 100644--- a/tweak/Sources/Redesigned/Artist/Artist.h+++ b/tweak/Sources/Redesigned/Artist/Artist.h@@ -10,7 +10,8 @@// gone (the Music list is the page), the flags the screen forces// ArtistHeader.x the header: the photo full bleed dissolving into the field, and the Kit's// SGRHeaderInfo over it -- the name, the listeners, shuffle, a white Play and Follow-// ArtistSections.x the sections the Music list carries that are not the artist's music: its videos+// ArtistSections.x the sections the Music list carries that are not the artist's music: its videos, and+// the Artist pick, the Release Countdown and About when asked// ArtistFollow.x whether the artist is followed, from Spotify's collection, for Follow's glyph// ArtistSettings.m the Artists page of Mod Settings: the switches below//@@ -24,6 +25,11 @@// and the Music / Video / Merch strip (ArtistField.x).#define SGRKeyArtistHideVideos @"spotifyglass.redesign.artist.hide.videos"#define SGRKeyArtistHideTabs @"spotifyglass.redesign.artist.hide.tabs"+// And off until switched on, as the native look's hides are: the Artist pick, the Release Countdown and About+// sections of the Music list (ArtistSections.x).+#define SGRKeyArtistHidePick @"spotifyglass.redesign.artist.hide.pick"+#define SGRKeyArtistHideCountdown @"spotifyglass.redesign.artist.hide.countdown"+#define SGRKeyArtistHideAbout @"spotifyglass.redesign.artist.hide.about"UIViewController *SGRArtistSettingsPage(void);// The artist page `view` is on, or nil: the TemplateView with the identifier creator-page.diff --git a/tweak/Sources/Redesigned/Artist/ArtistSections.x b/tweak/Sources/Redesigned/Artist/ArtistSections.xindex f4fc63ae..0eb97953 100644--- a/tweak/Sources/Redesigned/Artist/ArtistSections.x+++ b/tweak/Sources/Redesigned/Artist/ArtistSections.x@@ -1,4 +1,5 @@-// Artist redesign: the Music list without the artist's videos, and nothing of it painted over the field.+// Artist redesign: the Music list without the artist's videos (and, each on its own switch, without the Artist pick,+// the Release Countdown and About), and nothing of it painted over the field.//// Tree (trees/clean/artist/05.txt, the Music list top to bottom): Popular, Artist pick, Popular releases and// its Show all, Featuring, Release Countdown, Music videos, Watch more from…, About, Artist playlists, Fans@@ -8,11 +9,12 @@// pick), HomeCard (a carousel), UpcomingReleaseRow, CreatorBiographyCard (About),// Components.UI.MusicVideoShelfHeader and WatchFeedCarouselEntryPointElement (videos).//-// 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+// So the rule is by kind, never by the heading's words, which are the app's language: a hidden section's content+// 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. With the videos'-// switch off (SGRKeyArtistHideVideos) a video shelf is any other cell and stays.+// so the carousels all stay; merch has a tab of its own, which ArtistField.x takes away. With a section's switch+// off (Artist.h) its content is any other cell and stays. The pick's, the countdown's and About's identifiers are+// strings of the 9.1.78 and 9.1.90 binaries (About's as its two labels', so it matches by prefix).//// 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).@@ -39,14 +41,18 @@ static void clearLikedBadge(UIView *cell) {});});}-static BOOL hideVideos;-typedef NS_ENUM(NSInteger, SGRArtistCell) {SGRArtistCellOther,SGRArtistCellSpacer,SGRArtistCellHeading,+ // The sections with a switch, from here on: dropped with their heading and spacer while it is on.SGRArtistCellVideos,+ SGRArtistCellPick,+ SGRArtistCellCountdown,+ SGRArtistCellAbout,};+static BOOL hidden[SGRArtistCellAbout + 1]; // by kind, read at launch+static __unsafe_unretained NSString *const dropped[] = {nil, nil, nil, @"the videos", @"the Artist pick", @"the Release Countdown", @"About"};static SGRArtistCell kindOf(UIView *content, CGFloat height) {__block SGRArtistCell kind = SGRArtistCellOther;@@ -56,6 +62,9 @@ static SGRArtistCell kindOf(UIView *content, CGFloat height) {if ([identifier isEqualToString:@"Components.UI.MusicVideoShelfHeader"] ||[identifier isEqualToString:@"Music-Videos.Video-Card-Carousel"] ||[identifier isEqualToString:@"WatchFeedCarouselEntryPointElement"]) kind = SGRArtistCellVideos;+ else if ([identifier isEqualToString:@"Components.UI.PinnedItemUI"]) kind = SGRArtistCellPick;+ else if ([identifier isEqualToString:@"Components.UI.UpcomingReleaseRow"]) kind = SGRArtistCellCountdown;+ else if ([identifier hasPrefix:@"Components.UI.CreatorBiographyCard"]) kind = SGRArtistCellAbout;else if ([identifier isEqualToString:@"Components.UI.SectionHeadingHome"]) kind = SGRArtistCellHeading;});if (kind == SGRArtistCellOther && height <= 16.5 && content.subviews.count <= 1) {@@ -162,21 +171,21 @@ 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;+ BOOL hide = kind >= SGRArtistCellVideos && hidden[kind];+ if (kind >= SGRArtistCellVideos && !hide) kind = SGRArtistCellOther;kindsOf(list)[path] = @(kind);- BOOL drop = kind == SGRArtistCellVideos || [droppedOf(list) containsObject:path];- if (kind == SGRArtistCellVideos) {+ if (hide) {[droppedOf(list) addObject:path];dropHeadingOf(list, path);+ logOnce([dropped[kind] stringByAppendingString:@" dropped from the Music list"]);}- if (!drop) {+ if (!hide && ![droppedOf(list) containsObject:path]) {if (objc_getAssociatedObject(cell, &kSettledKey)) unsettle(cell);return result;}settle(cell, MAX(1, result.size.height));result.size = CGSizeMake(result.size.width, 0);- logOnce(@"the videos dropped from the Music list");return result;}@@ -203,7 +212,10 @@ static void logOnce(NSString *what) {%ctor {if (!SGRedesignedUI()) return;- hideVideos = SGEnabled(SGRKeyArtistHideVideos);+ hidden[SGRArtistCellVideos] = SGEnabled(SGRKeyArtistHideVideos);+ hidden[SGRArtistCellPick] = SGHidden(SGRKeyArtistHidePick);+ hidden[SGRArtistCellCountdown] = SGHidden(SGRKeyArtistHideCountdown);+ hidden[SGRArtistCellAbout] = SGHidden(SGRKeyArtistHideAbout);%init;SGRequireClasses(@[@"_TtC12Element_List18CollectionViewCell"]);}diff --git a/tweak/Sources/Redesigned/Artist/ArtistSettings.m b/tweak/Sources/Redesigned/Artist/ArtistSettings.mindex 2a7c8bcb..01964c43 100644--- a/tweak/Sources/Redesigned/Artist/ArtistSettings.m+++ b/tweak/Sources/Redesigned/Artist/ArtistSettings.m@@ -12,6 +12,9 @@ UIViewController *SGRArtistSettingsPage(void) {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),+ SGHideRow(@"Artist pick", nil, SGRKeyArtistHidePick),+ SGHideRow(@"Release countdown", @"The pre-save of an upcoming release", SGRKeyArtistHideCountdown),+ SGHideRow(@"About", nil, SGRKeyArtistHideAbout),]),] footer:nil];}