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 profile avatar sits at the trailing edge of Library and Search on Spotify 9.1.90
My-Name-Is-Jeffe0a28fee428b
diff --git a/tweak/Sources/Redesigned/Home/HomeHeader.x b/tweak/Sources/Redesigned/Home/HomeHeader.xindex a8e286f0..fe5bb1cf 100644--- a/tweak/Sources/Redesigned/Home/HomeHeader.x+++ b/tweak/Sources/Redesigned/Home/HomeHeader.x@@ -145,16 +145,9 @@ static void layoutHeader(UIViewController *page) {UIStackView *stack = sg_stack;vanish(sg_scrim);- // The avatar by its identifier, which both versions give it: 9.1.88 draws it in an AdaptiveFaceContainer,- // 9.1.90 in an Encore button around a listening-activity pulse. Taken by the class alone, 9.1.90's avatar- // was hidden with the pills.- static Class faceClass;- if (!faceClass) faceClass = NSClassFromString(@"_TtC29ListeningActivity_ElementsKit21AdaptiveFaceContainer");UIView *face = nil;for (UIView *part in stack.arrangedSubviews) {- BOOL avatar = [part.accessibilityIdentifier isEqualToString:@"Components.UI.SideDrawerButton"]- || (faceClass && [part isKindOfClass:faceClass]);- if (avatar && !face) face = part;+ if (SGRIsAvatar(part) && !face) face = part;else vanish(part);}// Brought back if an earlier pass, or an earlier build, took it for a pill.diff --git a/tweak/Sources/Redesigned/Kit/SGRRestyle.h b/tweak/Sources/Redesigned/Kit/SGRRestyle.hindex 45f01e30..96aaceb7 100644--- a/tweak/Sources/Redesigned/Kit/SGRRestyle.h+++ b/tweak/Sources/Redesigned/Kit/SGRRestyle.h@@ -46,6 +46,11 @@ BOOL SGRObserveLayout(UIView *view, void (^laidOut)(UIView *view));// left `root` or changed its identifier. nil when there is none; a miss is not cached.UIView *SGRFindByIdentifier(UIView *root, NSString *identifier, const void *cacheKey);+// Whether `view` is the profile avatar that opens the side drawer, in the Home, Search and Library headers. Known by+// its identifier, which every version gives it: 9.1.88 draws it in an AdaptiveFaceContainer, 9.1.90 in an Encore+// button around a listening-activity pulse, which a check by class alone took for something else.+BOOL SGRIsAvatar(UIView *view);+// A view that draws only a shadow, for a view whose own layer clips (rounded artwork): made once per// host under `key`, inserted at the bottom of `host`. The caller gives it its frame and transform; its// shadowPath follows its bounds and cornerRadius.diff --git a/tweak/Sources/Redesigned/Kit/SGRRestyle.m b/tweak/Sources/Redesigned/Kit/SGRRestyle.mindex 85fb1ecf..b0af25c8 100644--- a/tweak/Sources/Redesigned/Kit/SGRRestyle.m+++ b/tweak/Sources/Redesigned/Kit/SGRRestyle.m@@ -264,6 +264,13 @@ static UIView *findIdentifier(UIView *view, NSString *identifier) {return nil;}+BOOL SGRIsAvatar(UIView *view) {+ static Class faceClass;+ if (!faceClass) faceClass = NSClassFromString(@"_TtC29ListeningActivity_ElementsKit21AdaptiveFaceContainer");+ return [view.accessibilityIdentifier isEqualToString:@"Components.UI.SideDrawerButton"]+ || (faceClass && [view isKindOfClass:faceClass]);+}+UIView *SGRFindByIdentifier(UIView *root, NSString *identifier, const void *cacheKey) {if (!root || !identifier.length) return nil;SGRWeakBox *box = cacheKey ? objc_getAssociatedObject(root, cacheKey) : nil;diff --git a/tweak/Sources/Redesigned/Library/LibraryHeader.x b/tweak/Sources/Redesigned/Library/LibraryHeader.xindex 67163782..bf5124e5 100644--- a/tweak/Sources/Redesigned/Library/LibraryHeader.x+++ b/tweak/Sources/Redesigned/Library/LibraryHeader.x@@ -172,9 +172,7 @@ static void layoutTitle(UIView *header, UIView *spotifyTitle, CGFloat leading, C#pragma mark - the two headersstatic BOOL isFace(UIView *view) {- static Class faceClass;- if (!faceClass) faceClass = NSClassFromString(@"_TtC29ListeningActivity_ElementsKit21AdaptiveFaceContainer");- return faceClass && [view isKindOfClass:faceClass];+ return SGRIsAvatar(view);}// The root header's controls at its trailing edge, the avatar last, and the title before them. Answers what itdiff --git a/tweak/Sources/Redesigned/Search/SearchPage.x b/tweak/Sources/Redesigned/Search/SearchPage.xindex d5416912..b065d426 100644--- a/tweak/Sources/Redesigned/Search/SearchPage.x+++ b/tweak/Sources/Redesigned/Search/SearchPage.x@@ -104,12 +104,10 @@ static UILabel *titleIn(UIStackView *row) {static void layoutHeader(UIStackView *row) {vanish(sg_scrim);- static Class faceClass;- if (!faceClass) faceClass = NSClassFromString(@"_TtC29ListeningActivity_ElementsKit21AdaptiveFaceContainer");UIView *face = nil;NSString *text = titleText(row);for (UIView *part in row.arrangedSubviews) {- if (faceClass && [part isKindOfClass:faceClass]) face = part;+ if (SGRIsAvatar(part) && !face) face = part;else vanish(part);}if (row.semanticContentAttribute != UISemanticContentAttributeForceRightToLeft) {