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: the Redesigned UI switch shows its rainbow while off, and its ⓘ says in two lines what each look is

Vojtěch Škopekb828ce138f90
diff --git a/tweak/Sources/App/Pages.m b/tweak/Sources/App/Pages.m
index 933d2af3..3aaa5fc0 100644
--- a/tweak/Sources/App/Pages.m
+++ b/tweak/Sources/App/Pages.m
@@ -16,7 +16,7 @@
#import "Redesigned/NowPlayingBar/NowPlayingBar.h"
#import "Redesigned/Kit/SGRAccent.h"
-NSString *const SGRedesignedUIInfo = @"Replaces Spotify's own look with the mod's redesign, built in Liquid Glass: the glass tab bar, search field and now playing bar, the full screen player with the lyrics under it, Spotify's own glass bars and sheets, and every screen redesigned later.\n\nThe redesign starts from a clean sheet: it is black throughout, it has an accent colour of its own, and the switches that change Spotify's own screens (the player, Home, playlists, albums, artists, AMOLED) are put away while it is on, and none of them runs. What works the same with either look stays: ads and privacy, lyrics sources, gestures, blocked artists.\n\nChanges apply after you restart Spotify.";
+NSString *const SGRedesignedUIInfo = @"The newest version of spoti.pw, 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.";
void SGSetRedesignedUI(BOOL on) {
SGSetEnabled(SGKeyRedesign, on);
@@ -36,7 +36,7 @@ static void offerRestart(BOOL on) {
}
SGModSection *SGAppearanceSection(void) {
- SGModRow *redesign = SGOptionRow(@"Redesigned UI", @"The mod's own look in Liquid Glass, from a clean sheet", SGKeyRedesign);
+ SGModRow *redesign = SGOptionRow(@"Redesigned UI", nil, SGKeyRedesign);
redesign.glows = YES;
redesign.info = SGRedesignedUIInfo;
redesign.changed = ^(BOOL on) {
diff --git a/tweak/Sources/Settings/SGGlowSwitch.h b/tweak/Sources/Settings/SGGlowSwitch.h
index 0ab42093..6c3754a5 100644
--- a/tweak/Sources/Settings/SGGlowSwitch.h
+++ b/tweak/Sources/Settings/SGGlowSwitch.h
@@ -1,5 +1,5 @@
-// A switch that glows: a capsule whose rim turns into a slowly circling rainbow with a soft glow of the
-// same colours around it when on, and a plain dark rim when off, with a white knob sliding on a spring.
+// A switch that glows: a capsule whose rim is a slowly circling rainbow with a soft glow of the same
+// colours, full when on and softer when off, to invite the tap. A white knob slides on a spring.
// For the one switch of a page that changes the whole app (Redesigned UI in Appearance); every other
// switch stays a UISwitch.
//
diff --git a/tweak/Sources/Settings/SGGlowSwitch.m b/tweak/Sources/Settings/SGGlowSwitch.m
index b9479655..143a47b6 100644
--- a/tweak/Sources/Settings/SGGlowSwitch.m
+++ b/tweak/Sources/Settings/SGGlowSwitch.m
@@ -44,9 +44,9 @@ static CAShapeLayer *newStroke(CGFloat width) {
@implementation SGGlowSwitch {
CAShapeLayer *_track;
- CALayer *_rim, *_glow, *_glowShape;
- CAShapeLayer *_rimMask, *_glowMask;
- CAGradientLayer *_rimColors, *_glowColors;
+ CALayer *_rim, *_glow, *_glowShape, *_wash;
+ CAShapeLayer *_rimMask, *_glowMask, *_washMask;
+ CAGradientLayer *_rimColors, *_glowColors, *_washColors;
UIView *_knob;
UIImpactFeedbackGenerator *_haptic;
BOOL _pressed;
@@ -62,6 +62,14 @@ static CAShapeLayer *newStroke(CGFloat width) {
_track.lineWidth = 1;
[self.layer addSublayer:_track];
+ // The rainbow washed faintly over the inside of the track.
+ _wash = [CALayer layer];
+ _washMask = [CAShapeLayer layer];
+ _wash.mask = _washMask;
+ _washColors = newRainbow();
+ [_wash addSublayer:_washColors];
+ [self.layer addSublayer:_wash];
+
// The glow: the rainbow cut to a wide stroke, blurred as a whole, in a layer larger than the switch
// so the blur has room to spread.
_glow = [CALayer layer];
@@ -123,6 +131,10 @@ static CAShapeLayer *newStroke(CGFloat width) {
_rimMask.frame = bounds;
_rimMask.path = capsule.CGPath;
_rimColors.frame = square;
+ _wash.frame = bounds;
+ _washMask.frame = bounds;
+ _washMask.path = capsule.CGPath;
+ _washColors.frame = square;
_glow.frame = CGRectInset(bounds, -kGlowBleed, -kGlowBleed);
_glowShape.frame = _glow.bounds;
@@ -144,25 +156,26 @@ static CAShapeLayer *newStroke(CGFloat width) {
_knob.layer.cornerRadius = side / 2;
}
-// Colours for the state: a dark inset track and a faint rim when off, the rainbow rim and its glow on a
-// darker track when on.
+// Colours for the state. Off is meant to tempt: the rainbow already circles the rim, softer, with a
+// fainter glow. On it comes in full, glow and all.
- (void)paint {
BOOL on = self.on;
- BOOL glow = on && !UIAccessibilityIsReduceTransparencyEnabled();
- _track.fillColor = [UIColor colorWithWhite:on ? 0.08 : 0.2 alpha:1].CGColor;
- _track.strokeColor = [UIColor colorWithWhite:1 alpha:on ? 0 : 0.14].CGColor;
- _rim.opacity = on ? 1 : 0;
- _glow.opacity = glow ? 0.85 : 0;
+ BOOL glow = !UIAccessibilityIsReduceTransparencyEnabled();
+ _track.fillColor = [UIColor colorWithWhite:on ? 0.08 : 0.12 alpha:1].CGColor;
+ _track.strokeColor = UIColor.clearColor.CGColor;
+ _wash.opacity = on ? 0.3 : 0.16;
+ _rim.opacity = on ? 1 : 0.6;
+ _glow.opacity = glow ? (on ? 0.9 : 0.45) : 0;
_knob.alpha = self.enabled ? 1 : 0.5;
self.alpha = self.enabled ? 1 : 0.4;
self.accessibilityValue = on ? @"On" : @"Off";
- [self updateTurn];
+ [self updateMotion];
}
-- (void)updateTurn {
- BOOL turning = self.on && self.window && !UIAccessibilityIsReduceMotionEnabled();
- for (CAGradientLayer *colors in @[_rimColors, _glowColors]) {
- if (!turning) {
+- (void)updateMotion {
+ BOOL moving = self.window && !UIAccessibilityIsReduceMotionEnabled();
+ for (CAGradientLayer *colors in @[_rimColors, _glowColors, _washColors]) {
+ if (!moving) {
[colors removeAnimationForKey:kTurnKey];
continue;
}
@@ -177,12 +190,12 @@ static CAShapeLayer *newStroke(CGFloat width) {
}
}
-// The app going to the background drops layer animations; the rim starts again on the way back.
+// The app going to the background drops layer animations; they start again on the way back.
- (void)didMoveToWindow {
[super didMoveToWindow];
[NSNotificationCenter.defaultCenter removeObserver:self name:UIApplicationWillEnterForegroundNotification object:nil];
- if (self.window) [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(updateTurn) name:UIApplicationWillEnterForegroundNotification object:nil];
- [self updateTurn];
+ if (self.window) [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(updateMotion) name:UIApplicationWillEnterForegroundNotification object:nil];
+ [self updateMotion];
}
- (void)dealloc {