Skip to content

Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.

C

feat: now playing hide device

Vojtěch Škopek73f07e5652f9
diff --git a/docs/tweaks.md b/docs/tweaks.md
index 97e8a6e5..23ffe7b4 100644
--- a/docs/tweaks.md
+++ b/docs/tweaks.md
@@ -105,7 +105,8 @@ Redesigned:
Spotify's own glass design), its repaint hook (SGRRepaint.x), soft top edge, AMOLED black (always on,
SGRAmoled.x) and its own accent colour (SGRAccent.x, stored apart from the native look's)
Navbar/ the glass tab bar (TabBar.x) over its own composition (Navbar.x, NavbarLayout.m) and editor, the glass search field
- NowPlayingBar/ the glass now playing bar
+ NowPlayingBar/ the glass now playing bar (NowPlayingBar.x), with Spotify's device button on it hidden on request
+ (BarConnect.x, its own key and its own Now playing page, apart from the native look's)
Player/ the redesigned full screen player (Player.h lists its files)
Lyrics/ the full screen lyrics page on glass with Apple Music style lyrics over it, always on (SGRKaraokeView,
which the player shows in itself too, Player/PlayerLyrics.x)
@@ -182,7 +183,7 @@ naming the source in the redesign, the lock screen, and glass lyrics in the nati
in the native look also Now playing bar (its device button and its flags), Queue & devices, and
Spotify's own player screen (artwork background, glass header buttons, Disable Canvas and the sheet,
header, slider and sticky header flags, the cards under the player and the lyrics preview and player
-buttons to hide); in the redesign instead Vibrations, Controls (on until switched off) and Music Haptics
+buttons to hide); in the redesign instead Now playing (its device button), Vibrations, Controls (on until switched off) and Music Haptics
(off until switched on, with an ⓘ saying it follows the sound this iPhone plays while Spotify is open), both
applying straight away. Home & Library, in the native look only:
the Gradient page (the wash behind the top of Home in one of eight colours, at three strengths and
diff --git a/tweak/Sources/App/Pages.m b/tweak/Sources/App/Pages.m
index d38236d3..95b312b2 100644
--- a/tweak/Sources/App/Pages.m
+++ b/tweak/Sources/App/Pages.m
@@ -12,6 +12,7 @@
#import "Native/Player/NowPlaying.h"
#import "Redesigned/Haptics/Haptics.h"
#import "Redesigned/Navbar/Navbar.h"
+#import "Redesigned/NowPlayingBar/NowPlayingBar.h"
#import "Redesigned/Kit/SGRAccent.h"
NSString *const SGRedesignedUIInfo = @"Replaces Spotify's own look with the mod's redesign, built in Liquid Glass: the glass tab bar, search field and now playing bar, the full screen player with the lyrics under it, Spotify's own glass bars and sheets, and every screen redesigned later.\n\nThe redesign starts from a clean sheet: it is black throughout, it has an accent colour of its own, and the switches that change Spotify's own screens (the player, Home, playlists, albums, artists, AMOLED) are put away while it is on, and none of them runs. What works the same with either look stays: ads and privacy, lyrics sources, gestures, blocked artists.\n\nChanges apply after you restart Spotify.";
@@ -74,6 +75,8 @@ UIViewController *SGPlayerSettingsPage(void) {
if (native) {
[pages addObject:SGWithSymbol(SGPageRow(@"Now playing bar", ^UIViewController *{ return SGNowPlayingBarSettingsPage(); }), @"rectangle.bottomthird.inset.filled")];
[pages addObject:SGWithSymbol(SGPageRow(@"Queue & devices", ^UIViewController *{ return SGQueueSettingsPage(); }), @"text.line.first.and.arrowtriangle.forward")];
+ } else {
+ [pages addObject:SGWithSymbol(SGPageRow(@"Now playing", ^UIViewController *{ return SGRNowPlayingBarSettingsPage(); }), @"rectangle.bottomthird.inset.filled")];
}
[pages addObject:SGWithSymbol(SGPageRow(@"Lock screen widget", ^UIViewController *{ return SGLockScreenWidgetPage(); }), @"lock")];
[sections addObject:SGSection(nil, pages)];
diff --git a/tweak/Sources/Redesigned/NowPlayingBar/BarConnect.x b/tweak/Sources/Redesigned/NowPlayingBar/BarConnect.x
new file mode 100644
index 00000000..c69c7d80
--- /dev/null
+++ b/tweak/Sources/Redesigned/NowPlayingBar/BarConnect.x
@@ -0,0 +1,37 @@
+// The device button of the now playing bar, hidden on request. The redesign keeps Spotify's own buttons
+// on its glass card, so the button and the way to hide it are the native look's, copied over.
+//
+// Tree (trees/test6.txt): the button row is a UIStackView holding Connect_EntryPointsImpl.ConnectStateView
+// (the connected device) and .ConnectButtonView, each wrapped; hiding the wrapper closes the gap.
+// The ConnectStateView under the title ("playing on ...") sits in InformationContainer and stays.
+#import "Core/SGCore.h"
+#import "NowPlayingBar.h"
+
+static BOOL insideClass(UIView *view, NSString *marker) {
+ for (UIView *v = view; v; v = v.superview) if ([NSStringFromClass(v.class) containsString:marker]) return YES;
+ return NO;
+}
+
+static void hideConnectButton(UIView *bar) {
+ SGForEachView(bar, ^(UIView *v) {
+ NSString *name = NSStringFromClass(v.class);
+ if (![name containsString:@"ConnectButtonView"] && ![name containsString:@"ConnectStateView"]) return;
+ if (insideClass(v, @"InformationContainer")) return;
+ UIView *item = v;
+ while (item.superview && ![item.superview isKindOfClass:UIStackView.class]) item = item.superview;
+ if (item.superview && !item.hidden) item.hidden = YES;
+ });
+}
+
+%hook _TtC18NowPlaying_BarImpl27NowPlayingBarViewController
+- (void)viewDidLayoutSubviews {
+ %orig;
+ hideConnectButton(((UIViewController *)self).view);
+}
+%end
+
+%ctor {
+ if (!SGRedesignedUI() || !SGHidden(SGRHideBarConnect)) return;
+ %init;
+ SGRequireClasses(@[@"_TtC18NowPlaying_BarImpl27NowPlayingBarViewController"]);
+}
diff --git a/tweak/Sources/Redesigned/NowPlayingBar/NowPlayingBar.h b/tweak/Sources/Redesigned/NowPlayingBar/NowPlayingBar.h
new file mode 100644
index 00000000..6ea5ecd7
--- /dev/null
+++ b/tweak/Sources/Redesigned/NowPlayingBar/NowPlayingBar.h
@@ -0,0 +1,9 @@
+// The redesign's now playing bar: the glass card it becomes (NowPlayingBar.x), Spotify's device button
+// on that card hidden on request (BarConnect.x), and the bar's page in Mod Settings
+// (NowPlayingBarSettings.m). The redesign keeps its own copy of the hide switch and its own key; the
+// native look's lives in Native/NowPlayingBar/.
+#import <UIKit/UIKit.h>
+
+#define SGRHideBarConnect @"spotifyglass.redesign.hide.barConnect" // the device button on the card
+
+UIViewController *SGRNowPlayingBarSettingsPage(void);
diff --git a/tweak/Sources/Redesigned/NowPlayingBar/NowPlayingBarSettings.m b/tweak/Sources/Redesigned/NowPlayingBar/NowPlayingBarSettings.m
new file mode 100644
index 00000000..51f92c54
--- /dev/null
+++ b/tweak/Sources/Redesigned/NowPlayingBar/NowPlayingBarSettings.m
@@ -0,0 +1,12 @@
+// The Now playing page of the redesign, under Player (App/Pages.m puts it there).
+#import "Core/SGCore.h"
+#import "Settings/SGModPage.h"
+#import "NowPlayingBar.h"
+
+UIViewController *SGRNowPlayingBarSettingsPage(void) {
+ return [[SGModPage alloc] initWithTitle:@"Now playing" intro:SGRestartNote sections:@[
+ SGSection(nil, @[
+ SGHideRow(@"Hide the device button", @"The speaker icon on the now playing bar", SGRHideBarConnect),
+ ]),
+ ] footer:nil];
+}