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: group Spotify's own Liquid Glass flags under one switch

Vojtěch Škopek89915f315e93
diff --git a/docs/tweaks.md b/docs/tweaks.md
index e5f18ead..990266de 100644
--- a/docs/tweaks.md
+++ b/docs/tweaks.md
@@ -36,8 +36,12 @@ Spotify built and did not ship) and Experimental, which holds AI Chat (Martini).
telemetry blocking with a count of what it has stopped; Navbar, the tab bar's own composition; and
All flags, Spotify's remote-config flags with a search field and an Auto / Off / On control per flag
(a text field for the number and text ones). A flag switch on a page forces that one flag and off
-leaves Spotify's own value, so the All flags page is where a flag goes back to Auto. A change shows
-after Spotify restarts.
+leaves Spotify's own value, so the All flags page is where a flag goes back to Auto. Spotify ships
+its newer design behind several flags at once, so UI Tweaks > Spotify's own Liquid Glass owns them
+(the glass navigation bar, the new player slider, the sheet style player, the queue and Connect
+sheets, the redesigned player header, the sleep timer's options sheet): while it is on it forces
+each of them, and their rows elsewhere show what it forces and take no touch, so the group has one
+switch. `SGGlassOwnsFlag` in SGCommon.m holds the list. A change shows after Spotify restarts.
Navbar is the exception and applies as soon as the bar lays out again. It lists the tabs in the order
the bar shows them: drag to reorder, tap to hide or show, and Add a tab puts a page of Spotify's or
diff --git a/tweak/src/SGCommon.h b/tweak/src/SGCommon.h
index a1522398..5fdb963d 100644
--- a/tweak/src/SGCommon.h
+++ b/tweak/src/SGCommon.h
@@ -112,6 +112,11 @@ extern NSString *const SGFlagOverridePrefix;
id SGFlagOverride(NSString *key);
void SGSetFlagOverride(NSString *key, id value);
+// Spotify ships its newer design behind several flags at once, so the Spotify's own Liquid Glass
+// switch owns them all: ui/Flags.x forces each one while it is on and ui/Settings.x locks their
+// rows, which is what keeps the switch and the rows from contradicting each other.
+BOOL SGGlassOwnsFlag(NSString *key);
+
// Declutter switches from ui/Settings.x, read by ui/Declutter.x; an unset switch is off.
#define SGHideShuffle @"spotifyglass.hide.shuffle"
#define SGHideRepeat @"spotifyglass.hide.repeat"
diff --git a/tweak/src/SGCommon.m b/tweak/src/SGCommon.m
index 2ce8ac04..d10e8a65 100644
--- a/tweak/src/SGCommon.m
+++ b/tweak/src/SGCommon.m
@@ -121,6 +121,24 @@ void SGSetFlagOverride(NSString *key, id value) {
else [NSUserDefaults.standardUserDefaults removeObjectForKey:key];
}
+BOOL SGGlassOwnsFlag(NSString *key) {
+ static NSSet<NSString *> *owned;
+ static dispatch_once_t once;
+ dispatch_once(&once, ^{
+ owned = [NSSet setWithArray:@[
+ @"ios-reprise-liquid-glass-properties.context_menu_in_navigation_bar_enabled",
+ @"ios-feature-encoreexperiments.new_npv_slider_enabled",
+ @"ios-feature-nowplaying.sheet_style_npv",
+ @"ios-feature-nowplaying.bottom_sheet_queue_enabled",
+ @"ios-feature-nowplaying.new_redesign_header_with_context_menu_enabled",
+ @"ios-feature-nowplaying-elements.enable_connect_bottom_sheet",
+ @"ios-playbackcontrol-audiovideoswitcher-impl.enable_connect_bottom_sheet",
+ @"ios-feature-sleeptimer.use_options_sheet",
+ ]];
+ });
+ return [owned containsObject:key];
+}
+
#pragma mark - view tree
void SGForEachView(UIView *view, void (^fn)(UIView *)) {
diff --git a/tweak/src/ui/Flags.x b/tweak/src/ui/Flags.x
index 74bcf7e5..4cdd7a47 100644
--- a/tweak/src/ui/Flags.x
+++ b/tweak/src/ui/Flags.x
@@ -1,13 +1,11 @@
// Spotify reads every remote-config flag once at startup through the configuration provider,
// keyed "component.property". An override from the Flags page wins; the Spotify's own Liquid
-// Glass switch then forces the glass navigation bar Spotify ships switched off.
+// Glass switch then forces the flags of Spotify's own newer design, which it ships switched off.
#import "SGCommon.h"
-static NSString *const kGlassKey = @"ios-reprise-liquid-glass-properties.context_menu_in_navigation_bar_enabled";
-
static id forced(NSString *key) {
id value = SGFlagOverride(key);
- if (!value && [key isEqualToString:kGlassKey] && SGEnabled(SGKeySpotifyGlass)) value = @YES;
+ if (!value && SGEnabled(SGKeySpotifyGlass) && SGGlassOwnsFlag(key)) value = @YES;
return value;
}
diff --git a/tweak/src/ui/Settings.x b/tweak/src/ui/Settings.x
index 43b1e15c..5f796548 100644
--- a/tweak/src/ui/Settings.x
+++ b/tweak/src/ui/Settings.x
@@ -223,6 +223,12 @@ static BOOL flagRowOn(SGModRow *row) {
return value && [value boolValue] != row.forceOff;
}
+// A flag the Spotify's own Liquid Glass switch owns: its row shows what that switch forces and
+// takes no touch, so the flag has one place to change. An override from All flags still wins.
+static BOOL flagRowLocked(SGModRow *row) {
+ return row.flag && SGGlassOwnsFlag(row.key) && SGEnabled(SGKeySpotifyGlass);
+}
+
static const CGFloat kSectionHeaderHeight = 38;
// Every page below draws Spotify's own list row: a 13pt white title over an 11pt grey subtitle,
@@ -367,7 +373,9 @@ static UITableViewCell *dequeue(UITableView *table, NSString *identifier) {
if (row.key) {
UISwitch *toggle = [UISwitch new];
toggle.onTintColor = green();
- toggle.on = row.flag ? flagRowOn(row) : SGFlag(row.key, row.defaultOn);
+ BOOL locked = flagRowLocked(row);
+ toggle.on = row.flag ? (locked && !SGFlagOverride(row.key) ? YES : flagRowOn(row)) : SGFlag(row.key, row.defaultOn);
+ toggle.enabled = !locked;
toggle.tag = path.section * 1000 + path.row;
[toggle addTarget:self action:@selector(toggled:) forControlEvents:UIControlEventValueChanged];
cell.accessoryView = toggle;
@@ -895,7 +903,7 @@ static UIViewController *uiTweaksPage(void) {
section(@"Liquid Glass", @[
switchRow(@"Tab bar", @"Glass pill behind the tabs, no labels", SGKeyTabBar),
switchRow(@"Search field", @"Glass capsule instead of the white field", SGKeySearchField),
- switchRow(@"Spotify's own Liquid Glass", @"Turns on the glass navigation bar Spotify ships switched off", SGKeySpotifyGlass),
+ switchRow(@"Spotify's own Liquid Glass", @"The glass navigation bar, the new player slider and the new sheets, all shipped switched off", SGKeySpotifyGlass),
]),
section(@"Theme", @[
switchRow(@"AMOLED background", @"Pure black instead of Spotify's dark grey", SGKeyAmoled),
@@ -1060,6 +1068,8 @@ static UIViewController *playbackPage(void) {
flagRow(@"Lyrics over Canvas", @"ios-feature-canvas.lyrics_on_canvas_enabled"),
flagRow(@"Mixing transitions", @"ios-feature-canvas.mixing_transition_enabled"),
flagRow(@"Picture in picture in the app", @"ios-feature-picture-in-picture.picture_in_picture_in_app"),
+ flagRow(@"Connect as a bottom sheet", @"ios-feature-nowplaying-elements.enable_connect_bottom_sheet"),
+ flagRow(@"Connect sheet from the video switcher", @"ios-playbackcontrol-audiovideoswitcher-impl.enable_connect_bottom_sheet"),
]),
section(@"Now playing bar", @[
flagRow(@"Hold and drag to resize", @"ios-feature-nowplayingbar.hold_and_drag_to_resize"),