Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.
C
fix: the now playing bar stays clear of the tab bar on a phone with a home button and under Offline or Private Session
Vojtěch Škopek927b1c6a4b92
diff --git a/docs/tweaks.md b/docs/tweaks.mdindex 27990c65..d7f0c01c 100644--- a/docs/tweaks.md+++ b/docs/tweaks.md@@ -117,7 +117,10 @@ Redesigned:Kit/ what the redesign builds on (SGRKit.h lists it), the flags it forces (SGRedesign.h, SGRGlassDesign.x forSpotify'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+ Navbar/ the glass tab bar (TabBar.x) over its own composition (Navbar.x, NavbarLayout.m) and editor, the glass search field.+ Spotify is made to leave the glass bar its height where its own bar is shorter (a phone with a home button,+ Offline or Private Session under the bar), so the now playing bar and the pages move up with it. Laid out on+ the Mac against harness/tabbar/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), and in its more menu Speed and pitch:diff --git a/harness/tabbar/README.md b/harness/tabbar/README.mdnew file mode 100644index 00000000..1e31b16c--- /dev/null+++ b/harness/tabbar/README.md@@ -0,0 +1,47 @@+# Tab bar harness++The bottom of Spotify's main screen mocked under its own class names, so `Redesigned/Navbar/TabBar.x`+and `Redesigned/NowPlayingBar/NowPlayingBar.x` run for real over it on the Mac without the phone: the+tab bar container with Spotify's bar and its row of tabs, a page with a list on the tab's stack, the+now playing bar's page with its card, and Spotify's message bar (`LimitedExperienceIndicatorBar`, what+Offline and Private Session show) under the tab bar. It plays issue #33.++ THEOS=$HOME/theos ./build.sh+ xcrun simctl install <udid> build/TabBarHarness.app+ xcrun simctl launch <udid> com.vojta.tabbarharness shown+ xcrun simctl io <udid> screenshot shot.png++`build.sh` runs `logos.pl -c generator=internal` over `TabBar.x` and `NowPlayingBar.x` from the+checkout it sits in and links them with the real `Core/` and `SGRTokens.m`; `SRC=<other tweak/Sources>+./build.sh` builds an older tree instead, to compare. `stubs.m` stands in for the accent and repaint+hooks, the tab bar's composition and Mod Settings. iOS 27 ends an app with no scene delegate at+launch, so the harness has one.++The layout is the one 9.1.78 makes in a compact width, with the addresses it was read from:++- `TabBarContainerImpl`'s view has a guide from 49 pt above its safe area's bottom to its bottom+ (`viewDidLoad`, 0x1008409a8); the stack holding the tab bar is as tall as the guide and stands on+ the view's bottom, and the tab bar is as tall as the stack (0x106fabb7c).+- The page on the tab's stack gets 49 pt of safe area on top of the container's (0x10707bde4). The now+ playing bar's share of the pages' inset comes another way in Spotify; here it is a stand-in of 64 pt+ on the page, so the list's end marks where Spotify thinks the bars begin.+- The chrome puts the tab bar container above the message bar, and the now playing bar's page (64 pt,+ its content 8 pt above its bottom, 0x105345190) on the container's guide's top, which is the bottom+ anchor `MainUIContainer` gives the chrome (0x100ae0178).+- The message bar is its message plus the safe area it pads the message by, 22 pt here.++Launch words: `none` no message bar; `shown` one sliding in at 1.5 s; `away` one there from the start,+sliding away at 1.5 s; `cycle` in at 1.5 s and out at 4.5 s, for a recording. At 2.5 s everything is+logged in window points, with the gap between the bottom of the now playing card and the top of the+glass bar's platter (8 pt is the redesign's own, on a Face ID phone with nothing under the bar), and+half way through a slide what the screen shows of the message bar, the tab bar and the now playing bar:++ xcrun simctl spawn <udid> log show --last 1m --style compact --predicate 'eventMessage CONTAINS "[harness]" OR eventMessage CONTAINS "tab bar:"'++Before the fix the gap was -26 pt with nothing under the bar on an iPhone SE, and with the message bar+up on any phone: UIKit's glass bar is 83 pt, Spotify's bar was its 49 pt row with no inset under it,+and the glass bar stood the difference above it, over the now playing bar.++What it does not cover: Spotify's own chrome, which is Swift with no symbols (the constraints above+are read from its code, not run), the real now playing bar's content and its page's inset, the tab+bar hidden by a page, the player's open and close over the bars, and a regular width.diff --git a/harness/tabbar/build.sh b/harness/tabbar/build.shnew file mode 100755index 00000000..ee2db19f--- /dev/null+++ b/harness/tabbar/build.sh@@ -0,0 +1,49 @@+#!/bin/sh+set -e+# The sources of the checkout this harness sits in, unless SRC names others (an older tree, to compare).+SRC=${SRC:-$(cd "$(dirname "$0")/../../tweak/Sources" && pwd)}+OUT=$(dirname "$0")/build+rm -rf "$OUT"; mkdir -p "$OUT/gen" "$OUT/TabBarHarness.app"++for f in Redesigned/Navbar/TabBar.x Redesigned/NowPlayingBar/NowPlayingBar.x; do+ name=$(basename "$f" .x)+ "$THEOS/bin/logos.pl" -c generator=internal "$SRC/$f" > "$OUT/gen/$name.m"+done++SDK=$(xcrun --sdk iphonesimulator --show-sdk-path)+xcrun -sdk iphonesimulator clang -target arm64-apple-ios17.0-simulator -fobjc-arc -g -O0 \+ -I"$SRC" -I"$SRC/Redesigned/Navbar" -I"$SRC/Redesigned/NowPlayingBar" -I"$OUT/gen" -isysroot "$SDK" \+ -Wno-deprecated-declarations \+ "$(dirname "$0")/main.m" "$(dirname "$0")/stubs.m" \+ "$OUT"/gen/*.m \+ "$SRC"/Core/SGLog.m "$SRC"/Core/SGPrefs.m "$SRC"/Core/SGViewTree.m "$SRC"/Core/SGGlass.m \+ "$SRC"/Core/SGBackdrop.m "$SRC"/Core/SGFlagForce.m "$SRC"/Core/SGUIMode.m \+ "$SRC"/Redesigned/Kit/SGRTokens.m \+ -framework UIKit -framework QuartzCore -framework CoreGraphics -framework Foundation \+ -o "$OUT/TabBarHarness.app/TabBarHarness"++# iOS 27 ends an app without a scene delegate at launch, so the scene is named here.+cat > "$OUT/TabBarHarness.app/Info.plist" <<'PLIST'+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">+<plist version="1.0"><dict>+<key>CFBundleExecutable</key><string>TabBarHarness</string>+<key>CFBundleIdentifier</key><string>com.vojta.tabbarharness</string>+<key>CFBundleName</key><string>TabBarHarness</string>+<key>CFBundleVersion</key><string>1</string>+<key>CFBundleShortVersionString</key><string>1.0</string>+<key>UIUserInterfaceStyle</key><string>Dark</string>+<key>UILaunchScreen</key><dict/>+<key>UIApplicationSceneManifest</key><dict>+ <key>UIApplicationSupportsMultipleScenes</key><false/>+ <key>UISceneConfigurations</key><dict>+ <key>UIWindowSceneSessionRoleApplication</key><array><dict>+ <key>UISceneConfigurationName</key><string>Default</string>+ <key>UISceneDelegateClassName</key><string>SGHarnessScene</string>+ </dict></array>+ </dict>+</dict>+</dict></plist>+PLIST+codesign -f -s - "$OUT/TabBarHarness.app" >/dev/null 2>&1+echo "built $OUT/TabBarHarness.app"diff --git a/harness/tabbar/main.m b/harness/tabbar/main.mnew file mode 100644index 00000000..15c13f91--- /dev/null+++ b/harness/tabbar/main.m@@ -0,0 +1,422 @@+// Tab bar harness: TabBar.x and NowPlayingBar.x run for real on a mock of the bottom of Spotify's main+// screen, laid out with the constraints 9.1.78 makes (see the README for the addresses), under Spotify's+// class names, with Spotify's message bar (Offline, Private Session) able to come in under the tab bar.+#import <UIKit/UIKit.h>++#pragma mark - Spotify's classes, by the names the hooks look for++@interface _TtC23NavigationUI_TabBarImpl10TabBarView : UIView+@end+@implementation _TtC23NavigationUI_TabBarImpl10TabBarView+@end++@interface _TtC23NavigationUI_TabBarImpl17TabBarCompactView : UIView+@end+@implementation _TtC23NavigationUI_TabBarImpl17TabBarCompactView+@end++@interface _TtC23NavigationUI_TabBarImpl21TabBarItemElementView : UIView+@end+@implementation _TtC23NavigationUI_TabBarImpl21TabBarItemElementView+@end++@interface _TtC25CreateMenu_TabBarItemImpl24CreateMenuTabBarItemView : UIView+@end+@implementation _TtC25CreateMenu_TabBarItemImpl24CreateMenuTabBarItemView+@end++@interface _TtC44LimitedExperienceIndicator_MessageBarRuntime29LimitedExperienceIndicatorBar : UIView+@end+@implementation _TtC44LimitedExperienceIndicator_MessageBarRuntime29LimitedExperienceIndicatorBar+@end++@interface _TtC22NowPlaying_BarPageImplP33_CCC0D2EEA6D4725EECD8965E8C38C86D20TouchPassthroughView : UIView+@end+@implementation _TtC22NowPlaying_BarPageImplP33_CCC0D2EEA6D4725EECD8965E8C38C86D20TouchPassthroughView+@end++@interface _TtC18NowPlaying_BarImpl27NowPlayingBarViewController : UIViewController+@end+@implementation _TtC18NowPlaying_BarImpl27NowPlayingBarViewController+- (void)loadView {+ self.view = [UIView new];+ // The card, 386x56 at {8,0} with the album colour, the artwork, two lines and the progress line+ // (trees/clean/home/01.txt, SPTNowPlayingBar).+ UIView *card = [UIView new];+ card.accessibilityIdentifier = @"SPTNowPlayingBar";+ card.backgroundColor = [UIColor colorWithRed:0x18 / 255.0 green:0x14 / 255.0 blue:0x1C / 255.0 alpha:1];+ card.layer.cornerRadius = 8;+ card.clipsToBounds = YES;+ card.translatesAutoresizingMaskIntoConstraints = NO;+ [self.view addSubview:card];+ [NSLayoutConstraint activateConstraints:@[+ [card.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor],+ [card.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor],+ [card.topAnchor constraintEqualToAnchor:self.view.topAnchor],+ [card.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor],+ ]];+ UIView *art = [[UIView alloc] initWithFrame:CGRectMake(8, 8, 40, 40)];+ art.layer.cornerRadius = 4;+ art.clipsToBounds = YES;+ UIImageView *image = [[UIImageView alloc] initWithFrame:art.bounds];+ image.backgroundColor = [UIColor colorWithRed:0.85 green:0.35 blue:0.55 alpha:1];+ [art addSubview:image];+ [card addSubview:art];+ UILabel *title = [UILabel new], *artist = [UILabel new];+ title.text = @"Stay High";+ title.font = [UIFont boldSystemFontOfSize:13];+ title.textColor = UIColor.whiteColor;+ artist.text = @"Juice WRLD";+ artist.font = [UIFont systemFontOfSize:13];+ artist.textColor = [UIColor colorWithWhite:0.7 alpha:1];+ UIStackView *lines = [[UIStackView alloc] initWithArrangedSubviews:@[title, artist]];+ lines.axis = UILayoutConstraintAxisVertical;+ lines.frame = CGRectMake(56, 8, 200, 40);+ [card addSubview:lines];+ UIButton *play = [UIButton systemButtonWithImage:[UIImage systemImageNamed:@"play.fill"] target:nil action:nil];+ play.tintColor = UIColor.whiteColor;+ play.frame = CGRectMake(330, 12, 32, 32);+ play.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;+ [card addSubview:play];+ UIView *progress = [[UIView alloc] initWithFrame:CGRectMake(8, 54, 370, 2)];+ progress.backgroundColor = UIColor.whiteColor;+ [card addSubview:progress];+}+@end++@interface _TtC18NowPlaying_BarImpl36NowPlayingBarContainerViewController : UIViewController+@end+@implementation _TtC18NowPlaying_BarImpl36NowPlayingBarContainerViewController+- (void)viewDidLoad {+ [super viewDidLoad];+ UIViewController *bar = [_TtC18NowPlaying_BarImpl27NowPlayingBarViewController new];+ [self addChildViewController:bar];+ bar.view.translatesAutoresizingMaskIntoConstraints = NO;+ [self.view addSubview:bar.view];+ [NSLayoutConstraint activateConstraints:@[+ [bar.view.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor constant:8],+ [bar.view.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor constant:-8],+ [bar.view.topAnchor constraintEqualToAnchor:self.view.topAnchor],+ [bar.view.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor],+ ]];+ [bar didMoveToParentViewController:self];+}+@end++// A page on the tab's stack: a list, inset the way Spotify's pages are, by the safe area it inherits.+@interface SGHarnessPage : UITableViewController+@end+@implementation SGHarnessPage+- (void)viewDidLoad {+ [super viewDidLoad];+ self.tableView.backgroundColor = UIColor.blackColor;+ self.tableView.rowHeight = 48;+ [self.tableView registerClass:UITableViewCell.class forCellReuseIdentifier:@"row"];+}+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 30; }+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)path {+ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"row" forIndexPath:path];+ cell.backgroundColor = path.row == 29 ? [UIColor colorWithRed:0.1 green:0.3 blue:0.6 alpha:1] : UIColor.blackColor;+ cell.textLabel.textColor = UIColor.whiteColor;+ cell.textLabel.text = path.row == 29 ? @"Last row of the list" : [NSString stringWithFormat:@"Row %ld", (long)path.row + 1];+ return cell;+}+@end++// NavigationUI_TabBarImpl.TabBarContainerImpl in a compact width, as its viewDidLoad (0x1008409a8) and+// its size class pass (0x106fabb7c) lay it out: a guide from 49 pt above the safe area's bottom to the+// view's bottom, a stack as tall as the guide on the view's bottom, the tab bar as tall as the stack.+// The page gets 49 pt more safe area on top of what the container has (0x10707bde4).+@interface _TtC23NavigationUI_TabBarImpl19TabBarContainerImpl : UIViewController+@property (nonatomic, strong) UILayoutGuide *compactGuide;+@property (nonatomic, strong) UIView *bar;+@end+@implementation _TtC23NavigationUI_TabBarImpl19TabBarContainerImpl+- (UILayoutGuide *)compactTabBarHeightLayoutGuide { return self.compactGuide; }+- (UIView *)tabBarView { return self.bar; }+- (void)setSelectedViewController:(UIViewController *)controller {}++static UIView *item(Class cls, NSString *title, NSString *symbol, BOOL active) {+ UIView *item = [cls new];+ UIImageView *icon = [[UIImageView alloc] initWithImage:[UIImage systemImageNamed:symbol]];+ icon.tintColor = UIColor.whiteColor;+ icon.contentMode = UIViewContentModeScaleAspectFit;+ icon.frame = CGRectMake(0, 5.67, 24, 24);+ icon.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;+ UILabel *label = [UILabel new];+ label.text = title;+ label.font = [UIFont systemFontOfSize:10];+ label.textColor = active ? UIColor.whiteColor : [UIColor colorWithWhite:0xB3 / 255.0 alpha:1];+ label.textAlignment = NSTextAlignmentCenter;+ label.frame = CGRectMake(0, 35, 100, 14);+ label.autoresizingMask = UIViewAutoresizingFlexibleWidth;+ [item addSubview:icon];+ [item addSubview:label];+ return item;+}++- (void)viewDidLoad {+ [super viewDidLoad];+ UIView *view = self.view;+ self.compactGuide = [UILayoutGuide new];+ [view addLayoutGuide:self.compactGuide];++ SGHarnessPage *page = [SGHarnessPage new];+ [self addChildViewController:page];+ page.view.translatesAutoresizingMaskIntoConstraints = NO;+ [view addSubview:page.view];+ [page didMoveToParentViewController:self];+ page.additionalSafeAreaInsets = UIEdgeInsetsMake(0, 0, 49, 0);++ UIView *stack = [UIView new];+ stack.accessibilityIdentifier = @"TabBarContainer.stackView";+ stack.translatesAutoresizingMaskIntoConstraints = NO;+ [view addSubview:stack];+ self.bar = [_TtC23NavigationUI_TabBarImpl10TabBarView new];+ self.bar.accessibilityIdentifier = @"elements-tabs-view-identifier";+ self.bar.translatesAutoresizingMaskIntoConstraints = NO;+ [stack addSubview:self.bar];+ UIView *compact = [_TtC23NavigationUI_TabBarImpl17TabBarCompactView new];+ compact.translatesAutoresizingMaskIntoConstraints = NO;+ [self.bar addSubview:compact];+ UIStackView *row = [[UIStackView alloc] initWithArrangedSubviews:@[+ item(_TtC23NavigationUI_TabBarImpl21TabBarItemElementView.class, @"Home", @"house.fill", YES),+ item(_TtC23NavigationUI_TabBarImpl21TabBarItemElementView.class, @"Search", @"magnifyingglass", NO),+ item(_TtC23NavigationUI_TabBarImpl21TabBarItemElementView.class, @"Your Library", @"books.vertical", NO),+ item(_TtC25CreateMenu_TabBarItemImpl24CreateMenuTabBarItemView.class, @"Create", @"plus", NO),+ ]];+ row.distribution = UIStackViewDistributionFillEqually;+ row.accessibilityIdentifier = @"tabs-container-view-identifier";+ row.translatesAutoresizingMaskIntoConstraints = NO;+ [compact addSubview:row];++ [NSLayoutConstraint activateConstraints:@[+ [page.view.leadingAnchor constraintEqualToAnchor:view.leadingAnchor],+ [page.view.trailingAnchor constraintEqualToAnchor:view.trailingAnchor],+ [page.view.topAnchor constraintEqualToAnchor:view.topAnchor],+ [page.view.bottomAnchor constraintEqualToAnchor:view.bottomAnchor],+ [self.compactGuide.topAnchor constraintEqualToAnchor:view.safeAreaLayoutGuide.bottomAnchor constant:-49],+ [self.compactGuide.bottomAnchor constraintEqualToAnchor:view.bottomAnchor],+ [stack.leadingAnchor constraintEqualToAnchor:view.leadingAnchor],+ [stack.trailingAnchor constraintEqualToAnchor:view.trailingAnchor],+ [stack.bottomAnchor constraintEqualToAnchor:view.bottomAnchor],+ [stack.heightAnchor constraintEqualToAnchor:self.compactGuide.heightAnchor],+ [self.bar.leadingAnchor constraintEqualToAnchor:stack.leadingAnchor],+ [self.bar.trailingAnchor constraintEqualToAnchor:stack.trailingAnchor],+ [self.bar.bottomAnchor constraintEqualToAnchor:stack.bottomAnchor],+ [self.bar.heightAnchor constraintEqualToAnchor:stack.heightAnchor],+ [compact.leadingAnchor constraintEqualToAnchor:self.bar.leadingAnchor],+ [compact.trailingAnchor constraintEqualToAnchor:self.bar.trailingAnchor],+ [compact.topAnchor constraintEqualToAnchor:self.bar.topAnchor],+ [compact.bottomAnchor constraintEqualToAnchor:self.bar.bottomAnchor],+ [row.leadingAnchor constraintEqualToAnchor:compact.leadingAnchor],+ [row.trailingAnchor constraintEqualToAnchor:compact.trailingAnchor],+ [row.topAnchor constraintEqualToAnchor:compact.topAnchor],+ [row.heightAnchor constraintEqualToConstant:49],+ ]];+}+@end++#pragma mark - the chrome++// ClientChrome_ChromeContainerKit.ClientChromeViewController in a compact width: the primary content+// (the tab bar container) above the bottom attachment, which is Spotify's message bar, and the+// floating chrome (the now playing bar's page) standing on MainUIContainer's bottom anchor, the top of+// the tab bar container's compact height guide (0x100ae0178).+@interface SGHarnessChrome : UIViewController+@property (nonatomic, strong) _TtC23NavigationUI_TabBarImpl19TabBarContainerImpl *tabs;+@property (nonatomic, strong) UIView *banner;+@property (nonatomic, strong) NSLayoutConstraint *bannerHeight;+@property (nonatomic, strong) UIView *npb;+@end++@implementation SGHarnessChrome++- (void)viewDidLoad {+ [super viewDidLoad];+ UIView *view = self.view;+ view.backgroundColor = UIColor.blackColor;++ self.tabs = [_TtC23NavigationUI_TabBarImpl19TabBarContainerImpl new];+ [self addChildViewController:self.tabs];+ UIView *primary = self.tabs.view;+ primary.translatesAutoresizingMaskIntoConstraints = NO;+ [view addSubview:primary];+ [self.tabs didMoveToParentViewController:self];++ // LimitedExperienceIndicatorBar: its height is its message plus the safe area it pads its label by+ // (barHeightConstraint, backgroundContainerBottomPaddingConstraint, lastSafeAreaBottomInset).+ self.banner = [_TtC44LimitedExperienceIndicator_MessageBarRuntime29LimitedExperienceIndicatorBar new];+ self.banner.accessibilityIdentifier = @"LimitedExperienceIndicatorBar";+ self.banner.backgroundColor = UIColor.blackColor;+ self.banner.clipsToBounds = YES;+ self.banner.translatesAutoresizingMaskIntoConstraints = NO;+ [view addSubview:self.banner];+ UILabel *message = [UILabel new];+ message.text = @"Private Session";+ message.font = [UIFont systemFontOfSize:13 weight:UIFontWeightSemibold];+ message.textColor = UIColor.whiteColor;+ message.translatesAutoresizingMaskIntoConstraints = NO;+ [self.banner addSubview:message];+ self.bannerHeight = [self.banner.heightAnchor constraintEqualToConstant:0];++ UIView *npb = [_TtC22NowPlaying_BarPageImplP33_CCC0D2EEA6D4725EECD8965E8C38C86D20TouchPassthroughView new];+ npb.translatesAutoresizingMaskIntoConstraints = NO;+ [view addSubview:npb];+ self.npb = npb;+ UIViewController *content = [_TtC18NowPlaying_BarImpl36NowPlayingBarContainerViewController new];+ [self addChildViewController:content];+ content.view.translatesAutoresizingMaskIntoConstraints = NO;+ [npb addSubview:content.view];+ [content didMoveToParentViewController:self];++ [NSLayoutConstraint activateConstraints:@[+ [primary.leadingAnchor constraintEqualToAnchor:view.leadingAnchor],+ [primary.trailingAnchor constraintEqualToAnchor:view.trailingAnchor],+ [primary.topAnchor constraintEqualToAnchor:view.topAnchor],+ [primary.bottomAnchor constraintEqualToAnchor:self.banner.topAnchor],+ [self.banner.leadingAnchor constraintEqualToAnchor:view.leadingAnchor],+ [self.banner.trailingAnchor constraintEqualToAnchor:view.trailingAnchor],+ [self.banner.bottomAnchor constraintEqualToAnchor:view.bottomAnchor],+ self.bannerHeight,+ [message.centerXAnchor constraintEqualToAnchor:self.banner.centerXAnchor],+ [message.bottomAnchor constraintEqualToAnchor:self.banner.safeAreaLayoutGuide.bottomAnchor constant:-4],+ [npb.leadingAnchor constraintEqualToAnchor:view.leadingAnchor],+ [npb.trailingAnchor constraintEqualToAnchor:view.trailingAnchor],+ [npb.bottomAnchor constraintEqualToAnchor:self.tabs.compactTabBarHeightLayoutGuide.topAnchor],+ [npb.heightAnchor constraintEqualToConstant:64],+ // CompactNowPlayingViewController: the content 8 pt above its own bottom (0x105345190).+ [content.view.leadingAnchor constraintEqualToAnchor:npb.leadingAnchor],+ [content.view.trailingAnchor constraintEqualToAnchor:npb.trailingAnchor],+ [content.view.topAnchor constraintEqualToAnchor:npb.topAnchor],+ [content.view.bottomAnchor constraintEqualToAnchor:npb.bottomAnchor constant:-8],+ ]];++ // The now playing bar's share of the pages' inset, which Spotify adds on its own path; here a+ // stand-in on the page, so the list's end shows where Spotify thinks the bars begin.+ UIViewController *page = self.tabs.childViewControllers.firstObject;+ UIEdgeInsets inset = page.additionalSafeAreaInsets;+ inset.bottom += 64;+ page.additionalSafeAreaInsets = inset;+}++- (CGFloat)bannerTarget {+ return 22 + self.view.safeAreaInsets.bottom;+}++- (void)setBanner:(BOOL)shown animated:(BOOL)animated {+ self.bannerHeight.constant = shown ? [self bannerTarget] : 0;+ if (!animated) {+ [self.view layoutIfNeeded];+ return;+ }+ [UIView animateWithDuration:0.35 animations:^{ [self.view layoutIfNeeded]; }];+}++@end++#pragma mark - what the harness measures++extern CGRect SGRNowPlayingCardFrameIn(UIView *host, CGFloat *radius);++static UIView *platterIn(UIView *root) {+ // UIKit._UITabBarItemPlatterView on iOS 27; BarTransition.x looks for the same suffix.+ if ([NSStringFromClass(root.class) hasSuffix:@"PlatterView"]) return root;+ for (UIView *sub in root.subviews) {+ UIView *found = platterIn(sub);+ if (found) return found;+ }+ return nil;+}++static UITabBar *systemBarIn(UIView *root) {+ if ([root isKindOfClass:UITabBar.class]) return (UITabBar *)root;+ for (UIView *sub in root.subviews) {+ UITabBar *found = systemBarIn(sub);+ if (found) return found;+ }+ return nil;+}++static void report(SGHarnessChrome *chrome, NSString *moment) {+ UIWindow *window = chrome.view.window;+ UIView *stock = chrome.tabs.bar;+ UITabBar *system = systemBarIn(stock);+ UIView *platter = platterIn(system);+ CGRect stockFrame = [stock convertRect:stock.bounds toView:window];+ CGRect systemFrame = system ? [system convertRect:system.bounds toView:window] : CGRectNull;+ CGRect platterFrame = platter ? [platter convertRect:platter.bounds toView:window] : CGRectNull;+ CGRect card = SGRNowPlayingCardFrameIn(window, NULL);+ CGRect banner = [chrome.banner convertRect:chrome.banner.bounds toView:window];+ UITableView *list = (UITableView *)chrome.tabs.childViewControllers.firstObject.view;+ CGFloat listEnd = CGRectGetMaxY([list convertRect:list.bounds toView:window]) - list.adjustedContentInset.bottom;+ NSLog(@"[harness] %@ screen %.0fx%.0f safe-bottom %.0f | banner %@ | stock bar %@ | system bar %@ | platter %@ | card %@ | "+ @"gap card-to-platter %.1f | container extra inset %.0f | list ends at %.0f (card top %.0f)",+ moment, window.bounds.size.width, window.bounds.size.height, window.safeAreaInsets.bottom,+ NSStringFromCGRect(banner), NSStringFromCGRect(stockFrame), NSStringFromCGRect(systemFrame), NSStringFromCGRect(platterFrame),+ NSStringFromCGRect(card), CGRectGetMinY(platterFrame) - CGRectGetMaxY(card), chrome.tabs.additionalSafeAreaInsets.bottom,+ listEnd, CGRectGetMinY(card));+}++#pragma mark - the app++// Before every %ctor, so the redesign's gate reads on.+__attribute__((constructor(101))) static void sgr_harnessDefaults(void) {+ [NSUserDefaults.standardUserDefaults setBool:YES forKey:@"spotifyglass.redesign"];+}++@interface SGHarnessApp : UIResponder <UIApplicationDelegate>+@end+@implementation SGHarnessApp+@end++@interface SGHarnessScene : UIResponder <UIWindowSceneDelegate>+@property (nonatomic, strong) UIWindow *window;+@end++@implementation SGHarnessScene++static void after(double seconds, dispatch_block_t block) {+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(seconds * NSEC_PER_SEC)), dispatch_get_main_queue(), block);+}++- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)options {+ self.window = [[UIWindow alloc] initWithWindowScene:(UIWindowScene *)scene];+ self.window.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;+ SGHarnessChrome *chrome = [SGHarnessChrome new];+ self.window.rootViewController = chrome;+ [self.window makeKeyAndVisible];++ // What happens, from the launch argument: `none` no message bar, `shown` one sliding in at 1.5 s,+ // `away` one there from the start sliding away at 1.5 s, `cycle` in at 1.5 s and out at 4.5 s.+ NSArray<NSString *> *args = NSProcessInfo.processInfo.arguments;+ NSString *mode = args.count > 1 ? args[1] : @"none";+ if ([mode isEqualToString:@"away"]) [chrome setBanner:YES animated:NO];+ after(0.5, ^{+ UITableView *list = (UITableView *)chrome.tabs.childViewControllers.firstObject.view;+ [list scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:29 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:NO];+ report(chrome, @"start");+ });+ if ([mode isEqualToString:@"shown"] || [mode isEqualToString:@"cycle"]) after(1.5, ^{ [chrome setBanner:YES animated:YES]; });+ if ([mode isEqualToString:@"away"]) after(1.5, ^{ [chrome setBanner:NO animated:YES]; });+ if ([mode isEqualToString:@"cycle"]) after(4.5, ^{ [chrome setBanner:NO animated:YES]; });+ // Half way through the slide, what the screen shows (the presentation layers).+ if (![mode isEqualToString:@"none"]) after(1.5 + 0.17, ^{+ CALayer *stock = chrome.tabs.bar.layer.presentationLayer, *npb = chrome.npb.layer.presentationLayer, *banner = chrome.banner.layer.presentationLayer;+ NSLog(@"[harness] mid-slide presented: banner top %.1f, tab bar top %.1f, now playing bar bottom %.1f",+ [banner convertPoint:CGPointZero toLayer:self.window.layer.presentationLayer].y,+ [stock convertPoint:CGPointZero toLayer:self.window.layer.presentationLayer].y,+ [npb convertPoint:CGPointMake(0, npb.bounds.size.height) toLayer:self.window.layer.presentationLayer].y);+ });+ after(2.5, ^{+ UITableView *list = (UITableView *)chrome.tabs.childViewControllers.firstObject.view;+ [list scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:29 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:NO];+ report(chrome, mode);+ });+}++@end++int main(int argc, char *argv[]) {+ @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass(SGHarnessApp.class)); }+}diff --git a/harness/tabbar/stubs.m b/harness/tabbar/stubs.mnew file mode 100644index 00000000..03bb9d5f--- /dev/null+++ b/harness/tabbar/stubs.m@@ -0,0 +1,15 @@+// What the harness does not compile: the accent hook (SGRAccent.x), the repaint hook (SGRRepaint.x), the+// tab bar's composition (Navbar.x) and Mod Settings. Spotify's order of tabs stays as the mock has it.+#import <UIKit/UIKit.h>++UIColor *SGRAccentColor(void) { return nil; }+__weak UIView *sgr_nowPlayingRoot = nil;+__weak UIView *sgr_nowPlayingCard = nil;+__weak UIView *sgr_lyricsPageRoot = nil;+__weak UIView *sgr_playlistRoot = nil;+__weak UIView *sgr_albumRoot = nil;+__weak UIView *sgr_artistRoot = nil;++void SGRComposeTabBar(UIView *tabBar) {}+void SGRLogTabBarRow(UIView *tabBar) {}+void SGOpenModSettings(UIView *source) {}diff --git a/tweak/Sources/Redesigned/Navbar/TabBar.x b/tweak/Sources/Redesigned/Navbar/TabBar.xindex 03cf0f69..bc999d08 100644--- a/tweak/Sources/Redesigned/Navbar/TabBar.x+++ b/tweak/Sources/Redesigned/Navbar/TabBar.x@@ -1,7 +1,8 @@// Tab bar: Spotify's own bar stays where it is but goes invisible, and a system UITabBar sits on top// of it. On iOS 26+ with UIDesignRequiresCompatibility off, UIKit draws that bar as real Liquid Glass// (selection bubble, lensing, light/dark adaptation) with no glass API of ours. Spotify's bar keeps-// its frame, so the page insets and the now playing bar stay where Spotify puts them.+// its frame, so the page insets and the now playing bar stay where Spotify puts them; where the system+// bar is taller than Spotify's, Spotify is made to leave it the room (see "room for the glass bar").//// A tab picked on the system bar is passed on as a tap on the hidden Spotify item it mirrors, and the// system bar's selection follows whichever Spotify label is painted white. Navbar.x composes the@@ -16,8 +17,9 @@#import "Headers/SPTEncoreIconView.h"#import <objc/message.h>-static char kBarKey;+static char kBarKey, kHostKey;static __weak UIView *sg_stockBar;+static CGFloat sg_room, sg_glassHeight; // see "room for the glass bar"@interface SGRSystemTabBar : UITabBar <UITabBarDelegate, UIGestureRecognizerDelegate>@property (nonatomic, weak) UIView *stockBar;@@ -238,6 +240,21 @@ static void forwardTap(UIView *item) {@end+// The system bar's own view in Spotify's bar. UIKit measures the system bar and lays it out by the safe+// area of the view it stands in, and the room made under Spotify's bar is not the phone's: on a phone+// with a home button it went under the platter as well, squeezing it to 49 pt. So this view hands the+// bar the safe area without the room.+@interface SGRTabBarHost : UIView+@end++@implementation SGRTabBarHost+- (UIEdgeInsets)safeAreaInsets {+ UIEdgeInsets insets = [super safeAreaInsets];+ insets.bottom = MAX(0, insets.bottom - sg_room);+ return insets;+}+@end+@interface SGRHomeHold : UILongPressGestureRecognizer@end@@ -261,11 +278,60 @@ static void logBarOnce(UITabBar *bar) {static dispatch_once_t once;dispatch_once(&once, ^{dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{- SGLogLong(@"navbar", [NSString stringWithFormat:@"system tab bar %@\n%@", NSStringFromCGRect(bar.frame), [bar recursiveDescription]]);+ SGLogLong(@"navbar", [NSString stringWithFormat:@"system tab bar %@\n%@", NSStringFromCGRect(bar.superview.frame), [bar recursiveDescription]]);});});}+#pragma mark - room for the glass bar++// UIKit's glass bar asks for 83 pt, the platter the top 62 of it, over no more safe area than a Face ID+// phone's 34 (simulator, iOS 26.5 and 27). Spotify's bar is its 49 pt row over the bottom safe area of+// TabBarContainerImpl's view: a guide from 49 pt above the safe area's bottom to the view's bottom sets+// its height (its viewDidLoad, 0x100840a2c), the now playing bar stands on that guide's top+// (MainUIContainer's chrome bottom anchor, 0x100ae0178), the bar slides away by the inset plus 49 when+// Spotify hides it (0x1037169a4) and the pages get 49 on top of the inset (0x10707bde4). A Face ID+// phone gives the view 34 and the two bars match. A phone with a home button gives it none, and so does+// Spotify's message bar (LimitedExperienceIndicatorBar: Offline, Private Session) coming in under the+// tab bar, which takes the home indicator's inset for itself: the glass bar stood 34 pt above+// Spotify's, over the now playing bar. So the view gets the rest of the glass bar's height as safe+// area, and Spotify lays its bar, the now playing bar, the pages and the hide out for the glass bar+// itself, and moves them all with the message bar.+static const CGFloat kStockRow = 49;++// UIKit asks for 62 + max(21, inset) on a phone with a home button, max(83, 49 + inset) on a Face ID+// phone, by the safe area of the view the bar stands in. SGRTabBarHost keeps the room out of that; if+// it ever reached the bar again, the bar would ask for more room every pass, so what it asks for with+// no room made is what is kept.+static CGFloat glassHeight(UITabBar *bar, UIView *stockBar) {+ if (sg_room < 0.5 || sg_glassHeight <= 0) sg_glassHeight = [bar sizeThatFits:CGSizeMake(stockBar.bounds.size.width, kStockRow)].height;+ return sg_glassHeight;+}++static UIViewController *containerOf(UIView *stockBar) {+ Class containerClass = NSClassFromString(@"_TtC23NavigationUI_TabBarImpl19TabBarContainerImpl");+ for (UIResponder *r = stockBar.nextResponder; r; r = r.nextResponder) {+ if ([r isKindOfClass:containerClass]) return (UIViewController *)r;+ }+ return nil;+}++static void makeRoom(UIViewController *container) {+ UIView *stockBar = sg_stockBar;+ UITabBar *bar = stockBar ? objc_getAssociatedObject(stockBar, &kBarKey) : nil;+ if (!bar.window || !container.isViewLoaded || ![stockBar isDescendantOfView:container.view]) return;+ UIEdgeInsets extra = container.additionalSafeAreaInsets;+ CGFloat inset = container.view.safeAreaInsets.bottom - extra.bottom;+ CGFloat height = glassHeight(bar, stockBar);+ // Spotify's regular width bar is a fixed 76 pt that ignores the inset.+ BOOL compact = container.traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassCompact;+ CGFloat room = compact ? MAX(0, ceil(height - kStockRow - inset)) : 0;+ if (fabs(extra.bottom - room) < 0.5) return;+ sg_room = extra.bottom = room;+ container.additionalSafeAreaInsets = extra;+ SGLog(@"tab bar: %.0f pt of room made under Spotify's bar for the glass bar's %.0f, over an inset of %.0f", room, height, inset);+}+static void syncBar(UIView *stockBar) {sg_stockBar = stockBar;@@ -284,11 +350,15 @@ static void syncBar(UIView *stockBar) {[bar addGestureRecognizer:hold];bar.hold = hold;objc_setAssociatedObject(stockBar, &kBarKey, bar, OBJC_ASSOCIATION_RETAIN_NONATOMIC);+ SGRTabBarHost *host = [SGRTabBarHost new];+ [host addSubview:bar];+ objc_setAssociatedObject(stockBar, &kHostKey, host, OBJC_ASSOCIATION_RETAIN_NONATOMIC);}bar.tintColor = SGRAccent();+ UIView *host = objc_getAssociatedObject(stockBar, &kHostKey);for (UIView *sub in stockBar.subviews) {- if (sub == bar) continue;+ if (sub == host) continue;sub.alpha = 0;sub.userInteractionEnabled = NO;}@@ -338,12 +408,14 @@ static void syncBar(UIView *stockBar) {CGRect bounds = stockBar.bounds;CGFloat width = bounds.size.width;- CGFloat height = MAX(bounds.size.height, [bar sizeThatFits:CGSizeMake(width, bounds.size.height)].height);+ CGFloat height = MAX(bounds.size.height, glassHeight(bar, stockBar));CGRect frame = CGRectMake(0, CGRectGetMaxY(bounds) - height, width, height);- if (!CGRectEqualToRect(bar.frame, frame)) bar.frame = frame;- if (bar.superview != stockBar) [stockBar addSubview:bar];- else if (stockBar.subviews.lastObject != bar) [stockBar bringSubviewToFront:bar];+ if (!CGRectEqualToRect(host.frame, frame)) host.frame = frame;+ if (!CGRectEqualToRect(bar.frame, host.bounds)) bar.frame = host.bounds;+ if (host.superview != stockBar) [stockBar addSubview:host];+ else if (stockBar.subviews.lastObject != host) [stockBar bringSubviewToFront:host];logBarOnce(bar);+ makeRoom(containerOf(stockBar));}#pragma mark - hooks@@ -359,7 +431,7 @@ static UIView *tabBarOf(UIView *item) {%orig;SGRComposeTabBar((UIView *)self);for (UIView *sub in ((UIView *)self).subviews) {- if (![sub isKindOfClass:SGRSystemTabBar.class]) [sub layoutIfNeeded];+ if (![sub isKindOfClass:SGRTabBarHost.class]) [sub layoutIfNeeded];}holdHome((UIView *)self);syncBar((UIView *)self);@@ -400,6 +472,12 @@ static void itemDidLayOut(UIView *item) {if (bar) syncBar(bar);});}+// The message bar coming or going changes the view's safe area before Spotify lays the bar out for it,+// so the room follows in that same pass, and inside the message bar's animation.+- (void)viewSafeAreaInsetsDidChange {+ %orig;+ makeRoom((UIViewController *)self);+}%end%ctor {