Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.
C
feat: the glass welcome tour offers the redesign below iOS 26 with a warning
My-Name-Is-Jeff21d433d5f200
diff --git a/AGENTS.md b/AGENTS.mdindex 7abd1104..9c47dd22 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -20,10 +20,11 @@ sources, gestures, blocked artists, flags, Vibrations, Speed and pitch, and thelast three were the redesign's until they moved to `Shared/`, so their keys lost the `.redesign.` and`Core/SGPrefs.h`'s `SGMigrateKey` carries the old ones over at launch.-**The redesign needs iOS 26.** It is Liquid Glass, which the system draws from 26 on and no older OS-can be given, so `SGRedesignAvailable()` (`Core/SGUIMode.h`) holds it there: below 26 both-`SGRedesignedUI()` and `SGRedesignedUIStored()` answer NO whatever is stored, the switch becomes a-"Needs iOS 26" row and the tour greys its card out. The native look's floor is iOS 16.1, which is+**The redesign is built for iOS 26.** It is Liquid Glass, which the system draws from 26 on and no older OS+can be given. `SGRedesignAvailable()` (`Core/SGUIMode.h`) says whether this OS has it. Below 26 the+redesign runs only after a warning that it is untested there (`SGKeyRedesignUntested`, stored by+`SGSetRedesignedUI` in `App/Pages.m`), and a launch with it that hangs (issue #37) is followed by one in+the native look with both switches off. The native look's floor is iOS 16.1, which isSpotify 9.1.78's own.## Where code goes (`tweak/Sources/`)diff --git a/README.md b/README.mdindex 24ae1dbb..3d07f44d 100644--- a/README.md+++ b/README.md@@ -40,8 +40,8 @@ which change between releases, so another version may build and then break.| Live Activity | iOS 17+ |The redesign is `UIGlassEffect`, which only exists from iOS 26. Below that the Redesigned UI switch-is greyed out and the mod runs Spotify's own screens with everything else it adds on top. Both live-in Settings → Mod Settings.+turns it on only after a warning that it is untested there, and a launch with it that hangs goes back+to Spotify's own screens with everything else the mod adds on top. Both live in Settings → Mod Settings.## Build itdiff --git a/docs/tweaks.md b/docs/tweaks.mdindex 88a9cb61..af33af63 100644--- a/docs/tweaks.md+++ b/docs/tweaks.md@@ -47,12 +47,15 @@ screens works under both. So the sources are four layers, each a directory of feRedesigned/ the redesign; every %ctor starts with `if (!SGRedesignedUI()) return;`App/ Mod Settings' root and the pages that combine the layers, the Mod page, the tour-`SGRedesignAvailable()` (Core/SGUIMode.h) holds the redesign to iOS 26 and up: it is Liquid Glass, and-`UIGlassEffect` is the system's, so on an older OS the glass calls fall back to a blur and the redesign-runs untested against an older UIKit (issue #37, an iOS 17 scene-update watchdog). Below 26 both-`SGRedesignedUI()` and `SGRedesignedUIStored()` answer NO whatever is stored, so no Redesigned/ %ctor-runs, App/Pages.m draws the switch as a "Needs iOS 26" row and the tour greys its card out. The stored-key is left alone, so a phone that updates gets its redesign back.+`SGRedesignAvailable()` (Core/SGUIMode.h) says whether the OS has the redesign's material, iOS 26 and up:+it is Liquid Glass, and `UIGlassEffect` is the system's, so on an older OS the glass calls fall back to a+blur and the redesign runs untested against an older UIKit (issue #37, an iOS 17 scene-update watchdog).+Below 26 the Redesigned UI switch stores `SGKeyRedesignUntested` instead, and turning it on shows what+the redesign risks there and restarts Spotify from the alert; the tour offers the redesign card too, Legacy+picked, with the same warning under the cards. `SGRedesignedUIStored()` answers YES below 26 only with+that key set. A launch with the redesign below 26 leaves a mark that the main queue takes off after 15 s,+so a launch that hung is followed by one in the native look, with both switches off. The stored key+is left alone on iOS 26, so a phone that updates gets its redesign back.The two looks never run together, so each hooks the same Spotify class in its own way, and a part ofthe look is edited on its own side without touching the other: where both need the same thing, eachdiff --git a/tweak/Sources/App/Onboarding/Onboarding.h b/tweak/Sources/App/Onboarding/Onboarding.hindex f95c8f54..19732dce 100644--- a/tweak/Sources/App/Onboarding/Onboarding.h+++ b/tweak/Sources/App/Onboarding/Onboarding.h@@ -1,11 +1,15 @@-// Onboarding: a welcome page over Home the first time this build runs, in glass: a pick between-// the redesign (offered first) and Spotify's own look, and a line on holding Home for Mod Settings.-// The look is picked at launch, so a changed pick ends the welcome in a restart. The Mod page-// offers it again.+// Onboarding: a welcome page over Home the first time this build runs, in glass: Vitrine's logo landing,+// then a pick between the redesign (offered first on iOS 26) and Spotify's own look, and a line on+// holding Home for Mod Settings. The look is picked at launch, so a changed pick ends the welcome in a+// restart. The Mod page offers it again.#import <UIKit/UIKit.h>#define SGKeyOnboardingSeen @"spotifyglass.onboarding.seen"// Presents the tour over the top of the app; does nothing while it is already up.void SGShowOnboarding(void);+// The tour holds the screen; other sheets wait for it (App/About).BOOL SGOnboardingShowing(void);++// The tour's prominent glass button.+UIButton *SGOnboardingButton(NSString *title);diff --git a/tweak/Sources/App/Onboarding/Tour.m b/tweak/Sources/App/Onboarding/Tour.mindex bab1ec92..f48ea49e 100644--- a/tweak/Sources/App/Onboarding/Tour.m+++ b/tweak/Sources/App/Onboarding/Tour.m@@ -25,7 +25,7 @@ static char kPaneKey;}@end-static UIButton *glassButton(NSString *title) {+UIButton *SGOnboardingButton(NSString *title) {UIButtonConfiguration *config;if (@available(iOS 26.0, *)) config = [UIButtonConfiguration prominentGlassButtonConfiguration];else config = [UIButtonConfiguration filledButtonConfiguration];@@ -45,14 +45,11 @@ static UIButton *glassButton(NSString *title) {// when it is the one picked.@interface SGLookCard : UIControl- (instancetype)initWithSymbol:(NSString *)symbol title:(NSString *)title subtitle:(NSString *)subtitle;-// A look this phone cannot run: the card stays on the page, greyed and untappable, and says why.-- (void)makeUnavailable:(NSString *)reason;@end@implementation SGLookCard {SGGlassView *_glass;UIImageView *_check;- UILabel *_line;}- (instancetype)initWithSymbol:(NSString *)symbol title:(NSString *)title subtitle:(NSString *)subtitle {@@ -72,7 +69,6 @@ static UIButton *glassButton(NSString *title) {line.font = [UIFont systemFontOfSize:13];line.textColor = SGGrey();line.numberOfLines = 0;- _line = line;UIStackView *text = [[UIStackView alloc] initWithArrangedSubviews:@[name, line]];text.axis = UILayoutConstraintAxisVertical;text.spacing = 2;@@ -122,33 +118,184 @@ static UIButton *glassButton(NSString *title) {- (void)setHighlighted:(BOOL)highlighted {[super setHighlighted:highlighted];- if (self.enabled) self.alpha = highlighted ? 0.6 : 1;+ self.alpha = highlighted ? 0.6 : 1;}-- (void)makeUnavailable:(NSString *)reason {- self.selected = NO;- self.enabled = NO;- self.alpha = 0.45;- _line.text = reason;- _check.image = [UIImage systemImageNamed:@"lock.fill"- withConfiguration:[UIImageSymbolConfiguration configurationWithPointSize:17 weight:UIImageSymbolWeightSemibold]];- _check.tintColor = SGGrey();+@end++#pragma mark - the logo++// Vitrine's icon in live glass: reeds of glass over a warm glow, the shop window of icons/Vitrine.png.+// The tour opens on it, each reed flying in and landing beside the last, before the page comes in+// under it. Glass shows and hides by its effect, never by an alpha (Redesigned/Kit/SGRGlass.h).+@interface SGTourLogo : UIView+// The state before the landing: the frame alone, no glass, no glow, the reeds out of place.+- (void)prepare;+// Plays the landing, then runs `landed` as the last reed starts to settle; under Reduce Motion the reeds+// and the glow fade in where they are.+- (void)landThen:(void (^)(void))landed;+@end++@implementation SGTourLogo {+ CAGradientLayer *_glow;+ UIView *_pane;+ NSArray<UIVisualEffectView *> *_reeds;+ NSArray<CAGradientLayer *> *_flutes;+}++static const NSUInteger kReeds = 5;++// Clear glass, the style for what sits over something bright, so the glow keeps its light through it.+static UIVisualEffect *reedEffect(void) {+ Class glass = NSClassFromString(@"UIGlassEffect");+ if ([glass respondsToSelector:@selector(effectWithStyle:)]) return [glass effectWithStyle:1];+ return SGGlassEffect();+}+static const CGFloat kLogoRadius = 22;++- (instancetype)initWithFrame:(CGRect)frame {+ if (!(self = [super initWithFrame:frame])) return nil;+ self.isAccessibilityElement = YES;+ self.accessibilityLabel = @"Vitrine";+ self.accessibilityTraits = UIAccessibilityTraitImage;++ _pane = [UIView new];+ _pane.clipsToBounds = YES;+ _pane.layer.cornerRadius = kLogoRadius;+ _pane.layer.cornerCurve = kCACornerCurveContinuous;+ _pane.layer.borderWidth = 1;+ _pane.layer.borderColor = [UIColor colorWithWhite:1 alpha:0.28].CGColor;+ [self addSubview:_pane];++ // The icon's palette: a light core going to Apple Music red, then violet, then the dark around it.+ _glow = [CAGradientLayer layer];+ _glow.type = kCAGradientLayerRadial;+ _glow.colors = @[(id)[UIColor colorWithRed:1 green:0.93 blue:0.9 alpha:1].CGColor,+ (id)[UIColor colorWithRed:0.98 green:0.18 blue:0.28 alpha:1].CGColor,+ (id)[UIColor colorWithRed:0.55 green:0.2 blue:0.85 alpha:1].CGColor,+ (id)[UIColor colorWithRed:0.08 green:0.04 blue:0.1 alpha:1].CGColor];+ _glow.locations = @[@0, @0.35, @0.7, @1];+ _glow.startPoint = CGPointMake(0.45, 0.5);+ _glow.endPoint = CGPointMake(1.05, 1.1);+ [_pane.layer addSublayer:_glow];++ // Each reed is a flute: shade where its curve turns away on the right, a line of light on the left.+ NSMutableArray<UIVisualEffectView *> *reeds = [NSMutableArray array];+ NSMutableArray<CAGradientLayer *> *flutes = [NSMutableArray array];+ for (NSUInteger i = 0; i < kReeds; i++) {+ UIVisualEffectView *reed = [[UIVisualEffectView alloc] initWithEffect:reedEffect()];+ reed.userInteractionEnabled = NO;+ reed.clipsToBounds = YES;+ CAGradientLayer *flute = [CAGradientLayer layer];+ flute.startPoint = CGPointMake(0, 0.5);+ flute.endPoint = CGPointMake(1, 0.5);+ flute.colors = @[(id)[UIColor colorWithWhite:1 alpha:0].CGColor, (id)[UIColor colorWithWhite:1 alpha:0.45].CGColor,+ (id)[UIColor colorWithWhite:1 alpha:0].CGColor, (id)[UIColor colorWithWhite:0 alpha:0].CGColor,+ (id)[UIColor colorWithWhite:0 alpha:0.35].CGColor];+ flute.locations = @[@0.08, @0.16, @0.3, @0.6, @1];+ [reed.contentView.layer addSublayer:flute];+ [flutes addObject:flute];+ [_pane addSubview:reed];+ [reeds addObject:reed];+ }+ _reeds = reeds;+ _flutes = flutes;+ return self;+}++- (void)layoutSubviews {+ [super layoutSubviews];+ _pane.frame = self.bounds;+ // Glass draws a little past its own bounds, which clipsToBounds lets through; a mask does not.+ CAShapeLayer *mask = [CAShapeLayer layer];+ mask.path = [UIBezierPath bezierPathWithRoundedRect:_pane.bounds cornerRadius:kLogoRadius].CGPath;+ _pane.layer.mask = mask;+ [CATransaction begin];+ [CATransaction setDisableActions:YES];+ _glow.frame = _pane.bounds;+ CGFloat width = self.bounds.size.width / kReeds, height = self.bounds.size.height;+ for (NSUInteger i = 0; i < kReeds; i++) {+ UIVisualEffectView *reed = _reeds[i];+ // Frames are laid out under the identity transform the landing ends on.+ CGAffineTransform transform = reed.transform;+ reed.transform = CGAffineTransformIdentity;+ reed.frame = CGRectMake(i * width, 0, width, height);+ reed.transform = transform;+ _flutes[i].frame = reed.bounds;+ }+ [CATransaction commit];+}++- (void)prepare {+ BOOL reduce = UIAccessibilityIsReduceMotionEnabled();+ _glow.opacity = 0;+ for (NSUInteger i = 0; i < kReeds; i++) {+ _reeds[i].effect = nil;+ _reeds[i].contentView.alpha = 0;+ // Alternate reeds come from above and below, the middle one from furthest, so the pane closes+ // on itself rather than sliding in from one side.+ CGFloat from = (i % 2 ? -1 : 1) * (28 + 10 * (CGFloat)(2 - labs((long)i - 2)));+ if (!reduce) _reeds[i].transform = CGAffineTransformScale(CGAffineTransformMakeTranslation(0, from), 0.94, 0.94);+ }+}++- (void)landThen:(void (^)(void))landed {+ BOOL reduce = UIAccessibilityIsReduceMotionEnabled();++ CABasicAnimation *glow = [CABasicAnimation animationWithKeyPath:@"opacity"];+ glow.fromValue = @0;+ glow.toValue = @1;+ glow.duration = 0.5;+ glow.timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.23 :1 :0.32 :1];+ _glow.opacity = 1;+ [_glow addAnimation:glow forKey:@"in"];++ if (reduce) {+ [UIView animateWithDuration:0.3 animations:^{+ for (UIVisualEffectView *reed in self->_reeds) {+ reed.effect = reedEffect();+ reed.contentView.alpha = 1;+ }+ }];+ if (landed) landed();+ return;+ }+ // A landing has a little give: damping 0.8, the reeds 50 ms apart.+ const NSTimeInterval stagger = 0.05, flight = 0.55;+ for (NSUInteger i = 0; i < kReeds; i++) {+ UIVisualEffectView *reed = _reeds[i];+ UIViewPropertyAnimator *animator = [[UIViewPropertyAnimator alloc] initWithDuration:flight dampingRatio:0.8 animations:^{+ reed.transform = CGAffineTransformIdentity;+ reed.effect = reedEffect();+ reed.contentView.alpha = 1;+ }];+ [animator startAnimationAfterDelay:0.1 + i * stagger];+ }+ if (landed) {+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)((0.1 + (kReeds - 1) * stagger + flight * 0.5) * NSEC_PER_SEC)),+ dispatch_get_main_queue(), landed);+ }}@end#pragma mark - the tour-// One page, the one choice worth making now: the redesign or Spotify's own look. Everything else-// waits in Mod Settings.+// One page, the one choice worth making now: the redesign or Spotify's own look, under Vitrine's logo.+// Everything else waits in Mod Settings.@interface SGOnboardingController : UIViewController@end@implementation SGOnboardingController {- UIImageView *_hero;+ SGTourLogo *_logo;SGLookCard *_redesigned, *_legacy;- UIView *_beta;+ UIView *_note;+ UIImageView *_noteIcon;+ UILabel *_noteText;+ UIButton *_report;UIButton *_primary;+ NSArray<UIView *> *_page; // what comes in under the logo, in order+ BOOL _landed;}- (instancetype)init {@@ -158,17 +305,15 @@ static UIButton *glassButton(NSString *title) {return self;}-// Under the cards while the redesign is picked: it is a beta, and a bug report is the way to help.-- (UIView *)betaNote {- UIImageView *icon = SGSymbolView(@"exclamationmark.triangle.fill", 15, UIImageSymbolWeightSemibold, 22);- icon.tintColor = UIColor.systemYellowColor;- UILabel *text = [UILabel new];- text.text = @"The redesign is a beta. Expect lags, freezes and bugs.";- text.font = [UIFont systemFontOfSize:13];- text.textColor = SGGrey();- text.numberOfLines = 0;- [text setContentHuggingPriority:UILayoutPriorityDefaultLow - 1 forAxis:UILayoutConstraintAxisHorizontal];- UIStackView *line = [[UIStackView alloc] initWithArrangedSubviews:@[icon, text]];+// Under the cards: what the picked look leaves out, or below iOS 26 what the redesign risks there.+- (UIView *)noteView {+ _noteIcon = SGSymbolView(@"info.circle.fill", 15, UIImageSymbolWeightSemibold, 22);+ _noteText = [UILabel new];+ _noteText.font = [UIFont systemFontOfSize:13];+ _noteText.textColor = SGGrey();+ _noteText.numberOfLines = 0;+ [_noteText setContentHuggingPriority:UILayoutPriorityDefaultLow - 1 forAxis:UILayoutConstraintAxisHorizontal];+ UIStackView *line = [[UIStackView alloc] initWithArrangedSubviews:@[_noteIcon, _noteText]];line.alignment = UIStackViewAlignmentTop;line.spacing = 10;@@ -176,12 +321,12 @@ static UIButton *glassButton(NSString *title) {config.contentInsets = NSDirectionalEdgeInsetsMake(4, 32, 4, 0);config.baseForegroundColor = SGGreen();config.attributedTitle = [[NSAttributedString alloc] initWithString:@"Report a bug" attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:13 weight:UIFontWeightSemibold]}];- UIButton *report = [UIButton buttonWithConfiguration:config primaryAction:[UIAction actionWithHandler:^(UIAction *action) {+ _report = [UIButton buttonWithConfiguration:config primaryAction:[UIAction actionWithHandler:^(UIAction *action) {SGOpenURL([SGRepoURL stringByAppendingString:@"/issues"]);}]];- report.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeading;+ _report.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeading;- UIStackView *note = [[UIStackView alloc] initWithArrangedSubviews:SGRepoURL ? @[line, report] : @[line]];+ UIStackView *note = [[UIStackView alloc] initWithArrangedSubviews:@[line, _report]];note.axis = UILayoutConstraintAxisVertical;note.alignment = UIStackViewAlignmentLeading;note.spacing = 2;@@ -190,44 +335,54 @@ static UIButton *glassButton(NSString *title) {return note;}+// The redesign is the look Vitrine is built around, so picking it needs no note on iOS 26. Legacy is+// told what it goes without; below 26 the redesign is told it is untested, with the way to report it.+- (void)updateNote {+ BOOL untested = _redesigned.selected && !SGRedesignAvailable();+ if (untested) {+ _noteIcon.image = [UIImage systemImageNamed:@"exclamationmark.triangle.fill"];+ _noteIcon.tintColor = UIColor.systemYellowColor;+ _noteText.text = SGRedesignUntestedWarning();+ } else {+ _noteIcon.image = [UIImage systemImageNamed:@"info.circle.fill"];+ _noteIcon.tintColor = SGGrey();+ _noteText.text = @"Apple Music style lyrics, the redesigned player and the glass tab bar come with the redesign only.";+ }+ _report.hidden = !untested || !SGRepoURL;+ _note.hidden = _redesigned.selected && !untested;+}+- (void)viewDidLoad {[super viewDidLoad];self.view.backgroundColor = [UIColor colorWithWhite:0 alpha:0.85];- SGGlassView *halo = [SGGlassView new];- halo.capsule = YES;- halo.translatesAutoresizingMaskIntoConstraints = NO;- _hero = SGSymbolView(@"music.note", 34, UIImageSymbolWeightMedium, 88);- _hero.translatesAutoresizingMaskIntoConstraints = NO;- [halo addSubview:_hero];- // The column stretches its children to its width; the halo keeps its square inside a strip.+ _logo = [SGTourLogo new];+ _logo.translatesAutoresizingMaskIntoConstraints = NO;+ // The column stretches its children to its width; the logo keeps its square inside a strip.UIView *strip = [UIView new];- [strip addSubview:halo];+ [strip addSubview:_logo];BOOL glass = SGRedesignAvailable();UILabel *heading = [UILabel new];- heading.text = glass ? @"Pick your look." : @"Your look.";+ heading.text = @"Pick your look.";heading.font = [UIFont systemFontOfSize:30 weight:UIFontWeightBold];heading.textColor = UIColor.whiteColor;heading.numberOfLines = 0;- _redesigned = [[SGLookCard alloc] initWithSymbol:@"sparkles" title:@"Redesigned" subtitle:@"Looks like Apple Music. Better lyrics, Live Activity."];+ NSString *redesign = glass ? @"Looks like Apple Music. Better lyrics, Live Activity."+ : [NSString stringWithFormat:@"Looks like Apple Music. Untested on iOS %@.", UIDevice.currentDevice.systemVersion];+ _redesigned = [[SGLookCard alloc] initWithSymbol:@"sparkles" title:@"Redesigned" subtitle:redesign];_legacy = [[SGLookCard alloc] initWithSymbol:@"slider.horizontal.3" title:@"Legacy" subtitle:@"More options, still looks like Spotify."];for (SGLookCard *card in @[_redesigned, _legacy]) [card addTarget:self action:@selector(picked:) forControlEvents:UIControlEventTouchUpInside];- // The first launch offers the redesign; the tour again from the Mod page shows the stored look.- BOOL redesign = glass && (SGFlag(SGKeyOnboardingSeen, NO) ? SGRedesignedUIStored() : YES);- _redesigned.selected = redesign;- _legacy.selected = !redesign;- // Liquid Glass is drawn by iOS 26 and by nothing before it, so on an older phone the card stays- // on the page to say so and the legacy look is the only one left.- if (!glass) {- [_redesigned makeUnavailable:[NSString stringWithFormat:@"Needs iOS 26. This phone runs iOS %@.", UIDevice.currentDevice.systemVersion]];- _legacy.enabled = NO;- }- _beta = [self betaNote];- _beta.hidden = !redesign;-- UIStackView *column = [[UIStackView alloc] initWithArrangedSubviews:@[strip, heading, _redesigned, _legacy, _beta]];+ // The first launch offers the redesign where it is at home; below iOS 26 it waits to be asked for.+ // The tour again from the Mod page shows the stored look.+ BOOL redesigned = SGFlag(SGKeyOnboardingSeen, NO) ? SGRedesignedUIStored() : glass;+ _redesigned.selected = redesigned;+ _legacy.selected = !redesigned;+ _note = [self noteView];+ [self updateNote];++ UIStackView *column = [[UIStackView alloc] initWithArrangedSubviews:@[strip, heading, _redesigned, _legacy, _note]];column.axis = UILayoutConstraintAxisVertical;column.spacing = 12;[column setCustomSpacing:28 afterView:strip];@@ -241,7 +396,7 @@ static UIButton *glassButton(NSString *title) {[scroll addSubview:column];[self.view addSubview:scroll];- _primary = glassButton(@"Start listening");+ _primary = SGOnboardingButton(@"Start listening");[_primary addTarget:self action:@selector(finish) forControlEvents:UIControlEventTouchUpInside];UILabel *footer = [UILabel new];footer.text = @"Hold Home to open settings.";@@ -264,13 +419,11 @@ static UIButton *glassButton(NSString *title) {[column.leadingAnchor constraintEqualToAnchor:content.leadingAnchor constant:kMargin],[column.trailingAnchor constraintEqualToAnchor:content.trailingAnchor constant:-kMargin],[column.widthAnchor constraintEqualToAnchor:frame.widthAnchor constant:-2 * kMargin],- [halo.leadingAnchor constraintEqualToAnchor:strip.leadingAnchor],- [halo.topAnchor constraintEqualToAnchor:strip.topAnchor],- [halo.bottomAnchor constraintEqualToAnchor:strip.bottomAnchor],- [halo.widthAnchor constraintEqualToConstant:88],- [halo.heightAnchor constraintEqualToConstant:88],- [_hero.centerXAnchor constraintEqualToAnchor:halo.centerXAnchor],- [_hero.centerYAnchor constraintEqualToAnchor:halo.centerYAnchor],+ [_logo.leadingAnchor constraintEqualToAnchor:strip.leadingAnchor],+ [_logo.topAnchor constraintEqualToAnchor:strip.topAnchor],+ [_logo.bottomAnchor constraintEqualToAnchor:strip.bottomAnchor],+ [_logo.widthAnchor constraintEqualToConstant:88],+ [_logo.heightAnchor constraintEqualToConstant:88],[_primary.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor constant:kMargin],[_primary.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor constant:-kMargin],[_primary.bottomAnchor constraintEqualToAnchor:footer.topAnchor constant:-12],@@ -279,25 +432,43 @@ static UIButton *glassButton(NSString *title) {[footer.bottomAnchor constraintEqualToAnchor:safe.bottomAnchor constant:-8],]];[self refresh];++ // The tour opens on the logo alone; the page waits under it until the reeds land.+ _page = @[heading, _redesigned, _legacy, _note, _primary, footer];+ [_logo prepare];+ BOOL reduce = UIAccessibilityIsReduceMotionEnabled();+ for (UIView *view in _page) {+ view.alpha = 0;+ if (!reduce) view.transform = CGAffineTransformMakeTranslation(0, 16);+ }}-// iOS 16 has no symbol effects and skips the bounce.- (void)viewDidAppear:(BOOL)animated {[super viewDidAppear:animated];- if (@available(iOS 17.0, *)) [_hero addSymbolEffect:[NSClassFromString(@"NSSymbolBounceEffect") effect]];+ if (_landed) return;+ _landed = YES;+ NSArray<UIView *> *page = _page;+ [_logo landThen:^{+ // A strong ease out, critically damped, 40 ms between the parts. Under Reduce Motion the page+ // only fades, as nothing was moved out of place.+ for (NSUInteger i = 0; i < page.count; i++) {+ UIViewPropertyAnimator *animator = [[UIViewPropertyAnimator alloc] initWithDuration:0.45 dampingRatio:1 animations:^{+ page[i].alpha = 1;+ page[i].transform = CGAffineTransformIdentity;+ }];+ [animator startAnimationAfterDelay:i * 0.04];+ }+ }];}- (void)picked:(SGLookCard *)card {_redesigned.selected = card == _redesigned;_legacy.selected = card == _legacy;- BOOL hide = !_redesigned.selected;- if (_beta.hidden != hide) {- [UIView animateWithDuration:0.25 animations:^{- self->_beta.hidden = hide;- self->_beta.alpha = hide ? 0 : 1;- [self.view layoutIfNeeded];- }];- }+ [UIView animateWithDuration:0.25 animations:^{+ [self updateNote];+ self->_note.alpha = self->_note.hidden ? 0 : 1;+ [self.view layoutIfNeeded];+ }];[self refresh];}@@ -313,6 +484,8 @@ static UIButton *glassButton(NSString *title) {_primary.configuration = config;}+// Below iOS 26 the note above the button has said what the redesign risks there, so picking it and+// going on is the warning accepted (SGSetRedesignedUI stores that).- (void)finish {SGSetEnabled(SGKeyOnboardingSeen, YES);SGSetRedesignedUI(_redesigned.selected);diff --git a/tweak/Sources/App/Pages.h b/tweak/Sources/App/Pages.hindex ce7afecb..4624c8c4 100644--- a/tweak/Sources/App/Pages.h+++ b/tweak/Sources/App/Pages.h@@ -6,6 +6,8 @@// Redesigned UI, the one switch between the two looks, and what its ⓘ reads out.void SGSetRedesignedUI(BOOL on);extern NSString *const SGRedesignedUIInfo;+// Below iOS 26: what turning the redesign on risks there, for the switch's alert and the tour.+NSString *SGRedesignUntestedWarning(void);UIViewController *SGAppearancePage(void); // Redesigned UI, the accent, the font and the app iconUIViewController *SGPlayerSettingsPage(void);diff --git a/tweak/Sources/App/Pages.m b/tweak/Sources/App/Pages.mindex efd735a1..41ad0456 100644--- a/tweak/Sources/App/Pages.m+++ b/tweak/Sources/App/Pages.m@@ -27,8 +27,16 @@NSString *const SGRedesignedUIInfo = @"The newest version of Vitrine, leaning towards Apple Music's style. It is not compatible with the legacy look's settings.\n\nThe legacy look gives you more freedom, yet still looks like Spotify.";+// Below iOS 26 the redesign also needs SGKeyRedesignUntested (Core/SGUIMode.h): whoever calls this has+// shown the warning. Turning it off takes that back, so turning it on again warns again.void SGSetRedesignedUI(BOOL on) {SGSetEnabled(SGKeyRedesign, on);+ SGSetEnabled(SGKeyRedesignUntested, on && !SGRedesignAvailable());+}++NSString *SGRedesignUntestedWarning(void) {+ return [NSString stringWithFormat:@"The redesign is built on iOS 26's Liquid Glass. iOS %@ draws a blur in its place, and nobody has tested the redesign there: pages can be laid out wrongly, and Spotify can freeze as it starts. If Spotify does not start with it, the next launch goes back to Legacy.",+ UIDevice.currentDevice.systemVersion];}// The whole look changes hands at launch, so the switch asks for the restart straight away rather than@@ -42,23 +50,36 @@ static void offerRestart(BOOL on) {[SGTopController() presentViewController:alert animated:YES completion:nil];}-// Below iOS 26 the row is not a switch: Liquid Glass is the redesign, and the system draws it from-// that version on, so the row reads out what is missing and the page carries the native look's rows alone.-static SGModRow *unavailableRow(void) {- SGModRow *row = SGStatActionRow(@"Redesigned UI", nil, ^NSString *{ return @"Needs iOS 26"; }, ^{- UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Redesigned UI"- message:[NSString stringWithFormat:@"The redesign is built on Liquid Glass, which iOS 26 draws and no earlier version can. This phone runs iOS %@, so the mod gives you its legacy look instead: Spotify's own screens with everything else the mod adds on them.", UIDevice.currentDevice.systemVersion]+// Below iOS 26 the switch stores the warning's key, not the look's: it is on only once the warning has+// been accepted, which restarts Spotify at once, so the switch never reads on for a look that is not coming.+static SGModRow *untestedRow(void) {+ SGModRow *row = SGOptionRow(@"Redesigned UI", [NSString stringWithFormat:@"Untested on iOS %@", UIDevice.currentDevice.systemVersion], SGKeyRedesignUntested);+ row.glows = YES;+ row.info = SGRedesignedUIInfo;+ row.changed = ^(BOOL on) {+ if (!on) {+ SGSetRedesignedUI(NO);+ offerRestart(NO);+ return;+ }+ SGSetEnabled(SGKeyRedesignUntested, NO); // the page reloads to off; the warning's button turns it on+ UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Turn on the redesign?"+ message:[SGRedesignUntestedWarning() stringByAppendingString:@"\n\nSpotify restarts to turn it on."]preferredStyle:UIAlertControllerStyleAlert];- [alert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:nil]];+ [alert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]];+ [alert addAction:[UIAlertAction actionWithTitle:@"Turn On and Restart" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {+ SGSetRedesignedUI(YES);+ SGRestartSpotify();+ }]];[SGTopController() presentViewController:alert animated:YES completion:nil];- });+ };return SGWithTile(row, @"sparkles", UIColor.systemPurpleColor);}-// Redesigned UI, then the stored look's own rows (below iOS 26 that is always the native look's), then the+// Redesigned UI, then the stored look's own rows, then the// font and the app icon, which work under either look on any iOS.UIViewController *SGAppearancePage(void) {- SGModRow *look = unavailableRow();+ SGModRow *look = untestedRow();if (SGRedesignAvailable()) {SGModRow *redesign = SGOptionRow(@"Redesigned UI", nil, SGKeyRedesign);redesign.glows = YES;diff --git a/tweak/Sources/Core/SGUIMode.h b/tweak/Sources/Core/SGUIMode.hindex be6801ed..7af6fc64 100644--- a/tweak/Sources/Core/SGUIMode.h+++ b/tweak/Sources/Core/SGUIMode.h@@ -13,14 +13,20 @@// The redesign is Liquid Glass, and Liquid Glass is UIGlassEffect, which the system renders and which// no older OS can be given. Below iOS 26 the glass calls in Core/SGGlass.m and Redesigned/Kit/SGRGlass.m-// fall back to a blur, so the redesign does not refuse to run, it runs untested against an older UIKit-// and hangs its layout (issue #37, iOS 17: a scene-update watchdog). So it is offered only where its-// material exists, and below that the native look is the whole mod. Everything this answers NO to-// leaves the switch, the tour's card and the redesign's settings pages out, whatever is stored.+// fall back to a blur, and the redesign runs untested against an older UIKit (issue #37, iOS 17: a+// scene-update watchdog hang). So below 26 it runs only after a warning has been accepted, which stores+// SGKeyRedesignUntested (App/Pages.m's SGSetRedesignedUI does it), and only while it starts: a launch+// whose main queue did not run for 15 s is followed by one in the native look, with both switches off+// and SGRedesignFellBack() answering YES for the App layer to say so.+#define SGKeyRedesignUntested @"spotifyglass.redesign.untested"++// Whether this OS has the redesign's material: iOS 26 and up.BOOL SGRedesignAvailable(void);+// The redesign was on below iOS 26, and the last launch with it did not get going: this one is native.+BOOL SGRedesignFellBack(void);BOOL SGRedesignedUI(void);BOOL SGNativeUI(void);-// The stored switch rather than the launch's, for settings pages opened after it was flipped: they+// The stored switch rather than the launch's (below iOS 26, with the warning accepted), for settings pages opened after it was flipped: they// show what the restart will bring.BOOL SGRedesignedUIStored(void);diff --git a/tweak/Sources/Core/SGUIMode.m b/tweak/Sources/Core/SGUIMode.mindex ffa2bc3a..7c4106cd 100644--- a/tweak/Sources/Core/SGUIMode.m+++ b/tweak/Sources/Core/SGUIMode.m@@ -7,12 +7,42 @@ BOOL SGRedesignAvailable(void) {return NO;}+static NSString *const kStarting = @"spotifyglass.redesign.untested.starting";+static const NSTimeInterval kStarted = 15;+static BOOL sg_fellBack;++BOOL SGRedesignFellBack(void) {+ return sg_fellBack;+}++// Below iOS 26 a launch with the redesign leaves a mark that the main queue takes off once it has run+// for a while; a launch that hung (the watchdog of #37) never gets there, so the next one finds the+// mark and starts native. ponytail: a quit inside the first 15 s also counts as a launch that hung, and+// turns the redesign off; a hang later on is not caught.+static BOOL startsUntested(void) {+ NSUserDefaults *store = NSUserDefaults.standardUserDefaults;+ if ([store boolForKey:kStarting]) {+ [store removeObjectForKey:kStarting];+ SGSetEnabled(SGKeyRedesign, NO);+ SGSetEnabled(SGKeyRedesignUntested, NO);+ sg_fellBack = YES;+ SGLog(@"ui: the last launch with the redesign on iOS %@ did not get going, so this one is native",+ NSProcessInfo.processInfo.operatingSystemVersionString);+ return NO;+ }+ [store setBool:YES forKey:kStarting];+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(kStarted * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{+ [store removeObjectForKey:kStarting];+ });+ return YES;+}+BOOL SGRedesignedUI(void) {static BOOL on;static dispatch_once_t once;dispatch_once(&once, ^{- on = SGRedesignedUIStored();- SGLog(@"ui: %@%@", on ? @"redesigned" : @"native", SGRedesignAvailable() ? @"" : @" (the redesign needs iOS 26)");+ on = SGRedesignedUIStored() && (SGRedesignAvailable() || startsUntested());+ SGLog(@"ui: %@%@", on ? @"redesigned" : @"native", SGRedesignAvailable() ? @"" : on ? @" (untested below iOS 26)" : @" (the redesign needs iOS 26)");});return on;}@@ -23,6 +53,6 @@ BOOL SGNativeUI(void) {BOOL SGRedesignedUIStored(void) {// The stored switch is left alone rather than turned off: a phone updated to iOS 26 gets the- // redesign it was last asked for back.- return SGRedesignAvailable() && SGFlag(SGKeyRedesign, NO);+ // redesign it was last asked for back. Below 26 it counts only with the warning accepted.+ return SGFlag(SGKeyRedesign, NO) && (SGRedesignAvailable() || SGFlag(SGKeyRedesignUntested, NO));}