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 player's Connect button stays in its place and the volume row no longer covers the controls (#138)
My-Name-Is-Jefff3ce5b415b85
diff --git a/tweak/Sources/Redesigned/Player/PlayerFooter.x b/tweak/Sources/Redesigned/Player/PlayerFooter.xindex 7f3a178f..840a68ed 100644--- a/tweak/Sources/Redesigned/Player/PlayerFooter.x+++ b/tweak/Sources/Redesigned/Player/PlayerFooter.x@@ -446,6 +446,38 @@ void SGRPlayerLowerRow(UIView *row) {}%end+// The Connect button lays itself out again when the device changes (its name comes or goes, another device's glyph,+// the button's width with them),+// with no pass of the footer around it: the glyph moved inside it while the footer's transform, worked out from where+// the glyph was, stayed, so Connect slid off its place (the phone, 2026-10-24: switched to another device from+// elsewhere, the DJ footer's Connect 11pt left of its slot). The footer is laid out again whenever the glyph moves, and+// its pass puts the button back on its place, the ordinary player's and the DJ's alike.+static char kGlyphSeenKey;++%hook _TtC23Connect_EntryPointsImpl37ConnectButtonOutputSwitcherViewHolder+- (void)layoutSubviews {+ %orig;+ UIView *connect = (UIView *)self;+ UIView *glyph = connectGlyphIn(connect);+ if (!glyph) return;+ // The glyph's place in the button and the button's size: the glyph keeps its place at the button's leading edge while+ // the button grows and shrinks with the device's name (101.5pt with "iPhone", 51 without, the phone, 2026-10-24), and+ // the element holding it is laid out again round its new size, so either one moving is a move of the glyph.+ CGRect seen = [glyph convertRect:glyph.bounds toView:connect];+ seen.size = connect.bounds.size;+ NSValue *was = objc_getAssociatedObject(connect, &kGlyphSeenKey);+ if (was && CGRectEqualToRect(was.CGRectValue, seen)) return;+ objc_setAssociatedObject(connect, &kGlyphSeenKey, [NSValue valueWithCGRect:seen], OBJC_ASSOCIATION_RETAIN_NONATOMIC);+ if (!was) return;+ // The footer unit's view: the first ancestor a controller owns.+ for (UIView *v = connect.superview; v; v = v.superview) {+ if (!unitOf(v)) continue;+ [v setNeedsLayout];+ break;+ }+}+%end+%group VolumeSlider%hook UISlider- (void)setValue:(float)value animated:(BOOL)animated {diff --git a/tweak/Sources/Redesigned/Player/PlayerVolume.m b/tweak/Sources/Redesigned/Player/PlayerVolume.mindex 5453ee83..4c82cb9e 100644--- a/tweak/Sources/Redesigned/Player/PlayerVolume.m+++ b/tweak/Sources/Redesigned/Player/PlayerVolume.m@@ -7,6 +7,9 @@// It sits in Spotify's bottom stack, outside its arranged views, between the controls and the footer row, so the// lyrics fade it with the rest of the stack (PlayerLyrics.x) and its touches stay inside the stack. The footer's// lowerRow (PlayerFooter.x) places it after the moves, and keeps the controls where Spotify put them to make the room.+// The stack's own layout runs that pass again (SGRObserveLayout): the stack moves its arranged views around with no pass+// of the footer (the lyrics, a track whose title wraps, a row that comes or goes), and the row stayed where the stack+// once had them, over the controls (continuous/1.txt: the row at 188 of a stack whose controls end at 212).#import <AVFoundation/AVFoundation.h>#import <MediaPlayer/MediaPlayer.h>#import <QuartzCore/QuartzCore.h>@@ -39,6 +42,8 @@ static UIImageView *glyph(NSString *symbol) {}@interface SGRVolumeRow : UIControl+// The footer row it was last placed against, for the stack's layout. Weak: the stack owns it.+@property (nonatomic, weak) UIView *footer;- (UISlider *)systemSlider;- (void)systemSliderSet;@end@@ -357,8 +362,14 @@ BOOL SGRPlayerPlaceVolume(UIView *stack, UIView *controls, UIView *row, CGFloatif (!volume) {volume = [SGRVolumeRow new];objc_setAssociatedObject(stack, &kVolumeKey, volume, OBJC_ASSOCIATION_RETAIN_NONATOMIC);+ SGRObserveLayout(stack, ^(UIView *laidOut) {+ SGRVolumeRow *placed = objc_getAssociatedObject(laidOut, &kVolumeKey);+ UIView *footer = placed.footer;+ if (footer.superview == laidOut) SGRPlayerLowerRow(footer);+ });}if (volume.superview != stack) [stack addSubview:volume];+ volume.footer = row;// Halfway between the play button's bottom and the footer glyphs' top, each where it is drawn (convertRect: takes// the moves' transforms in). Without the button there is nothing to stand under: a guess from the controls' unit// put the row across the buttons on an iPhone 13 Pro with iOS 17 (issue #32) and took their taps, so no row.