Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.
C
feat: hide the device button in the now playing bar
Vojtěch Škopek2a025926b2b1
diff --git a/tweak/Sources/Features/NowPlaying/NowPlaying.h b/tweak/Sources/Features/NowPlaying/NowPlaying.hindex f6f13dd6..333ac162 100644--- a/tweak/Sources/Features/NowPlaying/NowPlaying.h+++ b/tweak/Sources/Features/NowPlaying/NowPlaying.h@@ -7,5 +7,6 @@#define SGKeyPlayer @"spotifyglass.player"#define SGKeyPlayerBackdrop @"spotifyglass.playerBackdrop"#define SGKeyLyricsCard @"spotifyglass.lyricsCard"+#define SGHideBarConnect @"spotifyglass.hide.barConnect" // the device button in the now playing barUIViewController *SGNowPlayingSettingsPage(void); // the Player pagediff --git a/tweak/Sources/Features/NowPlaying/NowPlayingBar.x b/tweak/Sources/Features/NowPlaying/NowPlayingBar.xindex ace6b113..7e7e0449 100644--- a/tweak/Sources/Features/NowPlaying/NowPlayingBar.x+++ b/tweak/Sources/Features/NowPlaying/NowPlayingBar.x@@ -85,6 +85,26 @@ static void restyleCardContent(UIView *card) {});}+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;+}++// 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.+static void hideConnectButton(UIView *bar) {+ if (!SGHidden(SGHideBarConnect)) return;+ 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;+ });+}+static void styleNowPlayingBar(UIViewController *container) {if (!SGFlag(SGKeyNowPlayingBar, NO)) return;UIViewController *barVC = container.childViewControllers.firstObject;@@ -168,6 +188,7 @@ static void playerTransition(id<UIViewControllerAnimatedTransitioning> animator,%hook _TtC18NowPlaying_BarImpl27NowPlayingBarViewController- (void)viewDidLayoutSubviews {%orig;+ hideConnectButton(((UIViewController *)self).view);UIViewController *parent = ((UIViewController *)self).parentViewController;if ([NSStringFromClass(parent.class) containsString:@"NowPlayingBarContainer"]) styleNowPlayingBar(parent);}diff --git a/tweak/Sources/Features/NowPlaying/NowPlayingSettings.m b/tweak/Sources/Features/NowPlaying/NowPlayingSettings.mindex b13d71a8..bfd6335c 100644--- a/tweak/Sources/Features/NowPlaying/NowPlayingSettings.m+++ b/tweak/Sources/Features/NowPlaying/NowPlayingSettings.m@@ -52,6 +52,7 @@ UIViewController *SGNowPlayingSettingsPage(void) {SGHideRow(@"Repeat", @"Right of the playback controls", SGHideRepeat),SGHideRow(@"Connect to a device", @"The speaker and device name in the bottom row", SGHideConnect),SGHideRow(@"Share", @"The share button in the bottom row", SGHideShare),+ SGHideRow(@"Device button in the bar", @"The speaker icon in the now playing bar", SGHideBarConnect),SGHideRow(@"Queue", @"The queue button in the bottom row", SGHideQueue),SGHideRow(@"Add to playlist", @"The plus next to the track title", SGHideAddTo),]),