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 tab bar, the now playing bar and the mod's glass stay dark when the phone is in light mode
Vojtěch Škopek1b832882485d
diff --git a/AGENTS.md b/AGENTS.mdindex ab6f21b8..5c8d0bc4 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -57,4 +57,6 @@ Rules:- Known traps: anything pushed onto Spotify's nav stack must conform to `SPTPageController`(`Settings/SGPage.m`). Setting `hidden` on views inside Spotify's `OverflowStackView` or its Encorestacks crashes, so use alpha. A `CADisplayLink` capped at 60 Hz drags the player's 120 Hz- transitions down with it.+ transitions down with it. Glass takes the appearance it inherits, and outside Spotify's navigation+ stacks (the tab bar, the now playing bar, the player) that is the system's: set every pane of the+ mod's to `overrideUserInterfaceStyle = UIUserInterfaceStyleDark`, or it goes light in light mode.diff --git a/tweak/Sources/Native/Lyrics/LyricsPage.x b/tweak/Sources/Native/Lyrics/LyricsPage.xindex 19dfbd93..d00d490c 100644--- a/tweak/Sources/Native/Lyrics/LyricsPage.x+++ b/tweak/Sources/Native/Lyrics/LyricsPage.x@@ -46,6 +46,9 @@ static UIView *clearAncestors(UIView *view) {sg_lyricsPageRoot = clearAncestors(page);UIVisualEffectView *glass = SGGlassFor(page, &kPageGlassKey);+ // Dark whatever the system is set to, as the player's header panes are (Native/Player/Player.x):+ // light glass under white lyrics otherwise, on a phone in light mode.+ if (glass.overrideUserInterfaceStyle != UIUserInterfaceStyleDark) glass.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;glass.frame = page.bounds;glass.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;// Full bleed, so the shape is spelled out: a fresh pane does not promise square corners.diff --git a/tweak/Sources/Native/Player/LyricsCard.x b/tweak/Sources/Native/Player/LyricsCard.xindex 222e2b57..8e196b80 100644--- a/tweak/Sources/Native/Player/LyricsCard.x+++ b/tweak/Sources/Native/Player/LyricsCard.x@@ -34,6 +34,9 @@ static UIView *cellAround(UIView *view) {sg_lyricsCardRoot = cell;SGStripBackgrounds(cell);UIVisualEffectView *glass = SGGlassFor(cell, &kCardGlassKey);+ // Dark whatever the system is set to, as the player's header panes are (Player.x): light glass under+ // white lyrics otherwise, on a phone in light mode.+ if (glass.overrideUserInterfaceStyle != UIUserInterfaceStyleDark) glass.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;glass.frame = cell.bounds;glass.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;SGShapeGlass(glass, kCardRadius, NO);diff --git a/tweak/Sources/Native/Player/Player.x b/tweak/Sources/Native/Player/Player.xindex 9779413f..cb2d2462 100644--- a/tweak/Sources/Native/Player/Player.x+++ b/tweak/Sources/Native/Player/Player.x@@ -50,6 +50,9 @@ static void glassBehindRoundButtons(UIViewController *unit) {if (f.size.width > f.size.height * 1.4) continue;CGFloat side = MAX(kButtonMin, MIN(MAX(f.size.width, f.size.height), kButtonMax));UIVisualEffectView *glass = SGGlassAt(host, index++);+ // Dark whatever the system is set to: the player is presented outside the navigation stacks+ // Spotify makes dark itself, so its panes took the system's light glass on a phone in light mode.+ if (glass.overrideUserInterfaceStyle != UIUserInterfaceStyleDark) glass.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;glass.frame = CGRectMake(CGRectGetMidX(f) - side / 2, CGRectGetMidY(f) - side / 2, side, side);SGShapeGlass(glass, side / 2, YES);}diff --git a/tweak/Sources/Redesigned/Kit/SGRGlass.h b/tweak/Sources/Redesigned/Kit/SGRGlass.hindex df7c659d..29802f77 100644--- a/tweak/Sources/Redesigned/Kit/SGRGlass.h+++ b/tweak/Sources/Redesigned/Kit/SGRGlass.h@@ -1,7 +1,9 @@// Glass for the redesign's control layer, and only for it: never behind rows, cards or text. Built on// Core/SGGlass.m (the effect made through +effectWithStyle:). Under Reduce Transparency a shape is a// solid SGRSolidGlassFill, on any OS; before iOS 26 without it, a dark thin material blur. Nothing-// touches a glass class on an OS without them.+// touches a glass class on an OS without them. A shape is dark whatever the system appearance: glass+// takes the one it inherits, which outside the navigation stacks Spotify makes dark (the player) is the+// system's, light on a phone in light mode.//// Ownership: a shape belongs to the control it is made in (associated with it under the caller's key).// Threading: main thread only.diff --git a/tweak/Sources/Redesigned/Kit/SGRGlass.m b/tweak/Sources/Redesigned/Kit/SGRGlass.mindex 5cd24da4..69518017 100644--- a/tweak/Sources/Redesigned/Kit/SGRGlass.m+++ b/tweak/Sources/Redesigned/Kit/SGRGlass.m@@ -28,6 +28,7 @@ static UIView *newShape(SGRGlassMode mode) {shape.backgroundColor = SGRSolidGlassFill();break;}+ shape.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;shape.userInteractionEnabled = NO;return shape;}diff --git a/tweak/Sources/Redesigned/Lyrics/LyricsPage.x b/tweak/Sources/Redesigned/Lyrics/LyricsPage.xindex d770d72e..72816313 100644--- a/tweak/Sources/Redesigned/Lyrics/LyricsPage.x+++ b/tweak/Sources/Redesigned/Lyrics/LyricsPage.x@@ -45,6 +45,9 @@ static UIView *clearAncestors(UIView *view) {sgr_lyricsPageRoot = clearAncestors(page);UIVisualEffectView *glass = SGGlassFor(page, &kPageGlassKey);+ // Dark whatever the system is set to: the page is presented outside the navigation stacks Spotify+ // makes dark, and would be light glass under white lyrics on a phone in light mode.+ if (glass.overrideUserInterfaceStyle != UIUserInterfaceStyleDark) glass.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;glass.frame = page.bounds;glass.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;// Full bleed, so the shape is spelled out: a fresh pane does not promise square corners.diff --git a/tweak/Sources/Redesigned/Navbar/SearchField.x b/tweak/Sources/Redesigned/Navbar/SearchField.xindex cb2e0a8f..98115e32 100644--- a/tweak/Sources/Redesigned/Navbar/SearchField.x+++ b/tweak/Sources/Redesigned/Navbar/SearchField.x@@ -106,6 +106,9 @@ static void styleSearchField(UIView *button) {button.layer.cornerCurve = kCACornerCurveContinuous;UIVisualEffectView *glass = SGGlassAt(button, 0);+ // Dark like every glass of the redesign's, rather than by grace of the navigation stack Spotify hosts+ // the page in (TabBar.x).+ if (glass.overrideUserInterfaceStyle != UIUserInterfaceStyleDark) glass.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;glass.frame = button.bounds;SGShapeGlass(glass, size.height / 2, YES);diff --git a/tweak/Sources/Redesigned/Navbar/TabBar.x b/tweak/Sources/Redesigned/Navbar/TabBar.xindex 165d95c4..03cf0f69 100644--- a/tweak/Sources/Redesigned/Navbar/TabBar.x+++ b/tweak/Sources/Redesigned/Navbar/TabBar.x@@ -272,6 +272,11 @@ static void syncBar(UIView *stockBar) {SGRSystemTabBar *bar = objc_getAssociatedObject(stockBar, &kBarKey);if (!bar) {bar = [[SGRSystemTabBar alloc] initWithFrame:stockBar.bounds];+ // UIKit draws the glass in the appearance the bar inherits, and the bar is outside the navigation+ // stacks Spotify makes dark itself (-[SPNavigationController viewDidLoad] while +[SPTLiquidGlass+ // isEnabled]), so a phone in light mode had it light over Spotify's black. Spotify is dark whatever+ // the system is, and so is the bar.+ bar.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;bar.delegate = bar;bar.stockBar = stockBar;UILongPressGestureRecognizer *hold = [[UILongPressGestureRecognizer alloc] initWithTarget:bar action:@selector(held:)];diff --git a/tweak/Sources/Redesigned/NowPlayingBar/BarTransition.x b/tweak/Sources/Redesigned/NowPlayingBar/BarTransition.xindex 228494df..51f6a6e5 100644--- a/tweak/Sources/Redesigned/NowPlayingBar/BarTransition.x+++ b/tweak/Sources/Redesigned/NowPlayingBar/BarTransition.x@@ -43,6 +43,9 @@ static UIVisualEffectView *copyPane(UIView *pane) {UIVisualEffect *effect = platter ? SGGlassEffect() : ((UIVisualEffectView *)pane).effect;UIVisualEffectView *glass = [[UIVisualEffectView alloc] initWithEffect:effect];glass.userInteractionEnabled = NO;+ // The effect does not carry the appearance the pane was drawn in, dark for both bars, and the stand-in+ // would give the copy the system's.+ glass.overrideUserInterfaceStyle = pane.traitCollection.userInterfaceStyle;if (platter) {SGShapeGlass(glass, pane.bounds.size.height / 2, YES);} else if ([pane respondsToSelector:@selector(cornerConfiguration)] && [glass respondsToSelector:@selector(setCornerConfiguration:)]) {diff --git a/tweak/Sources/Redesigned/NowPlayingBar/NowPlayingBar.x b/tweak/Sources/Redesigned/NowPlayingBar/NowPlayingBar.xindex 492bc076..64e1d05c 100644--- a/tweak/Sources/Redesigned/NowPlayingBar/NowPlayingBar.x+++ b/tweak/Sources/Redesigned/NowPlayingBar/NowPlayingBar.x@@ -114,6 +114,9 @@ static void styleNowPlayingBar(UIViewController *container) {}UIVisualEffectView *glass = SGGlassFor(container.view, &kGlassKey);+ // Dark whatever the system is set to: the bar is outside the navigation stacks Spotify makes dark, and+ // took the system's light glass on a phone in light mode (TabBar.x).+ if (glass.overrideUserInterfaceStyle != UIUserInterfaceStyleDark) glass.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;sg_cardGlass = glass;glass.frame = frame;SGShapeGlass(glass, radius, NO);diff --git a/tweak/Sources/Redesigned/Search/SearchCards.x b/tweak/Sources/Redesigned/Search/SearchCards.xindex fdd7992a..5a12c9b1 100644--- a/tweak/Sources/Redesigned/Search/SearchCards.x+++ b/tweak/Sources/Redesigned/Search/SearchCards.x@@ -121,6 +121,9 @@ static SGRSearchCardParts *partsIn(UIView *box, UIView *content) {if (parts.plate.superview != content) [content insertSubview:parts.plate atIndex:0];if (glassAllowed() && !parts.glass) {UIVisualEffectView *glass = [UIVisualEffectView new];+ // Dark like every glass of the redesign's, rather than by grace of the navigation stack Spotify+ // hosts the page in (Navbar/TabBar.x).+ glass.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;glass.userInteractionEnabled = NO;glass.accessibilityElementsHidden = YES;glass.layer.zPosition = -1;