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: add declutter options

Vojtěch Škopek7e1e53528c55
diff --git a/README.md b/README.md
index 95fb22c2..57a8a3b4 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ signed and installed from the Mac.
## Layout
- tweak/src/ui/*.x the tweaks: NowPlayingBar, TabBar, NowPlayingView, SearchField, LiquidGlassFlags, Amoled, Repaint, Settings
+ tweak/src/ui/*.x the tweaks: NowPlayingBar, TabBar, NowPlayingView, SearchField, LiquidGlassFlags, Amoled, Declutter, Repaint, Settings
tweak/src/SG* shared helpers (glass panes, view walking, logging, screen dumps)
scripts/ pipeline.sh (build + inject), install.sh (sign + install), record-trees.py, dump-log.sh
trees/ recorded view trees, one per screen; the input for every new tweak
@@ -23,7 +23,9 @@ signed and installed from the Mac.
make trees # record view trees screen by screen (FLEX build open on the phone, USB)
make log # stream [spotifyglass] log lines from the phone
-In the app, Settings → Mod Settings → UI Tweaks has a switch per tweak; a change shows after Spotify restarts.
+In the app, Settings → Mod Settings has a switch per tweak under UI Tweaks, and the two Declutter
+pages hide buttons and cards of the full screen player and sections of Home; a change shows after
+Spotify restarts.
Needs Theos in `~/theos` with an iPhoneOS SDK, Homebrew `make ldid dpkg zsign ideviceinstaller
libimobiledevice`, and cyan (`uv tool install "cyan @ git+https://github.com/asdfzxcvbn/pyzule-rw"`).
diff --git a/trees/screens.txt b/trees/screens.txt
index de9bdb9b..1c406bd5 100644
--- a/trees/screens.txt
+++ b/trees/screens.txt
@@ -10,6 +10,7 @@ now-playing | tap the now playing bar to open the full
now-playing 2 more scrolled| tap the now playing bar to open
now-playing 3 more scrolled| tap the now playing bar to open
now-playing 4 more scrolled| tap the now playing bar to open the full player, wait 2 s
+now-playing 5 more scrolled| tap the now playing bar to open the full player, wait 2 s
playlist list | open the playlist list
playlist | open any playlist
album | open any album
diff --git a/tweak/control b/tweak/control
index 115e5a53..9b59527d 100644
--- a/tweak/control
+++ b/tweak/control
@@ -1,6 +1,6 @@
Package: com.vojta.spotifyglass
Name: spotifyglass
-Version: 0.8.0
+Version: 0.9.2
Architecture: iphoneos-arm
Description: Liquid Glass for the Spotify iOS app
Maintainer: vojta
diff --git a/tweak/src/SGCommon.h b/tweak/src/SGCommon.h
index fd02d8e2..fb869e58 100644
--- a/tweak/src/SGCommon.h
+++ b/tweak/src/SGCommon.h
@@ -38,9 +38,13 @@ void SGStripBackgrounds(UIView *view);
BOOL SGIsVisibleColor(CGColorRef color);
BOOL SGIsLightColor(CGColorRef color);
+BOOL SGHasClass(UIView *root, NSString *marker);
+UIStackView *SGRowIn(UIView *host);
+
// Glass panes
UIVisualEffectView *SGGlassFor(UIView *host, const void *key);
UIVisualEffectView *SGGlassAt(UIView *host, NSUInteger index);
+void SGHideGlassFrom(UIView *host, NSUInteger count);
void SGShapeGlass(UIView *glass, CGFloat radius, BOOL capsule);
// Areas kept transparent by ui/Repaint.x, set by the tweaks that own them.
@@ -56,9 +60,34 @@ extern NSString *const SGKeyPlayer;
extern NSString *const SGKeySearchField;
extern NSString *const SGKeySpotifyGlass;
extern NSString *const SGKeyAmoled;
+BOOL SGFlag(NSString *key, BOOL fallback);
BOOL SGEnabled(NSString *key);
void SGSetEnabled(NSString *key, BOOL on);
+// Declutter switches from ui/Settings.x, read by ui/Declutter.x; an unset switch is off.
+#define SGHideShuffle @"spotifyglass.hide.shuffle"
+#define SGHideRepeat @"spotifyglass.hide.repeat"
+#define SGHideConnect @"spotifyglass.hide.connect"
+#define SGHideShare @"spotifyglass.hide.share"
+#define SGHideQueue @"spotifyglass.hide.queue"
+#define SGHideAddTo @"spotifyglass.hide.addTo"
+#define SGHideLyricsInline @"spotifyglass.hide.lyricsInline"
+#define SGHideLyricsCard @"spotifyglass.hide.lyricsCard"
+#define SGHideAboutArtist @"spotifyglass.hide.aboutArtist"
+#define SGHideRelatedVideos @"spotifyglass.hide.relatedVideos"
+#define SGHideSongDNA @"spotifyglass.hide.songDNA"
+#define SGHideLiveEvents @"spotifyglass.hide.liveEvents"
+#define SGHideExploreArtist @"spotifyglass.hide.exploreArtist"
+#define SGHideCredits @"spotifyglass.hide.credits"
+#define SGHideMerch @"spotifyglass.hide.merch"
+#define SGHideRecommendations @"spotifyglass.hide.recommendations"
+#define SGHideHomeShortcuts @"spotifyglass.hide.homeShortcuts"
+#define SGHideHomePills @"spotifyglass.hide.homePills"
+#define SGHideHomePromo @"spotifyglass.hide.homePromo"
+#define SGHideHomePreviews @"spotifyglass.hide.homePreviews"
+#define SGHideHomeDJ @"spotifyglass.hide.homeDJ"
+BOOL SGHidden(NSString *key);
+
// Diagnostics (SGDiagnostics.x)
BOOL SGIsDebugBuild(void);
NSString *SGScreenTree(void);
diff --git a/tweak/src/SGCommon.m b/tweak/src/SGCommon.m
index c1b72559..b6e24f1d 100644
--- a/tweak/src/SGCommon.m
+++ b/tweak/src/SGCommon.m
@@ -38,9 +38,17 @@ NSString *const SGKeySearchField = @"spotifyglass.searchField";
NSString *const SGKeySpotifyGlass = @"spotifyglass.spotifyGlass";
NSString *const SGKeyAmoled = @"spotifyglass.amoled";
-BOOL SGEnabled(NSString *key) {
+BOOL SGFlag(NSString *key, BOOL fallback) {
id value = [NSUserDefaults.standardUserDefaults objectForKey:key];
- return value ? [value boolValue] : YES;
+ return value ? [value boolValue] : fallback;
+}
+
+BOOL SGEnabled(NSString *key) {
+ return SGFlag(key, YES);
+}
+
+BOOL SGHidden(NSString *key) {
+ return SGFlag(key, NO);
}
void SGSetEnabled(NSString *key, BOOL on) {
@@ -99,6 +107,23 @@ BOOL SGIsLightColor(CGColorRef color) {
return YES;
}
+BOOL SGHasClass(UIView *root, NSString *marker) {
+ __block BOOL found = NO;
+ SGForEachView(root, ^(UIView *v) {
+ if (!found && [NSStringFromClass(v.class) containsString:marker]) found = YES;
+ });
+ return found;
+}
+
+// The first wide stack view under `host` with at least two arranged children: a player row.
+UIStackView *SGRowIn(UIView *host) {
+ __block UIStackView *row = nil;
+ SGForEachView(host, ^(UIView *v) {
+ if (!row && [v isKindOfClass:UIStackView.class] && v.bounds.size.width > 200 && ((UIStackView *)v).arrangedSubviews.count >= 2) row = (UIStackView *)v;
+ });
+ return row;
+}
+
BOOL SGLooksLikeCard(UIView *view, CGColorRef color) {
CGSize size = view.bounds.size;
return size.height >= 40 && size.height <= 140 && size.width >= 200 && SGIsVisibleColor(color);
@@ -130,8 +155,9 @@ UIVisualEffectView *SGGlassFor(UIView *host, const void *key) {
}
// Several panes on one host, addressed by index.
+static char kPanesKey;
+
UIVisualEffectView *SGGlassAt(UIView *host, NSUInteger index) {
- static char kPanesKey;
NSMutableArray<UIVisualEffectView *> *panes = objc_getAssociatedObject(host, &kPanesKey);
if (!panes) {
panes = [NSMutableArray array];
@@ -139,10 +165,17 @@ UIVisualEffectView *SGGlassAt(UIView *host, NSUInteger index) {
}
while (panes.count <= index) [panes addObject:newPane()];
UIVisualEffectView *glass = panes[index];
+ glass.hidden = NO;
if (glass.superview != host) [host insertSubview:glass atIndex:0];
return glass;
}
+// Panes past `count` belonged to children that are gone now.
+void SGHideGlassFrom(UIView *host, NSUInteger count) {
+ NSArray<UIVisualEffectView *> *panes = objc_getAssociatedObject(host, &kPanesKey);
+ for (NSUInteger i = count; i < panes.count; i++) panes[i].hidden = YES;
+}
+
// Glass takes its shape from cornerConfiguration on iOS 26; layer.cornerRadius is the fallback.
void SGShapeGlass(UIView *glass, CGFloat radius, BOOL capsule) {
Class config = NSClassFromString(@"UICornerConfiguration");
diff --git a/tweak/src/SGDiagnostics.x b/tweak/src/SGDiagnostics.x
index a8b557c2..be53d1bf 100644
--- a/tweak/src/SGDiagnostics.x
+++ b/tweak/src/SGDiagnostics.x
@@ -23,6 +23,8 @@ static void appendTree(UIView *view, NSUInteger depth, NSMutableString *out) {
if (view.hidden) [line appendString:@" hidden"];
if (view.layer.mask) [line appendString:@" masked"];
if (view.clipsToBounds) [line appendString:@" clips"];
+ if (view.accessibilityIdentifier.length) [line appendFormat:@" id=%@", view.accessibilityIdentifier];
+ if ([view isKindOfClass:UIControl.class] && view.accessibilityLabel.length) [line appendFormat:@" a11y=\"%@\"", view.accessibilityLabel];
if ([view isKindOfClass:UILabel.class]) {
UILabel *label = (UILabel *)view;
[line appendFormat:@" \"%@\" %.0fpt %@", label.text, label.font.pointSize, hexColor(label.textColor.CGColor)];
diff --git a/tweak/src/ui/Declutter.x b/tweak/src/ui/Declutter.x
new file mode 100644
index 00000000..2cf00a8a
--- /dev/null
+++ b/tweak/src/ui/Declutter.x
@@ -0,0 +1,155 @@
+// Declutter: hides parts of the full screen player and of Home, one switch each in Mod Settings.
+// Cards under the player and sections on Home are Element_List cells; a hidden one reports zero
+// height when the list sizes it, so the list closes up around it (the 24pt gap between cards
+// stays). Player buttons go invisible but keep their place, so their row stays centred.
+//
+// Trees (trees/now-playing*.txt, trees/home*.txt): every card is a CollectionViewCell whose
+// content view names the page (NowPlaying_ScrollAPI, Home_EvoPageImpl) and whose subtree names
+// the card. Player rows are the UIStackView of each NowPlaying_ModesImpl unit: playback controls
+// hold shuffle, previous, play, next, repeat; the footer holds connect, a hidden button, share
+// and the queue; track info ends with the add-to button.
+#import "SGCommon.h"
+
+#pragma mark - cards and sections
+
+static const struct { __unsafe_unretained NSString *page, *marker, *key; } cards[] = {
+ {@"NowPlaying_ScrollAPI", @"Lyrics_CardElementImpl", SGHideLyricsCard},
+ {@"NowPlaying_ScrollAPI", @"CreatorBiography", SGHideAboutArtist},
+ {@"NowPlaying_ScrollAPI", @"VideoRecommendations", SGHideRelatedVideos},
+ {@"NowPlaying_ScrollAPI", @"SongDNA_", SGHideSongDNA},
+ {@"NowPlaying_ScrollAPI", @"LiveEvents_", SGHideLiveEvents},
+ {@"NowPlaying_ScrollAPI", @"WatchFeed_", SGHideExploreArtist},
+ {@"NowPlaying_ScrollAPI", @"Creator_Credits", SGHideCredits},
+ {@"NowPlaying_ScrollAPI", @"Merch_", SGHideMerch},
+ {@"NowPlaying_ScrollAPI", @"RelatedContentRecommendations", SGHideRecommendations},
+ {@"Home_EvoPageImpl", @"Home_AnchorsAndShortcutsKit", SGHideHomeShortcuts},
+ {@"Home_EvoPageImpl", @"Discovery_PromoElement", SGHideHomePromo},
+ {@"Home_EvoPageImpl", @"Discovery_PreviewElement", SGHideHomePreviews},
+ {@"Home_EvoPageImpl", @"Discovery_DJElement", SGHideHomeDJ},
+};
+
+// Class names of everything in the cell. Lists nested in the cell are laid out first so the
+// cells that name the card (shortcut tiles, video cards) exist.
+static NSString *classNamesIn(UIView *cell) {
+ NSMutableString *names = [NSMutableString string];
+ SGForEachView(cell, ^(UIView *v) {
+ if (v != cell && [v isKindOfClass:UICollectionView.class]) [v layoutIfNeeded];
+ [names appendString:NSStringFromClass(v.class)];
+ [names appendString:@"\n"];
+ });
+ return names;
+}
+
+static NSString *hiddenKeyFor(UICollectionViewCell *cell) {
+ // A cell inside another card's list: the outer card decides.
+ for (UIView *v = cell.superview; v; v = v.superview) {
+ if ([v isKindOfClass:cell.class]) return nil;
+ }
+ NSString *names = nil;
+ for (size_t i = 0; i < sizeof(cards) / sizeof(cards[0]); i++) {
+ if (!SGHidden(cards[i].key)) continue;
+ if (!names) names = classNamesIn(cell);
+ if ([names containsString:cards[i].page] && [names containsString:cards[i].marker]) return cards[i].key;
+ }
+ return nil;
+}
+
+%hook _TtC12Element_List18CollectionViewCell
+- (UICollectionViewLayoutAttributes *)preferredLayoutAttributesFittingAttributes:(UICollectionViewLayoutAttributes *)attributes {
+ UICollectionViewLayoutAttributes *result = %orig;
+ NSString *key = hiddenKeyFor((UICollectionViewCell *)self);
+ if (!key) return result;
+ result.size = CGSizeMake(result.size.width, 0);
+ ((UIView *)self).clipsToBounds = YES;
+ static dispatch_once_t once;
+ dispatch_once(&once, ^{ SGLog(@"collapsed the first card, %@", key); });
+ return result;
+}
+%end
+
+#pragma mark - player buttons
+
+static BOOL vanish(UIView *view) {
+ if (!view || view.alpha == 0) return NO;
+ view.alpha = 0;
+ view.userInteractionEnabled = NO;
+ return YES;
+}
+
+// Re-layout once something went invisible, so the glass panes of ui/NowPlayingView.x follow.
+static void finish(UIViewController *unit, BOOL changed) {
+ if (changed) [unit.viewIfLoaded setNeedsLayout];
+}
+
+%hook _TtC20NowPlaying_ModesImpl28PlaybackControlsElementsUnit
+- (void)viewDidLayoutSubviews {
+ %orig;
+ NSArray<UIView *> *items = SGRowIn(((UIViewController *)self).viewIfLoaded).arrangedSubviews;
+ if (items.count != 5 || !SGHasClass(items[2], @"PlayButton")) return;
+ BOOL changed = NO;
+ if (SGHidden(SGHideShuffle)) changed |= vanish(items[0]);
+ if (SGHidden(SGHideRepeat)) changed |= vanish(items[4]);
+ finish((UIViewController *)self, changed);
+}
+%end
+
+%hook _TtC20NowPlaying_ModesImpl18FooterElementsUnit
+- (void)viewDidLayoutSubviews {
+ %orig;
+ BOOL changed = NO;
+ for (UIView *item in SGRowIn(((UIViewController *)self).viewIfLoaded).arrangedSubviews) {
+ if (item.hidden || item.bounds.size.width < 20) continue;
+ if (SGHasClass(item, @"Connect")) {
+ if (SGHidden(SGHideConnect)) changed |= vanish(item);
+ } else if (SGHasClass(item, @"QueueButton")) {
+ if (SGHidden(SGHideQueue)) changed |= vanish(item);
+ } else if (item.bounds.size.width <= 48 && SGHasClass(item, @"EncoreButton")) {
+ if (SGHidden(SGHideShare)) changed |= vanish(item);
+ }
+ }
+ finish((UIViewController *)self, changed);
+}
+%end
+
+%hook _TtC20NowPlaying_ModesImpl23InformationElementsUnit
+- (void)viewDidLayoutSubviews {
+ %orig;
+ if (!SGHidden(SGHideAddTo)) return;
+ BOOL changed = NO;
+ for (UIView *item in SGRowIn(((UIViewController *)self).viewIfLoaded).arrangedSubviews) {
+ if (SGHasClass(item, @"AddToButton")) changed |= vanish(item);
+ }
+ finish((UIViewController *)self, changed);
+}
+%end
+
+#pragma mark - lyrics under the artwork, Home filter pills
+
+%hook _TtC22Lyrics_NPVContainerKit19LyricsContainerView
+- (void)setHidden:(BOOL)hidden {
+ %orig(SGHidden(SGHideLyricsInline) ? YES : hidden);
+}
+- (void)didMoveToWindow {
+ %orig;
+ if (SGHidden(SGHideLyricsInline)) ((UIView *)self).hidden = YES;
+}
+%end
+
+%hook _TtC14Home_PillUIKit14PillScrollView
+- (void)didMoveToWindow {
+ %orig;
+ if (SGHidden(SGHideHomePills)) ((UIView *)self).hidden = YES;
+}
+%end
+
+%ctor {
+ %init;
+ SGRequireClasses(@[
+ @"_TtC12Element_List18CollectionViewCell",
+ @"_TtC20NowPlaying_ModesImpl28PlaybackControlsElementsUnit",
+ @"_TtC20NowPlaying_ModesImpl18FooterElementsUnit",
+ @"_TtC20NowPlaying_ModesImpl23InformationElementsUnit",
+ @"_TtC22Lyrics_NPVContainerKit19LyricsContainerView",
+ @"_TtC14Home_PillUIKit14PillScrollView",
+ ]);
+}
diff --git a/tweak/src/ui/NowPlayingView.x b/tweak/src/ui/NowPlayingView.x
index 6a391408..1585f1fc 100644
--- a/tweak/src/ui/NowPlayingView.x
+++ b/tweak/src/ui/NowPlayingView.x
@@ -7,20 +7,18 @@
#import "SGCommon.h"
// A pane per direct child of the unit's row: circles for square children, capsules for wide ones.
-// `fixedSize` forces every pane to one size; children containing a `skip` class get none.
+// `fixedSize` forces every pane to one size; children containing a `skip` class get none, nor do
+// the ones ui/Declutter.x made invisible.
static void glassBehindRowChildren(UIViewController *unit, CGFloat minSize, CGFloat fixedSize, NSString *skip) {
if (!SGEnabled(SGKeyPlayer)) return;
UIView *host = unit.viewIfLoaded;
- __block UIStackView *row = nil;
- SGForEachView(host, ^(UIView *v) {
- if (!row && [v isKindOfClass:UIStackView.class] && v.bounds.size.width > 200 && ((UIStackView *)v).arrangedSubviews.count >= 2) row = (UIStackView *)v;
- });
+ UIStackView *row = SGRowIn(host);
if (!row) return;
[row layoutIfNeeded];
NSUInteger index = 0;
for (UIView *child in row.arrangedSubviews) {
CGRect f = SGFrameIn(child, host);
- if (child.hidden || f.size.width < 20 || f.size.height < 20) continue;
+ if (child.hidden || child.alpha == 0 || f.size.width < 20 || f.size.height < 20) continue;
__block BOOL skipped = NO;
if (skip) SGForEachView(child, ^(UIView *v) { if ([NSStringFromClass(v.class) containsString:skip]) skipped = YES; });
if (skipped) continue;
@@ -30,6 +28,7 @@ static void glassBehindRowChildren(UIViewController *unit, CGFloat minSize, CGFl
glass.frame = CGRectMake(CGRectGetMidX(f) - width / 2, CGRectGetMidY(f) - height / 2, width, height);
SGShapeGlass(glass, height / 2, YES);
}
+ SGHideGlassFrom(host, index);
}
%hook _TtC20NowPlaying_ModesImpl18HeaderElementsUnit
diff --git a/tweak/src/ui/Settings.x b/tweak/src/ui/Settings.x
index 5723474f..79ab5460 100644
--- a/tweak/src/ui/Settings.x
+++ b/tweak/src/ui/Settings.x
@@ -1,6 +1,6 @@
// Settings: a Mod Settings row at the end of Spotify's settings list opens the mod's own pages,
-// Mod Settings (UI Tweaks, a note about the mod) > UI Tweaks (a switch per tweak). The tweaks
-// read the switches when they run, so a change shows after Spotify restarts.
+// Mod Settings (UI Tweaks, the two Declutter pages, a note about the mod), each a list of
+// switches. The tweaks read the switches when they run, so a change shows after Spotify restarts.
//
// Tree (trees/settings.txt): SettingsListViewController.view > SettingsListCollectionView of
// Element_List cells 402x56: 24pt icon at x 12, 13pt white title and 11pt grey subtitle at
@@ -53,13 +53,29 @@ static void fitNote(UITableView *table, UIView *wrapper, CGFloat top, CGFloat bo
else table.tableFooterView = wrapper;
}
+// The now playing bar and the tab bar float over the content, and the safe area does not cover
+// them, so the pages inset themselves by however much of the window the bars take.
+static CGFloat barsHeight(UIView *view) {
+ UIWindow *window = view.window;
+ __block CGFloat top = window.bounds.size.height;
+ SGForEachView(window, ^(UIView *v) {
+ NSString *name = NSStringFromClass(v.class);
+ BOOL bar = [name containsString:@"NowPlaying_BarPageImpl"] || [name isEqualToString:@"_TtC23NavigationUI_TabBarImpl10TabBarView"];
+ if (!bar || v.hidden || v.alpha == 0 || v.bounds.size.height == 0) return;
+ top = MIN(top, SGFrameIn(v, window).origin.y);
+ });
+ return window.bounds.size.height - top;
+}
+
#pragma mark - pages
-// A row is a switch when it has a key, a link to another page when it has a page.
+// A row is a switch when it has a key, a link to another page when it has a page, and a caption
+// over the rows below it when it has neither.
@interface SGModRow : NSObject
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *subtitle;
@property (nonatomic, copy) NSString *key;
+@property (nonatomic) BOOL defaultOn;
@property (nonatomic, copy) UIViewController *(^page)(void);
@end
@@ -71,6 +87,19 @@ static SGModRow *switchRow(NSString *title, NSString *subtitle, NSString *key) {
row.title = title;
row.subtitle = subtitle;
row.key = key;
+ row.defaultOn = YES;
+ return row;
+}
+
+static SGModRow *hideRow(NSString *title, NSString *subtitle, NSString *key) {
+ SGModRow *row = switchRow(title, subtitle, key);
+ row.defaultOn = NO;
+ return row;
+}
+
+static SGModRow *captionRow(NSString *title) {
+ SGModRow *row = [SGModRow new];
+ row.title = title;
return row;
}
@@ -116,6 +145,17 @@ static SGModRow *pageRow(NSString *title, NSString *subtitle, UIViewController *
if (_footer) fitNote(self.tableView, _footer, 16, 24);
}
+- (void)viewDidLayoutSubviews {
+ [super viewDidLayoutSubviews];
+ UITableView *table = self.tableView;
+ CGFloat bottom = MAX(0, barsHeight(table) - table.safeAreaInsets.bottom);
+ if (table.contentInset.bottom == bottom) return;
+ UIEdgeInsets inset = table.contentInset;
+ inset.bottom = bottom;
+ table.contentInset = inset;
+ table.verticalScrollIndicatorInsets = inset;
+}
+
- (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section {
return (NSInteger)_rows.count;
}
@@ -124,28 +164,30 @@ static SGModRow *pageRow(NSString *title, NSString *subtitle, UIViewController *
UITableViewCell *cell = [table dequeueReusableCellWithIdentifier:@"row"]
?: [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"row"];
SGModRow *row = _rows[(NSUInteger)path.row];
+ BOOL caption = !row.key && !row.page;
UIListContentConfiguration *content = [UIListContentConfiguration subtitleCellConfiguration];
content.text = row.title;
content.secondaryText = row.subtitle;
- content.textProperties.font = titleFont();
- content.textProperties.color = UIColor.whiteColor;
+ content.textProperties.font = caption ? subtitleFont() : titleFont();
+ content.textProperties.color = caption ? grey() : UIColor.whiteColor;
content.secondaryTextProperties.font = subtitleFont();
content.secondaryTextProperties.color = grey();
content.textToSecondaryTextVerticalPadding = 0;
- content.directionalLayoutMargins = NSDirectionalEdgeInsetsMake(10, 16, 10, 16);
+ content.directionalLayoutMargins = NSDirectionalEdgeInsetsMake(caption ? 20 : 10, 16, caption ? 4 : 10, 16);
cell.contentConfiguration = content;
cell.backgroundColor = UIColor.clearColor;
+ cell.accessoryView = nil;
+ cell.selectionStyle = UITableViewCellSelectionStyleNone;
if (row.key) {
UISwitch *toggle = [UISwitch new];
toggle.onTintColor = [UIColor colorWithRed:0x1E / 255.0 green:0xD7 / 255.0 blue:0x60 / 255.0 alpha:1];
- toggle.on = SGEnabled(row.key);
+ toggle.on = SGFlag(row.key, row.defaultOn);
toggle.tag = path.row;
[toggle addTarget:self action:@selector(toggled:) forControlEvents:UIControlEventValueChanged];
cell.accessoryView = toggle;
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- } else {
+ } else if (row.page) {
cell.accessoryView = symbol(@"chevron.right", 13, UIImageSymbolWeightSemibold, 16);
cell.selectionStyle = UITableViewCellSelectionStyleDefault;
}
@@ -174,12 +216,48 @@ static UIViewController *uiTweaksPage(void) {
] footer:nil];
}
+static UIViewController *playerDeclutterPage(void) {
+ return [[SGModPage alloc] initWithTitle:@"Declutter the player" intro:@"Switch on what should go from the full screen player. Changes apply after you restart Spotify." rows:@[
+ captionRow(@"BUTTONS"),
+ hideRow(@"Shuffle", @"Left of the playback controls", SGHideShuffle),
+ hideRow(@"Repeat", @"Right of the playback controls", SGHideRepeat),
+ hideRow(@"Connect to a device", @"The speaker and device name in the bottom row", SGHideConnect),
+ hideRow(@"Share", @"The share button in the bottom row", SGHideShare),
+ hideRow(@"Queue", @"The queue button in the bottom row", SGHideQueue),
+ hideRow(@"Add to playlist", @"The plus next to the track title", SGHideAddTo),
+ captionRow(@"UNDER THE ARTWORK"),
+ hideRow(@"Lyrics preview", @"The lyric lines shown under the artwork", SGHideLyricsInline),
+ captionRow(@"CARDS BELOW THE PLAYER"),
+ hideRow(@"Lyrics", @"The lyrics card", SGHideLyricsCard),
+ hideRow(@"About the artist", @"Photo, listeners and biography", SGHideAboutArtist),
+ hideRow(@"Related videos", @"The video carousel", SGHideRelatedVideos),
+ hideRow(@"SongDNA", @"Discover the people behind the song", SGHideSongDNA),
+ hideRow(@"Live events", @"Concerts and tickets", SGHideLiveEvents),
+ hideRow(@"Explore the artist", @"The vertical video cards", SGHideExploreArtist),
+ hideRow(@"Credits", @"Performers and writers", SGHideCredits),
+ hideRow(@"Merch", @"The artist's shop", SGHideMerch),
+ hideRow(@"Recommendations", @"\"Artist: what you might like\", the episode and track rows", SGHideRecommendations),
+ ] footer:nil];
+}
+
+static UIViewController *homeDeclutterPage(void) {
+ return [[SGModPage alloc] initWithTitle:@"Declutter Home" intro:@"Switch on what should go from the Home tab. Changes apply after you restart Spotify." rows:@[
+ hideRow(@"Filter pills", @"Music and Podcasts next to your avatar", SGHideHomePills),
+ hideRow(@"Shortcuts grid", @"The tiles at the top", SGHideHomeShortcuts),
+ hideRow(@"Promo cards", @"Single cards such as the next episode of a podcast", SGHideHomePromo),
+ hideRow(@"Preview cards", @"Album, playlist and video previews with a play button", SGHideHomePreviews),
+ hideRow(@"DJ card", @"Your own personal DJ", SGHideHomeDJ),
+ ] footer:@"The shelves (Your top mixes, Jump back in, Recents and the rest) all share one card type, so they cannot be told apart yet."];
+}
+
static UIViewController *modSettingsPage(void) {
NSString *spotify = [NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
NSString *about = [NSString stringWithFormat:@"spotifyglass %s · Spotify %@\n"
"Liquid Glass and other UI tweaks for the Spotify iOS app, a Theos tweak injected into the decrypted IPA.", SG_VERSION, spotify];
return [[SGModPage alloc] initWithTitle:@"Mod Settings" intro:nil rows:@[
pageRow(@"UI Tweaks", @"Liquid Glass • AMOLED background", ^UIViewController *{ return uiTweaksPage(); }),
+ pageRow(@"Declutter the player", @"Hide buttons and cards in the full screen player", ^UIViewController *{ return playerDeclutterPage(); }),
+ pageRow(@"Declutter Home", @"Hide sections of the Home tab", ^UIViewController *{ return homeDeclutterPage(); }),
] footer:about];
}
@@ -202,7 +280,7 @@ static UIViewController *modSettingsPage(void) {
_title.text = @"Mod Settings";
_title.textColor = UIColor.whiteColor;
_subtitle = [UILabel new];
- _subtitle.text = @"UI Tweaks";
+ _subtitle.text = @"UI Tweaks • Declutter";
_subtitle.textColor = grey();
_chevron = symbol(@"chevron.right", 11, UIImageSymbolWeightSemibold, 12);
for (UIView *v in @[_icon, _title, _subtitle, _chevron]) [self addSubview:v];