Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.
C
fix: a settings section whose rows all hide takes its heading and note with it
My-Name-Is-Jeff1239d0ab3fda
diff --git a/harness/mod-settings/README.md b/harness/mod-settings/README.mdindex cf6b8f07..75583559 100644--- a/harness/mod-settings/README.md+++ b/harness/mod-settings/README.md@@ -15,6 +15,17 @@ Make a simulator of your own (`xcrun simctl create`) and address it by UDID. `ma(`redesign`, `warning`, `keep`) and the actions: `toggle=<section>.<row>` flips a switch the way a tap does,`cancel` closes the alert it brings up, `bottom` scrolls to the end, and `dump` logs the rows of every section.+`gated` pushes a page of `SGModPage` itself: a switch over ten rows, then a section with a heading and a note+whose twelve rows show only while the switch is on, then a row that `later` lets come by itself. `layout` logs+the scroll offset and each section's rows, heading and note heights; `top` scrolls back up.++ xcrun simctl launch --console-pty <udid> com.vitrine.modsettingsharness gated layout toggle=0.0 layout later dump layout top toggle=0.0 layout++2026-10-06, iPhone 17 Pro on iOS 27.0: with the switch off the gated section has 0 pt of heading and note; the+switch brings it in with its 38 pt heading and 28 pt note and scrolls 362 pt, half the 724 pt of room; the+ticker brings the later row within a second without moving the page; the switch off takes the heading and note+away again.+2026-10-06, iPhone 17 Pro on iOS 27.0: the warning row leads; then Redesigned UI (glowing, with its ⓘ), Appearanceand Tab bar; Player, Lyrics and Albums & artists (Home & Library in the native look); Sing, Spatial voice, Audioeffects, Vibrations, Live Activity, AirPods gestures and Listening stats; Lock screen and Premium, ads & privacy; Labs anddiff --git a/harness/mod-settings/main.m b/harness/mod-settings/main.mindex dd15e38b..e4df30db 100644--- a/harness/mod-settings/main.m+++ b/harness/mod-settings/main.m@@ -10,7 +10,10 @@// look stays; otherwise it is cleared first).// Actions: toggle=<section>.<row> (that row's switch flipped the way a tap does), cancel (the alert that// switch brings up closed with Later), bottom (scrolled to the end), dump (the rows of each section and-// what each reads beside its chevron, to the log).+// what each reads beside its chevron, to the log), gated (a page of a switch, ten rows, a headed and noted+// section of twelve rows shown only while the switch is on, and a row that comes by itself), later (that row+// let come; the page's ticker brings it), top (scrolled to the start), layout (the scroll offset, and each+// section's rows and heading and note heights, to the log).#import <UIKit/UIKit.h>#import "Core/SGCore.h"#import "Settings/SGPage.h"@@ -27,6 +30,29 @@ static void findViews(UIView *root, Class kind, NSMutableArray *found) {for (UIView *sub in root.subviews) findViews(sub, kind, found);}+// The `gated` page: a switch, ten rows of filler, then a headed and noted section whose twelve rows show only+// while the switch is on, and a row that comes by itself once `later` is played.+static BOOL sg_later;+static NSString *const kGate = @"spotifyglass.harness.gate";++static UIViewController *gatedPage(void) {+ SGSetEnabled(kGate, NO);+ NSMutableArray<SGModRow *> *filler = [NSMutableArray array], *gated = [NSMutableArray array];+ for (int i = 0; i < 10; i++) [filler addObject:SGStatRow([NSString stringWithFormat:@"Filler %d", i + 1], ^NSString *{ return @"-"; })];+ for (int i = 0; i < 12; i++) {+ SGModRow *row = SGStatRow([NSString stringWithFormat:@"Gated %d", i + 1], ^NSString *{ return @"on"; });+ row.visible = ^BOOL { return SGFlag(kGate, NO); };+ [gated addObject:row];+ }+ SGModRow *later = SGStatRow(@"Came by itself", ^NSString *{ return @"later"; });+ later.visible = ^BOOL { return sg_later; };+ return [[SGModPage alloc] initWithTitle:@"Gated" intro:nil sections:@[+ SGSection(@"Gate", [@[SGOptionRow(@"Show the gated rows", nil, kGate)] arrayByAddingObjectsFromArray:filler]),+ SGNotedSection(@"Gated", gated, @"A note under the gated rows, which goes with them."),+ SGSection(@"Later", @[later]),+ ] footer:nil];+}+@interface AppDelegate : UIResponder <UIApplicationDelegate>@property (nonatomic, strong) UIWindow *window;@property (nonatomic, strong) UINavigationController *nav;@@ -94,6 +120,19 @@ static void findViews(UIView *root, Class kind, NSMutableArray *found) {[alert dismissViewControllerAnimated:YES completion:nil];} else if ([verb isEqualToString:@"bottom"]) {[table setContentOffset:CGPointMake(0, MAX(-table.adjustedContentInset.top, table.contentSize.height - table.bounds.size.height + table.adjustedContentInset.bottom)) animated:NO];+ } else if ([verb isEqualToString:@"gated"]) {+ [self.nav pushViewController:gatedPage() animated:NO];+ } else if ([verb isEqualToString:@"top"]) {+ [table setContentOffset:CGPointMake(0, -table.adjustedContentInset.top) animated:NO];+ } else if ([verb isEqualToString:@"later"]) {+ sg_later = YES;+ } else if ([verb isEqualToString:@"layout"]) {+ UIEdgeInsets inset = table.adjustedContentInset;+ NSLog(@"[harness] offset %.0f of room %.0f", table.contentOffset.y + inset.top, table.bounds.size.height - inset.top - inset.bottom);+ for (NSInteger section = 0; section < table.numberOfSections; section++) {+ NSLog(@"[harness] section %ld: %ld rows, heading %.0f pt, note %.0f pt", (long)section, (long)[table numberOfRowsInSection:section],+ [table rectForHeaderInSection:section].size.height, [table rectForFooterInSection:section].size.height);+ }} else if ([verb isEqualToString:@"dump"]) {NSLog(@"[harness] Redesigned UI stored %d", SGRedesignedUIStored());for (NSInteger section = 0; section < table.numberOfSections; section++) {diff --git a/harness/mod-settings/stubs.m b/harness/mod-settings/stubs.mindex 7a370ef0..ce61c4cc 100644--- a/harness/mod-settings/stubs.m+++ b/harness/mod-settings/stubs.m@@ -45,3 +45,5 @@ NSArray<SGModRow *> *SGEnvironmentWarningRows(void) {if (!SGHarnessWarning) return @[];return @[SGWarningRow(@"EeveeSpotify is injected too", @"Tap to see what that changes", ^{})];}+// The Lyrics page's Romanised lyrics row (Shared/Lyrics/Romanise.m).+SGModRow *SGLyricsRomanisedRow(void) { return SGOptionRow(@"Romanised lyrics", nil, @"spotifyglass.harness.romanised"); }diff --git a/tweak/Sources/Settings/SGModPage.m b/tweak/Sources/Settings/SGModPage.mindex 5dccfd30..7cd27f29 100644--- a/tweak/Sources/Settings/SGModPage.m+++ b/tweak/Sources/Settings/SGModPage.m@@ -414,6 +414,8 @@ static UIFont *tabular(UIFont *font) {@interface SGModSliderCell : UITableViewCell+ (CGFloat)heightFor:(SGModRow *)row;- (void)showRow:(SGModRow *)row;+// The number again, after something else on the page changed it (a Reset row); never under a finger.+- (void)readNumber;@end@implementation SGModSliderCell {@@ -512,6 +514,15 @@ static CGFloat subtitleLine(void) { return ceil(SGSubtitleFont().lineHeight); }[_slider setValue:(float)_shown animated:YES];}+- (void)readNumber {+ if (!_row.number || _slider.isTracking) return;+ double value = snapped(_row, _row.number());+ if (value == _shown) return;+ _shown = value;+ [_slider setValue:(float)value animated:YES];+ [self showValue];+}+@end#pragma mark - rows waiting on a switch@@ -562,9 +573,10 @@ static void showWaiting(UITableViewCell *cell, BOOL waiting, NSString *switchTit_shown = [self rowsToShow];_intro = intro ? SGNote(intro) : nil;_footer = footer ? SGNote(footer) : nil;- // Any row with a value keeps a ticker running: a page row's can move while the page shows (a download's- // percentage beside the chevron).- for (SGModSection *s in sections) for (SGModRow *row in s.rows) _live |= row.value != nil;+ // Any row with a value, a test of when it shows, a number or a menu keeps a ticker running: a page row's+ // value can move while the page shows (a download's percentage beside the chevron), a row can come or go+ // by itself (a download that finished brings its Remove row), and a Reset row can move a slider.+ for (SGModSection *s in sections) for (SGModRow *row in s.rows) _live |= row.value || row.visible || row.number;return self;}@@ -579,14 +591,27 @@ static void showWaiting(UITableViewCell *cell, BOOL waiting, NSString *switchTit}// The rows that are to show now fade in where they sit and the others fade out, and whatever came in is-// scrolled into view: it opens under the switch that brought it, which may be the page's last row. Answers-// whether anything moved; `done` runs once it has, and only then.+// scrolled toward, by half a screen at most: it opens under the switch that brought it, which may be the page's+// last row, and a long run of rows does not carry the page far from that switch. A section whose rows all go takes its heading and note with it, and+// they come back with its first row, so the whole section is faded rather than its rows. Answers whether+// anything moved; `done` runs once it has, and only then.- (BOOL)showRowsThen:(void (^)(void))done {+ return [self showRows:YES then:done];+}++// The same, scrolling only when `scroll`: rows that come by themselves do not move the page under the eye.+- (BOOL)showRows:(BOOL)scroll then:(void (^)(void))done {NSArray<NSArray<SGModRow *> *> *next = [self rowsToShow];if ([next isEqualToArray:_shown]) return NO;NSMutableArray<NSIndexPath *> *gone = [NSMutableArray array], *coming = [NSMutableArray array];+ NSMutableIndexSet *flipped = [NSMutableIndexSet indexSet];[_sections enumerateObjectsUsingBlock:^(SGModSection *s, NSUInteger section, BOOL *stop) {NSArray<SGModRow *> *before = self->_shown[section], *after = next[section];+ if ((before.count == 0) != (after.count == 0)) {+ [flipped addIndex:section];+ for (NSUInteger i = 0; i < after.count; i++) [coming addObject:[NSIndexPath indexPathForRow:(NSInteger)i inSection:(NSInteger)section]];+ return;+ }[before enumerateObjectsUsingBlock:^(SGModRow *row, NSUInteger i, BOOL *stop) {if (![after containsObject:row]) [gone addObject:[NSIndexPath indexPathForRow:(NSInteger)i inSection:(NSInteger)section]];}];@@ -594,24 +619,41 @@ static void showWaiting(UITableViewCell *cell, BOOL waiting, NSString *switchTitif (![before containsObject:row]) [coming addObject:[NSIndexPath indexPathForRow:(NSInteger)i inSection:(NSInteger)section]];}];}];+ NSPredicate *notFlipped = [NSPredicate predicateWithBlock:^BOOL(NSIndexPath *path, NSDictionary *bindings) {+ return ![flipped containsIndex:(NSUInteger)path.section];+ }];UITableView *table = self.tableView;[table performBatchUpdates:^{self->_shown = next;- [table deleteRowsAtIndexPaths:gone withRowAnimation:UITableViewRowAnimationFade];- [table insertRowsAtIndexPaths:coming withRowAnimation:UITableViewRowAnimationFade];+ // A section is reloaded whole, or its rows moved, never both in one batch.+ [table reloadSections:flipped withRowAnimation:UITableViewRowAnimationFade];+ [table deleteRowsAtIndexPaths:[gone filteredArrayUsingPredicate:notFlipped] withRowAnimation:UITableViewRowAnimationFade];+ [table insertRowsAtIndexPaths:[coming filteredArrayUsingPredicate:notFlipped] withRowAnimation:UITableViewRowAnimationFade];} completion:^(BOOL finished) {- if (coming.count) {+ if (scroll && coming.count) {CGRect rows = CGRectNull;for (NSIndexPath *path in coming) rows = CGRectUnion(rows, [table rectForRowAtIndexPath:path]);- CGFloat room = table.bounds.size.height - table.adjustedContentInset.top - table.adjustedContentInset.bottom;- rows.size.height = MIN(rows.size.height, room);- [table scrollRectToVisible:rows animated:YES];+ [self scrollToward:rows];}if (done) done();}];return YES;}+// By as much as brings `rows` into view, but half the room at most either way, and never past the content.+- (void)scrollToward:(CGRect)rows {+ UITableView *table = self.tableView;+ UIEdgeInsets inset = table.adjustedContentInset;+ CGFloat room = table.bounds.size.height - inset.top - inset.bottom;+ CGFloat top = table.contentOffset.y + inset.top, bottom = top + room, move = 0;+ if (CGRectGetMaxY(rows) > bottom) move = MIN(CGRectGetMaxY(rows) - bottom, CGRectGetMinY(rows) - top);+ else if (CGRectGetMinY(rows) < top) move = CGRectGetMinY(rows) - top;+ move = MAX(-room / 2, MIN(move, room / 2));+ CGFloat most = MAX(-inset.top, table.contentSize.height + inset.bottom - table.bounds.size.height);+ CGFloat y = MAX(-inset.top, MIN(table.contentOffset.y + move, most));+ if (fabs(y - table.contentOffset.y) >= 1) [table setContentOffset:CGPointMake(table.contentOffset.x, y) animated:YES];+}+- (void)refreshVisibility {[self showRowsThen:nil];}@@ -723,7 +765,23 @@ static void showWaiting(UITableViewCell *cell, BOOL waiting, NSString *switchTit// that a reload never lands under a switch being dragged. A cancelled back swipe appears the// page again without it ever disappearing, so the old timer goes first.[_ticker invalidate];- _ticker = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(readValues) userInfo:nil repeats:YES];+ _ticker = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(tick) userInfo:nil repeats:YES];+}++// Each second: the rows that come and go by themselves, then every value, slider and menu in view.+- (void)tick {+ [self showRows:NO then:nil];+ [self readValues];+ for (UITableViewCell *cell in self.tableView.visibleCells) {+ NSIndexPath *path = [self.tableView indexPathForCell:cell];+ if (!path) continue;+ SGModRow *row = [self rowAt:path];+ if ([cell isKindOfClass:SGModSliderCell.class]) [(SGModSliderCell *)cell readNumber];+ UIButton *menu = (UIButton *)cell.accessoryView;+ if (row.menu && [menu isKindOfClass:UIButton.class] && ![menu.accessibilityValue isEqualToString:row.value()] && !menu.isTracking) {+ cell.accessoryView = [self menuButtonFor:row];+ }+ }}- (void)viewDidDisappear:(BOOL)animated {@@ -734,6 +792,7 @@ static void showWaiting(UITableViewCell *cell, BOOL waiting, NSString *switchTit- (void)readValues {for (UITableViewCell *cell in self.tableView.visibleCells) {+ if (![self.tableView indexPathForCell:cell]) continue; // a row fading outSGModRow *row = [self rowAt:[self.tableView indexPathForCell:cell]];if (row.page && row.value) {// valueAndChevron is sized to its text, so a new text gets a new one.@@ -774,23 +833,29 @@ static void showWaiting(UITableViewCell *cell, BOOL waiting, NSString *switchTitreturn row.number ? [SGModSliderCell heightFor:row] : UITableViewAutomaticDimension;}+// A section with no row showing has no heading, note or gap: they would sit over no card.+- (BOOL)isEmpty:(NSInteger)section {+ return _shown[(NSUInteger)section].count == 0;+}+- (UIView *)tableView:(UITableView *)table viewForHeaderInSection:(NSInteger)section {NSString *title = _sections[(NSUInteger)section].title;- return title ? SGSectionHeader(table, title) : nil;+ return title && ![self isEmpty:section] ? SGSectionHeader(table, title) : nil;}- (CGFloat)tableView:(UITableView *)table heightForHeaderInSection:(NSInteger)section {+ if ([self isEmpty:section]) return CGFLOAT_MIN;return _sections[(NSUInteger)section].title ? SGSectionHeaderHeight : SGSectionGap;}- (UIView *)tableView:(UITableView *)table viewForFooterInSection:(NSInteger)section {NSString *footer = _sections[(NSUInteger)section].footer;- return footer ? SGSectionFooter(table, footer) : nil;+ return footer && ![self isEmpty:section] ? SGSectionFooter(table, footer) : nil;}- (CGFloat)tableView:(UITableView *)table heightForFooterInSection:(NSInteger)section {NSString *footer = _sections[(NSUInteger)section].footer;- return footer ? SGSectionFooterHeight(table, footer) : CGFLOAT_MIN;+ return footer && ![self isEmpty:section] ? SGSectionFooterHeight(table, footer) : CGFLOAT_MIN;}- (UITableViewCell *)tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)path {