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 mod settings and AMOLED theme

Vojtěch Škopek12448bddd914
diff --git a/README.md b/README.md
index 9d5134ae..95fb22c2 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, Repaint
+ tweak/src/ui/*.x the tweaks: NowPlayingBar, TabBar, NowPlayingView, SearchField, LiquidGlassFlags, Amoled, 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,6 +23,8 @@ 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.
+
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"`).
Signing reads `SIGN_P12`, `SIGN_PROFILE` and `SIGN_P12_PASSWORD` from `.signing.env`. The app is
diff --git a/trees/screens.txt b/trees/screens.txt
index 753ba9c3..de9bdb9b 100644
--- a/trees/screens.txt
+++ b/trees/screens.txt
@@ -19,3 +19,5 @@ artist 3 more scrolled | open any artist page
queue | open the queue from the player
lyrics | open the lyrics from the player
settings | avatar → settings
+settings notifications opened | avatar → settings
+
diff --git a/tweak/Makefile b/tweak/Makefile
index f7bab456..fa4962ef 100644
--- a/tweak/Makefile
+++ b/tweak/Makefile
@@ -6,8 +6,10 @@ include $(THEOS)/makefiles/common.mk
TWEAK_NAME := spotifyglass
+SG_VERSION := $(shell sed -n 's/^Version: //p' control)
+
spotifyglass_FILES := $(wildcard src/*.m) $(wildcard src/*.x) $(wildcard src/ui/*.x)
-spotifyglass_CFLAGS := -fobjc-arc -Isrc
+spotifyglass_CFLAGS := -fobjc-arc -Isrc -DSG_VERSION=\"$(SG_VERSION)\"
spotifyglass_FRAMEWORKS := UIKit QuartzCore
# Runtime swizzling instead of Substrate so the dylib has no extra dependency inside the IPA.
spotifyglass_LOGOS_DEFAULT_GENERATOR := internal
diff --git a/tweak/control b/tweak/control
index eb8d97c3..115e5a53 100644
--- a/tweak/control
+++ b/tweak/control
@@ -1,6 +1,6 @@
Package: com.vojta.spotifyglass
Name: spotifyglass
-Version: 0.6.0
+Version: 0.8.0
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 94e166b5..fd02d8e2 100644
--- a/tweak/src/SGCommon.h
+++ b/tweak/src/SGCommon.h
@@ -49,6 +49,16 @@ extern __weak UIView *sg_tabBarRoot;
extern __weak UIView *sg_nowPlayingCard;
BOOL SGLooksLikeCard(UIView *view, CGColorRef color);
+// Switches from ui/Settings.x, one per tweak; an unset switch is on.
+extern NSString *const SGKeyNowPlayingBar;
+extern NSString *const SGKeyTabBar;
+extern NSString *const SGKeyPlayer;
+extern NSString *const SGKeySearchField;
+extern NSString *const SGKeySpotifyGlass;
+extern NSString *const SGKeyAmoled;
+BOOL SGEnabled(NSString *key);
+void SGSetEnabled(NSString *key, BOOL on);
+
// Diagnostics (SGDiagnostics.x)
BOOL SGIsDebugBuild(void);
NSString *SGScreenTree(void);
diff --git a/tweak/src/SGCommon.m b/tweak/src/SGCommon.m
index a0c5aaa1..c1b72559 100644
--- a/tweak/src/SGCommon.m
+++ b/tweak/src/SGCommon.m
@@ -29,6 +29,24 @@ void SGRequireClasses(NSArray<NSString *> *names) {
}
}
+#pragma mark - switches
+
+NSString *const SGKeyNowPlayingBar = @"spotifyglass.nowPlayingBar";
+NSString *const SGKeyTabBar = @"spotifyglass.tabBar";
+NSString *const SGKeyPlayer = @"spotifyglass.player";
+NSString *const SGKeySearchField = @"spotifyglass.searchField";
+NSString *const SGKeySpotifyGlass = @"spotifyglass.spotifyGlass";
+NSString *const SGKeyAmoled = @"spotifyglass.amoled";
+
+BOOL SGEnabled(NSString *key) {
+ id value = [NSUserDefaults.standardUserDefaults objectForKey:key];
+ return value ? [value boolValue] : YES;
+}
+
+void SGSetEnabled(NSString *key, BOOL on) {
+ [NSUserDefaults.standardUserDefaults setBool:on forKey:key];
+}
+
#pragma mark - view tree
void SGForEachView(UIView *view, void (^fn)(UIView *)) {
diff --git a/tweak/src/ui/Amoled.x b/tweak/src/ui/Amoled.x
new file mode 100644
index 00000000..d35a1819
--- /dev/null
+++ b/tweak/src/ui/Amoled.x
@@ -0,0 +1,57 @@
+// AMOLED background: Spotify paints its base surface #121212; with the switch on, that grey and
+// the gradients fading into it go pure black. Lighter greys stay (#1F1F1F placeholders, #292929
+// cards), so elevated surfaces still read against the black.
+//
+// Trees: #121212 sits on the Home, Search, Library and settings scroll views, on list rows, the
+// message bar and the player's bottom gradient view.
+#import "SGCommon.h"
+
+// Neutral and darker than #1A1A1A, but not already black.
+static BOOL isBaseGrey(CGColorRef color) {
+ if (!color || CFGetTypeID(color) != CGColorGetTypeID()) return NO;
+ const CGFloat *c = CGColorGetComponents(color);
+ size_t n = CGColorGetNumberOfComponents(color);
+ if (n == 2) return c[0] > 0.01 && c[0] <= 0.10;
+ if (n < 3) return NO;
+ return c[0] > 0.01 && c[0] <= 0.10 && fabs(c[0] - c[1]) < 0.02 && fabs(c[1] - c[2]) < 0.02;
+}
+
+// Layers get set from background threads too, so no autoreleased UIColor here.
+static CGColorRef copyBlack(CGColorRef color) {
+ return CGColorCreateGenericGray(0, CGColorGetAlpha(color));
+}
+
+%hook CALayer
+- (void)setBackgroundColor:(CGColorRef)color {
+ if (!isBaseGrey(color)) {
+ %orig;
+ return;
+ }
+ CGColorRef black = copyBlack(color);
+ %orig(black);
+ CGColorRelease(black);
+}
+%end
+
+%hook CAGradientLayer
+- (void)setColors:(NSArray *)colors {
+ NSMutableArray *mapped = [[NSMutableArray alloc] initWithCapacity:colors.count];
+ for (id entry in colors) {
+ CGColorRef color = (__bridge CGColorRef)entry;
+ if (!isBaseGrey(color)) {
+ [mapped addObject:entry];
+ continue;
+ }
+ CGColorRef black = copyBlack(color);
+ [mapped addObject:(__bridge id)black];
+ CGColorRelease(black);
+ }
+ %orig(colors ? mapped : nil);
+}
+%end
+
+%ctor {
+ if (SGEnabled(SGKeyAmoled)) {
+ %init;
+ }
+}
diff --git a/tweak/src/ui/LiquidGlassFlags.x b/tweak/src/ui/LiquidGlassFlags.x
index 24ef5de7..17940e9b 100644
--- a/tweak/src/ui/LiquidGlassFlags.x
+++ b/tweak/src/ui/LiquidGlassFlags.x
@@ -3,11 +3,15 @@
#import "SGCommon.h"
%hook _TtC33Reprise_LiquidGlassPropertiesImpl25LiquidGlassPropertiesImpl
-- (BOOL)isContextMenuInNavigationBarEnabled { return YES; }
+- (BOOL)isContextMenuInNavigationBarEnabled {
+ return SGEnabled(SGKeySpotifyGlass) ? YES : %orig;
+}
%end
%hook SPTHubViewController
-- (BOOL)prefersLiquidGlassNavigationBar { return YES; }
+- (BOOL)prefersLiquidGlassNavigationBar {
+ return SGEnabled(SGKeySpotifyGlass) ? YES : %orig;
+}
%end
%ctor {
diff --git a/tweak/src/ui/NowPlayingBar.x b/tweak/src/ui/NowPlayingBar.x
index 68b3f8e5..72c9ccae 100644
--- a/tweak/src/ui/NowPlayingBar.x
+++ b/tweak/src/ui/NowPlayingBar.x
@@ -55,6 +55,7 @@ static void restyleCardContent(UIView *card) {
}
static void styleNowPlayingBar(UIViewController *container) {
+ if (!SGEnabled(SGKeyNowPlayingBar)) return;
UIViewController *barVC = container.childViewControllers.firstObject;
UIView *bar = barVC.viewIfLoaded ?: container.view;
sg_nowPlayingRoot = bar;
diff --git a/tweak/src/ui/NowPlayingView.x b/tweak/src/ui/NowPlayingView.x
index eb9d7c93..6a391408 100644
--- a/tweak/src/ui/NowPlayingView.x
+++ b/tweak/src/ui/NowPlayingView.x
@@ -9,6 +9,7 @@
// 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.
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) {
diff --git a/tweak/src/ui/SearchField.x b/tweak/src/ui/SearchField.x
index 8e507e2f..49c03251 100644
--- a/tweak/src/ui/SearchField.x
+++ b/tweak/src/ui/SearchField.x
@@ -8,6 +8,7 @@
static char kStyledKey;
static void styleSearchField(UIView *button) {
+ if (!SGEnabled(SGKeySearchField)) return;
CGSize size = button.bounds.size;
if (size.width < 200 || size.height < 40 || size.height > 60) return;
BOOL styled = [objc_getAssociatedObject(button, &kStyledKey) boolValue];
diff --git a/tweak/src/ui/Settings.x b/tweak/src/ui/Settings.x
new file mode 100644
index 00000000..5723474f
--- /dev/null
+++ b/tweak/src/ui/Settings.x
@@ -0,0 +1,298 @@
+// 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.
+//
+// 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
+// x 48, 12pt chevron on the right. A pushed page (trees/settings notifications opened.txt) is a
+// UITableView bg #121212: header with an 11pt grey description at (16, 24), 53pt cells with the
+// title and subtitle at (16, 10) and a 16pt disclosure chevron at x 370.
+#import "SGCommon.h"
+
+static const CGFloat kRowHeight = 56;
+static char kRowKey, kInsetKey;
+static UIFont *sg_titleFont, *sg_subtitleFont;
+
+static UIColor *grey(void) { return [UIColor colorWithWhite:0xB3 / 255.0 alpha:1]; }
+static UIFont *titleFont(void) { return sg_titleFont ?: [UIFont systemFontOfSize:13 weight:UIFontWeightBold]; }
+static UIFont *subtitleFont(void) { return sg_subtitleFont ?: [UIFont systemFontOfSize:11]; }
+
+static UIImageView *symbol(NSString *name, CGFloat size, UIImageSymbolWeight weight, CGFloat box) {
+ UIImage *image = [UIImage systemImageNamed:name withConfiguration:[UIImageSymbolConfiguration configurationWithPointSize:size weight:weight]];
+ UIImageView *view = [[UIImageView alloc] initWithImage:image];
+ view.tintColor = UIColor.whiteColor;
+ view.contentMode = UIViewContentModeCenter;
+ view.frame = CGRectMake(0, 0, box, box);
+ return view;
+}
+
+// A grey note in a wrapper view, for the table header and footer.
+static UIView *note(NSString *text) {
+ UILabel *label = [UILabel new];
+ label.text = text;
+ label.font = subtitleFont();
+ label.textColor = grey();
+ label.numberOfLines = 0;
+ UIView *wrapper = [UIView new];
+ [wrapper addSubview:label];
+ return wrapper;
+}
+
+// Header and footer views keep the height they are given, so size them to their text. Only the
+// size is compared: the table moves the footer's origin itself, and reassigning on that would
+// loop forever.
+static void fitNote(UITableView *table, UIView *wrapper, CGFloat top, CGFloat bottom) {
+ UILabel *label = wrapper.subviews.firstObject;
+ CGFloat width = table.bounds.size.width - 32;
+ CGFloat height = ceil([label sizeThatFits:CGSizeMake(width, CGFLOAT_MAX)].height);
+ label.frame = CGRectMake(16, top, width, height);
+ CGSize size = CGSizeMake(table.bounds.size.width, top + height + bottom);
+ if (CGSizeEqualToSize(wrapper.bounds.size, size)) return;
+ wrapper.frame = (CGRect){wrapper.frame.origin, size};
+ if (wrapper == table.tableHeaderView) table.tableHeaderView = wrapper;
+ else table.tableFooterView = wrapper;
+}
+
+#pragma mark - pages
+
+// A row is a switch when it has a key, a link to another page when it has a page.
+@interface SGModRow : NSObject
+@property (nonatomic, copy) NSString *title;
+@property (nonatomic, copy) NSString *subtitle;
+@property (nonatomic, copy) NSString *key;
+@property (nonatomic, copy) UIViewController *(^page)(void);
+@end
+
+@implementation SGModRow
+@end
+
+static SGModRow *switchRow(NSString *title, NSString *subtitle, NSString *key) {
+ SGModRow *row = [SGModRow new];
+ row.title = title;
+ row.subtitle = subtitle;
+ row.key = key;
+ return row;
+}
+
+static SGModRow *pageRow(NSString *title, NSString *subtitle, UIViewController *(^page)(void)) {
+ SGModRow *row = [SGModRow new];
+ row.title = title;
+ row.subtitle = subtitle;
+ row.page = page;
+ return row;
+}
+
+@interface SGModPage : UITableViewController
+- (instancetype)initWithTitle:(NSString *)title intro:(NSString *)intro rows:(NSArray<SGModRow *> *)rows footer:(NSString *)footer;
+@end
+
+@implementation SGModPage {
+ NSArray<SGModRow *> *_rows;
+ UIView *_intro;
+ UIView *_footer;
+}
+
+- (instancetype)initWithTitle:(NSString *)title intro:(NSString *)intro rows:(NSArray<SGModRow *> *)rows footer:(NSString *)footer {
+ if (!(self = [super initWithStyle:UITableViewStylePlain])) return nil;
+ self.title = title;
+ _rows = rows;
+ _intro = intro ? note(intro) : nil;
+ _footer = footer ? note(footer) : nil;
+ return self;
+}
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+ self.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;
+ self.tableView.backgroundColor = [UIColor colorWithWhite:0x12 / 255.0 alpha:1];
+ self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
+ self.tableView.tableHeaderView = _intro;
+ self.tableView.tableFooterView = _footer;
+}
+
+- (void)viewWillLayoutSubviews {
+ [super viewWillLayoutSubviews];
+ if (_intro) fitNote(self.tableView, _intro, 24, 8);
+ if (_footer) fitNote(self.tableView, _footer, 16, 24);
+}
+
+- (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section {
+ return (NSInteger)_rows.count;
+}
+
+- (UITableViewCell *)tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)path {
+ UITableViewCell *cell = [table dequeueReusableCellWithIdentifier:@"row"]
+ ?: [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"row"];
+ SGModRow *row = _rows[(NSUInteger)path.row];
+
+ UIListContentConfiguration *content = [UIListContentConfiguration subtitleCellConfiguration];
+ content.text = row.title;
+ content.secondaryText = row.subtitle;
+ content.textProperties.font = titleFont();
+ content.textProperties.color = UIColor.whiteColor;
+ content.secondaryTextProperties.font = subtitleFont();
+ content.secondaryTextProperties.color = grey();
+ content.textToSecondaryTextVerticalPadding = 0;
+ content.directionalLayoutMargins = NSDirectionalEdgeInsetsMake(10, 16, 10, 16);
+ cell.contentConfiguration = content;
+ cell.backgroundColor = UIColor.clearColor;
+
+ 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.tag = path.row;
+ [toggle addTarget:self action:@selector(toggled:) forControlEvents:UIControlEventValueChanged];
+ cell.accessoryView = toggle;
+ cell.selectionStyle = UITableViewCellSelectionStyleNone;
+ } else {
+ cell.accessoryView = symbol(@"chevron.right", 13, UIImageSymbolWeightSemibold, 16);
+ cell.selectionStyle = UITableViewCellSelectionStyleDefault;
+ }
+ return cell;
+}
+
+- (void)tableView:(UITableView *)table didSelectRowAtIndexPath:(NSIndexPath *)path {
+ SGModRow *row = _rows[(NSUInteger)path.row];
+ if (row.page) [self.navigationController pushViewController:row.page() animated:YES];
+}
+
+- (void)toggled:(UISwitch *)toggle {
+ SGSetEnabled(_rows[(NSUInteger)toggle.tag].key, toggle.on);
+}
+
+@end
+
+static UIViewController *uiTweaksPage(void) {
+ return [[SGModPage alloc] initWithTitle:@"UI Tweaks" intro:@"Changes apply after you restart Spotify." rows:@[
+ switchRow(@"Now playing bar", @"Glass card with round artwork", SGKeyNowPlayingBar),
+ switchRow(@"Tab bar", @"Glass pill behind the tabs, no labels", SGKeyTabBar),
+ switchRow(@"Player controls", @"Glass behind the buttons of the full screen player", SGKeyPlayer),
+ switchRow(@"Search field", @"Glass capsule instead of the white field", SGKeySearchField),
+ switchRow(@"Spotify's own Liquid Glass", @"Turns on the glass navigation bar Spotify ships switched off", SGKeySpotifyGlass),
+ switchRow(@"AMOLED background", @"Pure black instead of Spotify's dark grey", SGKeyAmoled),
+ ] footer:nil];
+}
+
+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(); }),
+ ] footer:about];
+}
+
+#pragma mark - row in the settings list
+
+@interface SGModSettingsRow : UIControl
+@end
+
+@implementation SGModSettingsRow {
+ UIImageView *_icon;
+ UILabel *_title;
+ UILabel *_subtitle;
+ UIImageView *_chevron;
+}
+
+- (instancetype)initWithFrame:(CGRect)frame {
+ if (!(self = [super initWithFrame:frame])) return nil;
+ _icon = symbol(@"slider.horizontal.3", 20, UIImageSymbolWeightRegular, 24);
+ _title = [UILabel new];
+ _title.text = @"Mod Settings";
+ _title.textColor = UIColor.whiteColor;
+ _subtitle = [UILabel new];
+ _subtitle.text = @"UI Tweaks";
+ _subtitle.textColor = grey();
+ _chevron = symbol(@"chevron.right", 11, UIImageSymbolWeightSemibold, 12);
+ for (UIView *v in @[_icon, _title, _subtitle, _chevron]) [self addSubview:v];
+ [self addTarget:self action:@selector(open) forControlEvents:UIControlEventTouchUpInside];
+ return self;
+}
+
+- (void)layoutSubviews {
+ [super layoutSubviews];
+ _title.font = titleFont();
+ _subtitle.font = subtitleFont();
+ CGFloat width = self.bounds.size.width;
+ _icon.frame = CGRectMake(12, 16, 24, 24);
+ _title.frame = CGRectMake(48, 9, width - 96, 18);
+ _subtitle.frame = CGRectMake(48, 31, width - 96, 16);
+ _chevron.frame = CGRectMake(width - 24, 22, 12, 12);
+}
+
+- (void)setHighlighted:(BOOL)highlighted {
+ [super setHighlighted:highlighted];
+ self.alpha = highlighted ? 0.5 : 1;
+}
+
+- (void)open {
+ UIViewController *owner = nil;
+ for (UIResponder *r = self; r && !owner; r = r.nextResponder) {
+ if ([r isKindOfClass:UIViewController.class]) owner = (UIViewController *)r;
+ }
+ UIViewController *page = modSettingsPage();
+ if (owner.navigationController) [owner.navigationController pushViewController:page animated:YES];
+ else [owner presentViewController:[[UINavigationController alloc] initWithRootViewController:page] animated:YES completion:nil];
+}
+
+@end
+
+static CGFloat brightness(UIColor *color) {
+ CGFloat white = 0;
+ [color getWhite:&white alpha:NULL];
+ return white;
+}
+
+// Spotify's list labels carry its typeface: 13pt titles and 11pt grey subtitles.
+static void captureFonts(UIView *list, UIView *row) {
+ SGForEachView(list, ^(UIView *v) {
+ if (![v isKindOfClass:UILabel.class] || SGIsInside(v, row)) return;
+ UILabel *label = (UILabel *)v;
+ if (label.text.length < 2) return;
+ CGFloat size = label.font.pointSize, white = brightness(label.textColor);
+ if (size == 13 && !sg_titleFont) sg_titleFont = label.font;
+ if (size == 11 && !sg_subtitleFont && white > 0.3 && white < 0.95) sg_subtitleFont = label.font;
+ });
+}
+
+static void placeRow(UICollectionView *list, SGModSettingsRow *row) {
+ if (!sg_titleFont || !sg_subtitleFont) captureFonts(list, row);
+ CGFloat bottom = list.contentSize.height;
+ row.hidden = bottom <= 0;
+ row.frame = CGRectMake(0, bottom, list.bounds.size.width, kRowHeight);
+
+ // Room to scroll to the row, added again whenever Spotify resets the inset.
+ UIEdgeInsets inset = list.contentInset;
+ NSValue *applied = objc_getAssociatedObject(list, &kInsetKey);
+ if (applied && UIEdgeInsetsEqualToEdgeInsets(inset, applied.UIEdgeInsetsValue)) return;
+ inset.bottom += kRowHeight;
+ objc_setAssociatedObject(list, &kInsetKey, [NSValue valueWithUIEdgeInsets:inset], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+ list.contentInset = inset;
+}
+
+%hook _TtC21Settings_PlatformImpl26SettingsListViewController
+- (void)viewDidLayoutSubviews {
+ %orig;
+ for (UIView *sub in ((UIViewController *)self).view.subviews) {
+ if (![sub isKindOfClass:UICollectionView.class] || objc_getAssociatedObject(sub, &kRowKey)) continue;
+ SGModSettingsRow *row = [[SGModSettingsRow alloc] initWithFrame:CGRectZero];
+ objc_setAssociatedObject(sub, &kRowKey, row, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+ [sub addSubview:row];
+ }
+}
+%end
+
+// The list lays out after its controller and again whenever its content changes.
+%hook UICollectionView
+- (void)layoutSubviews {
+ %orig;
+ SGModSettingsRow *row = objc_getAssociatedObject(self, &kRowKey);
+ if (row) placeRow(self, row);
+}
+%end
+
+%ctor {
+ %init;
+ SGRequireClasses(@[@"_TtC21Settings_PlatformImpl26SettingsListViewController"]);
+}
diff --git a/tweak/src/ui/TabBar.x b/tweak/src/ui/TabBar.x
index eb4762de..308038f2 100644
--- a/tweak/src/ui/TabBar.x
+++ b/tweak/src/ui/TabBar.x
@@ -23,6 +23,7 @@ static NSArray<UIView *> *tabItems(UIView *tabBar) {
}
static void styleTabBar(UIView *tabBar) {
+ if (!SGEnabled(SGKeyTabBar)) return;
sg_tabBarRoot = tabBar;
SGStripBackgrounds(tabBar);
tabBar.superview.layer.backgroundColor = NULL;
@@ -53,6 +54,7 @@ static void styleTabBar(UIView *tabBar) {
// Items lay out their own icon and label, after the bar; hide the label, centre the icon, then
// restyle the bar, whose own pass ran before the items had frames.
static void styleTabItem(UIView *item) {
+ if (!SGEnabled(SGKeyTabBar)) return;
CGFloat midY = CGRectGetMidY(item.bounds);
SGForEachView(item, ^(UIView *v) {
if ([v isKindOfClass:UILabel.class]) {