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: sort Mod Settings by the part of Spotify each setting changes

Vojtěch Škopek0aaa171d6d75
diff --git a/docs/tweaks.md b/docs/tweaks.md
index f78499f0..bae4e39b 100644
--- a/docs/tweaks.md
+++ b/docs/tweaks.md
@@ -28,16 +28,17 @@ app:
<Feature>.h the keys of its switches, and the functions other files may call
<Something>.x the hooks, one file per screen or mechanism, each ending in its own %ctor
- <Feature>Settings.m its Mod Settings page, built from the rows in Settings/SGModPage.h
+ <Feature>Settings.m its Mod Settings page, or its sections on the page of the part it changes, built from
+ the rows in Settings/SGModPage.h
<Model>.m plain Objective-C the hooks and the page share, where there is any
NowPlaying/ the glass bar (NowPlayingBar.x), the full screen player (Player.x), the lyrics card and page (Lyrics.x)
Navbar/ the glass tab bar (TabBar.x) and its composition (Navbar.x, NavbarLayout.m), the Navbar and Add a tab pages
Home/ the Home gradient
- Playlist/ the playlist header and pills, hidden one switch each
- Declutter/ cards under the player and sections of Home collapsed, player buttons hidden; rows on the Now Playing and Home pages
+ Playlist/ the playlist header and pills, hidden one switch each; its sections sit on the Home & Library page
+ Declutter/ cards under the player and sections of Home collapsed, player buttons hidden; rows on the Player, Lyrics and Home & Library pages
Appearance/ AMOLED (Amoled.x), the glass search field (SearchField.x), the accent colour (Accent.x), and Repaint.x, which keeps stripped areas transparent
- Flags/ Spotify's remote-config flags: the provider hook, the generated table, the All flags page and the topic pages
+ Flags/ Spotify's remote-config flags: the provider hook, the generated table, the All flags page and the Labs page
Privacy/ telemetry blocking and its counters
AdBlock/ EeveeSpotify's ad blocking: the ad and upsell services silenced (AdServices.x), ad components out of the
Hub JSON (AdHubs.x) and the feeds (Feeds.m), Premium pop-ups dropped (AdPopups.x), and the responses
@@ -53,8 +54,8 @@ the Mod page removes by that prefix and has no list to keep up to date. It leave
which makes every unset switch read off, so a reset is stock Spotify whatever switches exist.
A hook reads its switch when it runs (`SGEnabled`, `SGHidden`, `SGFlag` from Core/SGPrefs.h), so a
-change shows after Spotify restarts; Navbar is the exception and applies as soon as the bar lays
-out again, as are the Home gradient's colour, strength and height, but not the switch that turns it on. The root page in `Settings/SGModSettings.x` lists every feature's page by hand.
+change shows after Spotify restarts; the tab editor on the Navbar page is the exception and applies as soon as the bar lays
+out again, as are the Home gradient's colour, strength and height, but not the switch that turns it on. The root page in `Settings/SGModSettings.x` holds the Appearance card and links the page of each part of Spotify by hand.
## Make targets
@@ -68,31 +69,35 @@ out again, as are the Home gradient's colour, strength and height, but not the s
## Mod Settings
-Mod Settings, the first row of the side drawer and the last row of Spotify's Settings, is three
-cards of pages, an icon and no description each, so the list
-reads as a list. Appearance (Navbar, the tab bar's own composition, as a page under it; then the
-glass tab bar, search field and Spotify's own glass, AMOLED and the accent colour), Home & Library
-(a Gradient page: the wash behind the top of Home in one of eight colours, at three strengths and
-four heights; then hide sections of the Home tab and Spotify's home and library flags), Playlist
-(hide the cover, the header's text and buttons, the curation pills) and Player (glass, Spotify's
-player flags, hide buttons and cards of the full screen player, then the queue, controls and now
-playing bar flags, the lock screen widget's, and a Lyrics page under it). Premium & ads (EeveeSpotify's
-three switches, off until switched on: spoof Premium, hide ads and hide upsells, with a count of what
-each stopped; an Ad and upsell flags page under it, every switch forcing a flag Spotify ships on to
-off: the ad on app open, upsells, tooltips, the DJ badge; then telemetry blocking with a count of
-what it has stopped) and Labs (features Spotify built and did not ship, and AI Chat
-(Martini) under it). Then 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), and Mod: the build
-and Spotify's version, the update check, the site and the repo, the welcome tour again and Reset
-all settings. 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. Spotify ships its newer design behind several
-flags at once, so Appearance > Liquid Glass UI 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
-Features/Flags/Flags.x 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
+Mod Settings, the first row of the side drawer and the last row of Spotify's Settings, sorts every
+setting by the part of Spotify it changes, so a part's glass, its hide switches and its flags sit on
+one page, the mod's own rows first and Spotify's flags below them or on a sub page named after what
+they change. It opens on the Appearance card, the three switches that style the whole app: Liquid
+Glass UI, AMOLED and the accent colour (Spotify's green is offered from the colour row once a colour
+is set). Then a card of parts. Navbar: the glass tab bar and search field, then the tab editor.
+Player: Gestures, Lyrics (Apple Music style, glass lyrics, hiding the lyrics card and preview, the
+lyrics flags), Blocked artists (with the count on the row) and Now playing bar (its glass, its device
+button and its flags) as pages; then the player screen (artwork background, glass header buttons,
+Disable Canvas and the sheet, header, slider and sticky header flags), the cards under the player and
+the player buttons to hide, and Queue & devices and Lock screen widget as flag pages. Home & Library:
+the Gradient page (the wash behind the top of Home in one of eight colours, at three strengths and
+four heights) and the Home flags, the parts of Home to hide including the DJ button and badge, the
+playlist header, buttons and pills to hide, and the Library flags. Then Premium, ads & privacy
+(EeveeSpotify's Hide ads and Hide upsells with an Ad and upsell flags page under them, every switch
+there forcing a flag Spotify ships on to off; Spoof Premium; Block telemetry; then what the ad
+blocking and the telemetry blocking have stopped) and Labs (features Spotify built and did not ship,
+AI Chat (Martini) first). Last, 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), and Mod: the update
+check, the build and Spotify's version, the site and the repo, the welcome tour again and Reset all
+settings. 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. Spotify ships its newer design behind several flags at
+once, so Liquid Glass UI 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 Features/Flags/Flags.x holds the list. A
+change shows after Spotify restarts.
+
+The tab editor on the Navbar page 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
any `spotify:` link on the bar with one of Encore's own glyphs. Spotify's own tabs are kept by the
name under their icon, so they can be hidden but never removed, and switching the app's language
@@ -108,7 +113,8 @@ never lights up as the tab you are on.
switch, use `SGGlassFor`/`SGGlassAt` + `SGShapeGlass` for glass and `SGStripBackgrounds` to clear
Spotify's paint, and end with `%ctor { %init; SGRequireClasses(@[...]); }`.
4. Add `<Feature>Settings.m` returning an `SGModPage` of `SGSection`s of `SGSwitchRow`/`SGHideRow`/
- `SGFlagRow` (Settings/SGModPage.h), and list it in `Settings/SGModSettings.x`.
+ `SGFlagRow` (Settings/SGModPage.h), and link it from the page of the part of Spotify it changes, or from
+ `Settings/SGModSettings.x` if it is a part of its own.
5. `make install`. Log lines are prefixed `[spotifyglass]`. A FLEX build serves the visible screen's
tree on the phone's port 8085, which `make trees` reaches over USB through iproxy.
diff --git a/tweak/Sources/Features/About/AboutSettings.m b/tweak/Sources/Features/About/AboutSettings.m
index f65f49e9..57bc9fbd 100644
--- a/tweak/Sources/Features/About/AboutSettings.m
+++ b/tweak/Sources/Features/About/AboutSettings.m
@@ -40,11 +40,11 @@ UIViewController *SGAboutPage(void) {
NSString *spotify = [NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"] ?: @"unknown";
return [[SGModPage alloc] initWithTitle:@"Mod" intro:nil sections:@[
SGSection(nil, @[
- SGStatRow(@"Version", ^NSString *{ return @(SG_VERSION); }),
- SGStatRow(@"Spotify", ^NSString *{ return spotify; }),
SGStatActionRow(@"Updates", @"Asks the site for the newest build; tap to check now", ^NSString *{
return SGUpdateStatus();
}, ^{ SGCheckForUpdate(YES); }),
+ SGStatRow(@"Version", ^NSString *{ return @(SG_VERSION); }),
+ SGStatRow(@"Spotify", ^NSString *{ return spotify; }),
]),
SGSection(nil, @[
withSymbol(SGLinkRow(@"Website", @"Features, and how to build it yourself", SGSiteURL), @"safari"),
diff --git a/tweak/Sources/Features/AdBlock/AdBlock.h b/tweak/Sources/Features/AdBlock/AdBlock.h
index 1a1d82b3..5ced12ae 100644
--- a/tweak/Sources/Features/AdBlock/AdBlock.h
+++ b/tweak/Sources/Features/AdBlock/AdBlock.h
@@ -1,4 +1,4 @@
-// EeveeSpotify's layers, ported, at the top of the Premium & ads page. Three switches, each off until asked for. Hide ads
+// EeveeSpotify's layers, ported, at the top of the Premium, ads & privacy page. Three switches, each off until asked for. Hide ads
// keeps the ad services from starting (AdServices.x), takes ad components out of Home and Search
// before they render (AdHubs.x, Feeds.m) and answers the requests behind them empty (AdNetwork.x).
// Hide upsells drops the Premium prompts (AdPopups.x, AdServices.x) and forces the flags that show
@@ -32,6 +32,5 @@ NSData *SGPatchBootstrap(NSData *body);
// were none, or the bytes were not the shape expected.
NSData *SGStripFeed(NSData *body);
-@class SGModSection;
-// The three switches and what they have stopped, at the top of the Premium & ads page.
-NSArray<SGModSection *> *SGAdBlockSections(void);
+// The Premium, ads & privacy page: these switches, the ad flags they lock, telemetry, the counters.
+UIViewController *SGAdsSettingsPage(void);
diff --git a/tweak/Sources/Features/AdBlock/AdBlockSettings.m b/tweak/Sources/Features/AdBlock/AdBlockSettings.m
index 187aa04e..da29a401 100644
--- a/tweak/Sources/Features/AdBlock/AdBlockSettings.m
+++ b/tweak/Sources/Features/AdBlock/AdBlockSettings.m
@@ -1,9 +1,42 @@
#import "Settings/SGModPage.h"
#import "AdBlock.h"
+#import "Features/Privacy/Privacy.h"
NSString *const SGFakePremiumWarning = @"This is the part of EeveeSpotify Spotify's takedown went after, and it has not been tested here. It can end in a forced logout or worse for the account. A Premium account gains nothing from it.";
-NSArray<SGModSection *> *SGAdBlockSections(void) {
+// Every switch here forces a flag Spotify ships on to off, so the titles name the blocking: on stops
+// the thing, off is Spotify's own value. Hide ads and Hide upsells already force the first two
+// sections off, which locks those rows.
+static UIViewController *adFlagsPage(void) {
+ return [[SGModPage alloc] initWithTitle:@"Ad and upsell flags" intro:SGRestartNote sections:@[
+ SGNotedSection(@"Ads", @[
+ SGKillRow(@"Block the ad when the app opens", @"ios-feature-adonappopen.enabled"),
+ SGKillRow(@"Block its CTA card", @"ios-feature-adonappopen.cta_card_enabled"),
+ ], @"Locked while Hide ads is on."),
+ SGNotedSection(@"Upsells", @[
+ SGKillRow(@"Hide the shuffle toggle upsell", @"ios-feature-shuffletoggleupsell.is_enabled_pt2"),
+ SGKillRow(@"Hide the shuffle upsell in the video player", @"ios-feature-nowplaying-modes.video_first_shuffle_upsell_enabled"),
+ ], @"Locked while Hide upsells is on."),
+ SGNotedSection(@"Reduce interventions", @[
+ SGFlagRow(@"Reduce interventions", @"ios-messaging-reduceinterventions-impl.enabled"),
+ ], @"Spotify's own system for in-app tips, which most of the tooltip switches below belong to."),
+ SGSection(@"Tooltips", @[
+ SGKillRow(@"Hide the smart shuffle helper", @"ios-messaging-reduceinterventions-impl.enable_message_smart_shuffle_helper_tooltip"),
+ SGKillRow(@"Hide the data saver tip", @"ios-feature-nowplayingbar.data_saver_tooltip"),
+ SGKillRow(@"Hide the player suggestions upsell", @"ios-messaging-reduceinterventions-impl.enable_message_reinvent_free_n_p_v_suggestions_upsell"),
+ SGKillRow(@"Hide the AI playlist creation tip", @"ios-messaging-reduceinterventions-impl.enable_message_your_library_ai_playlist_creation_tooltip"),
+ SGKillRow(@"Hide the watch feed explorer tip", @"ios-messaging-reduceinterventions-impl.enable_message_watch_feed_entity_explorer_tooltip"),
+ SGKillRow(@"Hide the account switching tip", @"ios-messaging-reduceinterventions-impl.enable_message_account_switching_tooltip"),
+ SGKillRow(@"Hide the concert notifications tip", @"ios-messaging-reduceinterventions-impl.enable_message_live_events_concert_notifications_tooltip"),
+ SGKillRow(@"Hide the live event tip", @"ios-messaging-reduceinterventions-impl.enable_message_live_events_event_entity_safe_tooltip"),
+ SGKillRow(@"Hide the live event venue tip", @"ios-messaging-reduceinterventions-impl.enable_message_live_events_event_entity_venuename_header_tooltip"),
+ SGKillRow(@"Hide the Puffin nudge", @"ios-messaging-reduceinterventions-impl.enable_message_puffin_nudge_end_optimization"),
+ ]),
+ ] footer:nil];
+}
+
+// The switches first and what they have stopped last, so the counters bury no setting.
+UIViewController *SGAdsSettingsPage(void) {
NSMutableArray<SGModRow *> *counts = [NSMutableArray array];
for (NSString *label in SGAdBlockLabels()) {
[counts addObject:SGStatRow(label, ^NSString *{
@@ -13,17 +46,22 @@ NSArray<SGModSection *> *SGAdBlockSections(void) {
[counts addObject:SGStatRow(@"Total", ^NSString *{
return @(SGAdBlockCount(nil)).stringValue;
})];
- SGModRow *fakePremium = SGOptionRow(@"Spoof Premium", @"Free accounts only. The product state and config the server sends are rewritten to a Premium account's, and the logout it sends back is answered as done", SGKeyFakePremium);
+ [counts addObject:SGActionRow(@"Reset the counters", @"Start counting from zero", ^{ SGResetAdBlock(); })];
+
+ SGModRow *fakePremium = SGOptionRow(@"Spoof Premium", @"The product state and config the server sends are rewritten to a Premium account's, and the logout it sends back is answered as done", SGKeyFakePremium);
fakePremium.warning = SGFakePremiumWarning;
- return @[
- SGSection(nil, @[
- fakePremium,
- SGOptionRow(@"Hide ads", @"The ad services never start, ad components leave Home and Search before they render, and the requests behind them are answered empty", SGKeyHideAds),
- SGOptionRow(@"Hide upsells", @"Premium prompts, banners and sheets dropped, and the flags that show them forced off", SGKeyHideUpsells),
- ]),
- SGSection(@"Blocked so far", counts),
- SGSection(nil, @[
- SGActionRow(@"Reset the counters", @"Start counting from zero", ^{ SGResetAdBlock(); }),
- ]),
- ];
+
+ return [[SGModPage alloc] initWithTitle:@"Premium, ads & privacy" intro:SGRestartNote sections:@[
+ SGNotedSection(@"Ads", @[
+ SGWithSymbol(SGOptionRow(@"Hide ads", @"The ad services never start, ad components leave Home and Search before they render, and the requests behind them are answered empty", SGKeyHideAds), @"speaker.slash"),
+ SGWithSymbol(SGOptionRow(@"Hide upsells", @"Premium prompts, banners and sheets dropped, and the flags that show them forced off", SGKeyHideUpsells), @"hand.raised"),
+ SGWithSymbol(SGPageRow(@"Ad and upsell flags", ^UIViewController *{ return adFlagsPage(); }), @"flag"),
+ ], @"From EeveeSpotify, off until switched on. They reach only what is drawn; audio ads between songs are Spoof Premium's to stop."),
+ SGNotedSection(@"Premium", @[
+ SGWithSymbol(fakePremium, @"crown"),
+ ], @"Free accounts only; a Premium account gains nothing from it."),
+ SGPrivacySection(),
+ SGSection(@"Ads blocked so far", counts),
+ SGPrivacyCountersSection(),
+ ] footer:nil];
}
diff --git a/tweak/Sources/Features/Appearance/Appearance.h b/tweak/Sources/Features/Appearance/Appearance.h
index 12b87751..95e51735 100644
--- a/tweak/Sources/Features/Appearance/Appearance.h
+++ b/tweak/Sources/Features/Appearance/Appearance.h
@@ -14,7 +14,8 @@ void SGPickAccent(void); // the system colour picker over the top of the
// Liquid Glass UI, the one switch of Appearance that sets others: Spotify's own glass and, with
// it, the tab bar, the search field, the now playing bar, the artwork background and the lyrics card. Each
-// stays a switch of its own afterwards.
+// stays a switch of its own afterwards, on the page of the part it styles.
void SGSetLiquidGlassUI(BOOL on);
-UIViewController *SGAppearanceSettingsPage(void);
+@class SGModSection;
+SGModSection *SGAppearanceSection(void); // the Appearance card at the top of Mod Settings
diff --git a/tweak/Sources/Features/Appearance/AppearanceSettings.m b/tweak/Sources/Features/Appearance/AppearanceSettings.m
index f613aa78..a5248416 100644
--- a/tweak/Sources/Features/Appearance/AppearanceSettings.m
+++ b/tweak/Sources/Features/Appearance/AppearanceSettings.m
@@ -1,5 +1,6 @@
#import "Core/SGCore.h"
#import "Settings/SGModPage.h"
+#import "Settings/SGPageStyle.h"
#import "Appearance.h"
#import "Features/Navbar/Navbar.h"
#import "Features/Flags/Flags.h"
@@ -11,22 +12,30 @@ void SGSetLiquidGlassUI(BOOL on) {
}
}
-UIViewController *SGAppearanceSettingsPage(void) {
- SGModRow *glass = SGOptionRow(@"Liquid Glass UI", @"Spotify's own glass navigation bar, slider and sheets, and with it the tab bar, search field, now playing bar, artwork background and lyrics", SGKeySpotifyGlass);
+// Going back to Spotify's green is offered only once a colour of the mod's is set, so a stray tap
+// cannot wipe it.
+static void chooseAccent(void) {
+ if (!SGAccentColor()) {
+ SGPickAccent();
+ return;
+ }
+ UIViewController *top = SGTopController();
+ UIAlertController *sheet = [UIAlertController alertControllerWithTitle:@"Accent colour" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
+ [sheet addAction:[UIAlertAction actionWithTitle:@"Pick a colour" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { SGPickAccent(); }]];
+ [sheet addAction:[UIAlertAction actionWithTitle:@"Spotify's green" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) { SGSetInt(SGKeyAccent, -1); }]];
+ [sheet addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]];
+ sheet.popoverPresentationController.sourceView = top.view;
+ sheet.popoverPresentationController.sourceRect = CGRectMake(CGRectGetMidX(top.view.bounds), CGRectGetMidY(top.view.bounds), 0, 0);
+ sheet.popoverPresentationController.permittedArrowDirections = 0;
+ [top presentViewController:sheet animated:YES completion:nil];
+}
+
+SGModSection *SGAppearanceSection(void) {
+ SGModRow *glass = SGOptionRow(@"Liquid Glass UI", @"Spotify's own glass bars, slider and sheets, and every glass switch of the mod's with it", SGKeySpotifyGlass);
glass.changed = ^(BOOL on) { SGSetLiquidGlassUI(on); };
- return [[SGModPage alloc] initWithTitle:@"Appearance" intro:SGRestartNote sections:@[
- SGSection(nil, @[
- SGPageRow(@"Navbar", ^UIViewController *{ return SGNavbarSettingsPage(); }),
- ]),
- SGSection(@"Liquid Glass", @[
- SGOptionRow(@"Tab bar", @"The system glass tab bar in place of Spotify's", SGKeyTabBar),
- SGOptionRow(@"Search field", @"Glass capsule instead of the white field", SGKeySearchField),
- glass,
- ]),
- SGSection(@"Theme", @[
- SGOptionRow(@"AMOLED background", @"Pure black instead of Spotify's dark grey", SGKeyAmoled),
- SGStatActionRow(@"Accent colour", @"In place of Spotify's green, everywhere it is drawn; tap to pick", ^NSString *{ return SGAccentLabel(); }, ^{ SGPickAccent(); }),
- SGActionRow(@"Spotify's green", @"Back to the colour the app came with", ^{ SGSetInt(SGKeyAccent, -1); }),
- ]),
- ] footer:nil];
+ return SGNotedSection(@"Appearance", @[
+ SGWithSymbol(glass, @"drop"),
+ SGWithSymbol(SGOptionRow(@"AMOLED background", @"Pure black instead of Spotify's dark grey", SGKeyAmoled), @"moon"),
+ SGWithSymbol(SGStatActionRow(@"Accent colour", @"In place of Spotify's green, everywhere it is drawn", ^NSString *{ return SGAccentLabel(); }, ^{ chooseAccent(); }), @"paintpalette"),
+ ], @"Liquid Glass UI turns every glass switch of the mod's on or off with it. Changes apply after you restart Spotify.");
}
diff --git a/tweak/Sources/Features/ArtistBlock/ArtistBlockSettings.m b/tweak/Sources/Features/ArtistBlock/ArtistBlockSettings.m
index a723aaa2..f15ffb71 100644
--- a/tweak/Sources/Features/ArtistBlock/ArtistBlockSettings.m
+++ b/tweak/Sources/Features/ArtistBlock/ArtistBlockSettings.m
@@ -55,7 +55,7 @@ typedef NS_ENUM(NSInteger, SGArtistSection) {
}
- (CGFloat)tableView:(UITableView *)table heightForHeaderInSection:(NSInteger)section {
- return section == SGArtistSectionMode || section == SGArtistSectionList ? SGSectionHeaderHeight : CGFLOAT_MIN;
+ return section == SGArtistSectionMode || section == SGArtistSectionList ? SGSectionHeaderHeight : SGSectionGap;
}
- (CGFloat)tableView:(UITableView *)table heightForFooterInSection:(NSInteger)section {
diff --git a/tweak/Sources/Features/Declutter/Declutter.h b/tweak/Sources/Features/Declutter/Declutter.h
index f8658409..c43e7f25 100644
--- a/tweak/Sources/Features/Declutter/Declutter.h
+++ b/tweak/Sources/Features/Declutter/Declutter.h
@@ -1,5 +1,5 @@
// Declutter: cards under the player and sections of Home collapsed, player buttons hidden, one
-// switch each (Declutter.x). The rows live on the Now Playing and Home pages. An unset switch is off.
+// switch each (Declutter.x). The rows live on the Player, Lyrics and Home & Library pages. An unset switch is off.
#import <Foundation/Foundation.h>
#define SGHideShuffle @"spotifyglass.hide.shuffle"
diff --git a/tweak/Sources/Features/Flags/FlagPages.m b/tweak/Sources/Features/Flags/FlagPages.m
index c3356a7a..c81ad699 100644
--- a/tweak/Sources/Features/Flags/FlagPages.m
+++ b/tweak/Sources/Features/Flags/FlagPages.m
@@ -1,86 +1,6 @@
-// Pages that list Spotify's flags by topic; every row forces one flag.
+// Labs: Spotify's flags for features it built and did not ship; every row forces one flag.
#import "Settings/SGModPage.h"
#import "Flags.h"
-#import "Features/AdBlock/AdBlock.h"
-#import "Features/Privacy/Privacy.h"
-
-SGModSection *SGLockScreenSection(void) {
- return SGSection(@"Lock screen widget", @[
- SGFlagRow(@"Like and dislike buttons", @"ios-feature-lockscreen.like_dislike_enabled"),
- SGFlagRow(@"Animated artwork", @"ios-feature-lockscreen.animated_artwork_enabled"),
- SGFlagRow(@"Video artwork", @"ios-feature-lockscreen.vit_artwork_enabled"),
- SGFlagRow(@"Companion content", @"ios-feature-lockscreen.companion_content_enabled"),
- SGFlagRow(@"Burst skip", @"ios-feature-lockscreen.burst_skip_enabled"),
- SGFlagRow(@"Chapter skip controls", @"ios-feature-lockscreen.enable_chapter_skip_controls"),
- SGFlagRow(@"Skip button on podcasts", @"ios-feature-lockscreen.skip_button_on_podcasts"),
- ]);
-}
-
-NSArray<SGModSection *> *SGPlaybackSections(void) {
- return @[
- SGSection(@"Queue", @[
- SGFlagRow(@"Play next in the context menu", @"ios-feature-queue.is_play_next_context_menu_enabled"),
- ]),
- SGSection(@"Controls", @[
- SGFlagRow(@"New progress slider", @"ios-feature-encoreexperiments.new_npv_slider_enabled"),
- SGFlagRow(@"Connect as a bottom sheet", @"ios-feature-nowplaying-elements.enable_connect_bottom_sheet"),
- SGFlagRow(@"Connect sheet from the video switcher", @"ios-playbackcontrol-audiovideoswitcher-impl.enable_connect_bottom_sheet"),
- ]),
- SGSection(@"Now playing bar", @[
- SGFlagRow(@"Hold and drag to resize", @"ios-feature-nowplayingbar.hold_and_drag_to_resize"),
- SGFlagRow(@"Save button", @"ios-feature-nowplayingbar.add_button"),
- SGFlagRow(@"Queue badge", @"ios-feature-nowplayingbar.queue_badge"),
- SGFlagRow(@"Two lines of track info", @"ios-feature-nowplayingbar.two_lines_information_unit"),
- ]),
- ];
-}
-
-// Every switch here forces a flag Spotify ships on to off, so the titles name the blocking: on stops
-// the thing, off is Spotify's own value. Hide ads and Hide upsells already force the first two
-// sections off, which locks those rows.
-static UIViewController *adFlagsPage(void) {
- return [[SGModPage alloc] initWithTitle:@"Ad and upsell flags" intro:SGRestartNote sections:@[
- SGSection(@"Ads", @[
- SGKillRow(@"Block the ad when the app opens", @"ios-feature-adonappopen.enabled"),
- SGKillRow(@"Block its CTA card", @"ios-feature-adonappopen.cta_card_enabled"),
- ]),
- SGSection(@"Upsells", @[
- SGKillRow(@"Hide the shuffle toggle upsell", @"ios-feature-shuffletoggleupsell.is_enabled_pt2"),
- SGKillRow(@"Hide the shuffle upsell in the video player", @"ios-feature-nowplaying-modes.video_first_shuffle_upsell_enabled"),
- ]),
- SGSection(@"Badges", @[
- SGKillRow(@"Hide the DJ beta badge", @"ios-home-evopage-impl.dj_mdc_beta_badge_enabled"),
- SGKillRow(@"Hide the DJ button on Home", @"ios-home-evopage-impl.idj_show_dj_button"),
- ]),
- SGSection(@"Tooltips", @[
- SGKillRow(@"Hide the data saver tip", @"ios-feature-nowplayingbar.data_saver_tooltip"),
- SGKillRow(@"Hide the smart shuffle helper", @"ios-messaging-reduceinterventions-impl.enable_message_smart_shuffle_helper_tooltip"),
- SGKillRow(@"Hide the watch feed explorer tip", @"ios-messaging-reduceinterventions-impl.enable_message_watch_feed_entity_explorer_tooltip"),
- SGKillRow(@"Hide the AI playlist creation tip", @"ios-messaging-reduceinterventions-impl.enable_message_your_library_ai_playlist_creation_tooltip"),
- SGKillRow(@"Hide the account switching tip", @"ios-messaging-reduceinterventions-impl.enable_message_account_switching_tooltip"),
- SGKillRow(@"Hide the concert notifications tip", @"ios-messaging-reduceinterventions-impl.enable_message_live_events_concert_notifications_tooltip"),
- SGKillRow(@"Hide the live event tip", @"ios-messaging-reduceinterventions-impl.enable_message_live_events_event_entity_safe_tooltip"),
- SGKillRow(@"Hide the live event venue tip", @"ios-messaging-reduceinterventions-impl.enable_message_live_events_event_entity_venuename_header_tooltip"),
- SGKillRow(@"Hide the player suggestions upsell", @"ios-messaging-reduceinterventions-impl.enable_message_reinvent_free_n_p_v_suggestions_upsell"),
- SGKillRow(@"Hide the Puffin nudge", @"ios-messaging-reduceinterventions-impl.enable_message_puffin_nudge_end_optimization"),
- ]),
- SGSection(nil, @[
- SGFlagRow(@"Reduce interventions", @"ios-messaging-reduceinterventions-impl.enabled"),
- ]),
- ] footer:@"The tooltip switches belong to Spotify's own intervention-reduction system, which Reduce interventions turns on."];
-}
-
-// The switches first, the flags they already cover behind a page of their own: turning Hide ads on
-// is what most of this page is for, and every row under it follows from that one.
-UIViewController *SGAdsSettingsPage(void) {
- NSMutableArray<SGModSection *> *sections = [NSMutableArray arrayWithArray:SGAdBlockSections()];
- [sections addObject:SGSection(nil, @[
- SGPageRow(@"Ad and upsell flags", ^UIViewController *{ return adFlagsPage(); }),
- ])];
- [sections addObjectsFromArray:SGPrivacySections()];
- return [[SGModPage alloc] initWithTitle:@"Premium & ads" intro:SGRestartNote sections:sections
- footer:@"The three switches come from EeveeSpotify and are off until switched on; none is needed on a Premium account, which has no ads to block. Audio ads between songs are Spoof Premium's to stop, the other two only reach what is drawn."];
-}
static UIViewController *martiniPage(void) {
return [[SGModPage alloc] initWithTitle:@"AI Chat (Martini)" intro:SGRestartNote sections:@[
@@ -102,9 +22,22 @@ static UIViewController *martiniPage(void) {
] footer:nil];
}
-// Features Spotify built and did not ship, and the AI chat behind more flags than fit here.
UIViewController *SGLabsPage(void) {
- return [[SGModPage alloc] initWithTitle:@"Labs" intro:SGRestartNote sections:@[
+ return [[SGModPage alloc] initWithTitle:@"Labs" intro:@"Features Spotify built and has not released. They may do nothing on your version. Changes apply after you restart Spotify." sections:@[
+ SGSection(nil, @[
+ SGWithSymbol(SGPageRow(@"AI Chat (Martini)", ^UIViewController *{ return martiniPage(); }), @"bubble.left.and.bubble.right"),
+ ]),
+ SGSection(@"Library", @[
+ SGFlagRow(@"Local files from the Files app", @"ios-feature-localfiles.documents_enabled"),
+ ]),
+ SGSection(@"Home screen widget", @[
+ SGFlagRow(@"Progress bar", @"ios-widgets-widgetremoteconfig-impl.progress_bar_enabled"),
+ ]),
+ SGNotedSection(@"Sleep timer", @[
+ SGFlagRow(@"Fade out", @"ios-feature-sleeptimer.enable_fade_out"),
+ SGFlagRow(@"One minute option", @"ios-feature-sleeptimer.enable_one_minute_option"),
+ SGFlagRow(@"Options sheet", @"ios-feature-sleeptimer.use_options_sheet"),
+ ], @"The options sheet is locked on while Liquid Glass UI is on."),
SGSection(@"Player", @[
SGFlagRow(@"Snake on the cover art", @"ios-feature-cover-art-snake.enabled"),
]),
@@ -113,17 +46,5 @@ UIViewController *SGLabsPage(void) {
SGFlagRow(@"Pinned comments", @"ios-feature-comments.enable_pinned_comments"),
SGFlagRow(@"Several reactions", @"ios-feature-comments.enable_multi_reactions"),
]),
- SGSection(@"Sleep timer", @[
- SGFlagRow(@"Fade out", @"ios-feature-sleeptimer.enable_fade_out"),
- SGFlagRow(@"One minute option", @"ios-feature-sleeptimer.enable_one_minute_option"),
- SGFlagRow(@"Options sheet", @"ios-feature-sleeptimer.use_options_sheet"),
- ]),
- SGSection(@"Elsewhere", @[
- SGFlagRow(@"Local files from the Files app", @"ios-feature-localfiles.documents_enabled"),
- SGFlagRow(@"Progress bar in the home screen widget", @"ios-widgets-widgetremoteconfig-impl.progress_bar_enabled"),
- ]),
- SGSection(nil, @[
- SGPageRow(@"AI Chat (Martini)", ^UIViewController *{ return martiniPage(); }),
- ]),
] footer:nil];
}
diff --git a/tweak/Sources/Features/Flags/Flags.h b/tweak/Sources/Features/Flags/Flags.h
index 108935e6..2ebf5dad 100644
--- a/tweak/Sources/Features/Flags/Flags.h
+++ b/tweak/Sources/Features/Flags/Flags.h
@@ -1,7 +1,7 @@
// Flags: Spotify's remote-config flags. Flags.x forces an override into the configuration
// provider; SGFlagList.m is the table of every flag, generated from the IPA by
-// scripts/extract-flags.py; FlagsPage.m is the searchable All flags page and FlagPages.m the flags
-// by topic: the Premium & ads and Labs pages, and the playback and lock screen sections of Player.
+// scripts/extract-flags.py; FlagsPage.m is the searchable All flags page and FlagPages.m the Labs
+// page. Flags that change a part of the app sit on that part's own page.
#import <UIKit/UIKit.h>
// Spotify ships its newer design behind several flags at once, so this switch owns them all:
@@ -15,9 +15,5 @@ typedef struct { const char *key; SGFlagType type; long value, lower, upper; } S
extern const SGFlagDef SGFlagTable[];
extern const NSUInteger SGFlagCount;
-@class SGModSection;
UIViewController *SGAllFlagsPage(void);
-UIViewController *SGAdsSettingsPage(void);
UIViewController *SGLabsPage(void);
-NSArray<SGModSection *> *SGPlaybackSections(void);
-SGModSection *SGLockScreenSection(void);
diff --git a/tweak/Sources/Features/Gestures/GesturesSettings.m b/tweak/Sources/Features/Gestures/GesturesSettings.m
index 7c75d131..5950c93e 100644
--- a/tweak/Sources/Features/Gestures/GesturesSettings.m
+++ b/tweak/Sources/Features/Gestures/GesturesSettings.m
@@ -180,7 +180,7 @@ static NSString *cellLabel(SGGestureAction action) {
}
- (CGFloat)tableView:(UITableView *)table heightForHeaderInSection:(NSInteger)section {
- return section == 1 || section == 2 ? SGSectionHeaderHeight : CGFLOAT_MIN;
+ return section == 1 || section == 2 ? SGSectionHeaderHeight : SGSectionGap;
}
- (CGFloat)tableView:(UITableView *)table heightForFooterInSection:(NSInteger)section {
diff --git a/tweak/Sources/Features/Home/HomeSettings.m b/tweak/Sources/Features/Home/HomeSettings.m
index 62e84c4c..95896bd8 100644
--- a/tweak/Sources/Features/Home/HomeSettings.m
+++ b/tweak/Sources/Features/Home/HomeSettings.m
@@ -2,6 +2,7 @@
#import "Settings/SGModPage.h"
#import "Home.h"
#import "Features/Declutter/Declutter.h"
+#import "Features/Playlist/Playlist.h"
static SGModRow *choiceRow(NSString *title, NSString *subtitle, SGHomeChoice choice) {
return SGChoiceRow(title, subtitle, SGHomeChoiceKey(choice), SGHomeChoiceNames(choice),
@@ -29,28 +30,37 @@ UIViewController *SGHomeSettingsPage(void) {
return SGHomeChoiceNames(SGHomeChoiceTint)[(NSUInteger)SGHomeChoiceValue(SGHomeChoiceTint)];
};
- return [[SGModPage alloc] initWithTitle:@"Home & Library" intro:SGRestartNote sections:@[
- SGSection(@"Background", @[gradient]),
- SGSection(@"Hide", @[
+ SGModRow *djButton = SGKillRow(@"DJ button", @"ios-home-evopage-impl.idj_show_dj_button");
+ djButton.subtitle = @"The DJ button on Home";
+ SGModRow *djBadge = SGKillRow(@"DJ beta badge", @"ios-home-evopage-impl.dj_mdc_beta_badge_enabled");
+ djBadge.subtitle = @"The beta badge on the DJ";
+
+ NSMutableArray<SGModSection *> *sections = [NSMutableArray arrayWithArray:@[
+ SGSection(@"Home", @[
+ SGWithSymbol(gradient, @"rectangle.tophalf.inset.filled"),
+ SGFlagRow(@"Pull to refresh", @"ios-home-evopage-impl.pull_to_refresh_enabled"),
+ SGFlagRow(@"Hide items from Shortcuts", @"ios-system-home-hidefromhome.is_hide_from_shortcuts_enabled"),
+ SGFlagRow(@"Hide items from Recents", @"ios-system-home-hidefromhome.is_hide_from_recents_enabled"),
+ ]),
+ SGSection(@"Hide on Home", @[
SGHideRow(@"Filter pills", @"Music and Podcasts next to your avatar", SGHideHomePills),
SGHideRow(@"Shortcuts grid", @"The tiles at the top", SGHideHomeShortcuts),
SGHideRow(@"Promo cards", @"Single cards such as the next episode of a podcast", SGHideHomePromo),
SGHideRow(@"Preview cards", @"Album, playlist and video previews with a play button", SGHideHomePreviews),
SGHideRow(@"DJ card", @"Your own personal DJ", SGHideHomeDJ),
+ djButton,
+ djBadge,
]),
- SGSection(@"Spotify's flags", @[
- SGFlagRow(@"Pull to refresh", @"ios-home-evopage-impl.pull_to_refresh_enabled"),
- SGFlagRow(@"Hide items from Recents", @"ios-system-home-hidefromhome.is_hide_from_recents_enabled"),
- SGFlagRow(@"Hide items from Shortcuts", @"ios-system-home-hidefromhome.is_hide_from_shortcuts_enabled"),
- ]),
- SGSection(@"Library", @[
- SGFlagRow(@"Denser rows", @"ios-feature-yourlibaryx.denser_rows_enabled"),
- SGFlagRow(@"Recents", @"ios-feature-yourlibaryx.recents_enabled"),
- SGFlagRow(@"Recents sort order", @"ios-feature-yourlibaryx.recents_sort_order_enabled"),
- SGFlagRow(@"Sort playlists by recently updated", @"ios-feature-yourlibaryx.recently_updated_playlists_sort_enabled"),
- SGFlagRow(@"Sort artists by recently updated", @"ios-feature-yourlibaryx.recently_updated_artists_sort_enabled"),
- SGFlagRow(@"Library settings", @"ios-feature-yourlibaryx.library_settings_enabled"),
- SGFlagRow(@"Library Pro", @"ios-feature-yourlibaryx.your_library_pro_enabled"),
- ]),
- ] footer:nil];
+ ]];
+ [sections addObjectsFromArray:SGPlaylistSections()];
+ [sections addObject:SGNotedSection(@"Library", @[
+ SGFlagRow(@"Denser rows", @"ios-feature-yourlibaryx.denser_rows_enabled"),
+ SGFlagRow(@"Sort playlists by recently updated", @"ios-feature-yourlibaryx.recently_updated_playlists_sort_enabled"),
+ SGFlagRow(@"Sort artists by recently updated", @"ios-feature-yourlibaryx.recently_updated_artists_sort_enabled"),
+ SGFlagRow(@"Recents", @"ios-feature-yourlibaryx.recents_enabled"),
+ SGFlagRow(@"Recents sort order", @"ios-feature-yourlibaryx.recents_sort_order_enabled"),
+ SGFlagRow(@"Library settings", @"ios-feature-yourlibaryx.library_settings_enabled"),
+ SGFlagRow(@"Library Pro", @"ios-feature-yourlibaryx.your_library_pro_enabled"),
+ ], @"Spotify's own Library options, some of them only rolled out to some accounts.")];
+ return [[SGModPage alloc] initWithTitle:@"Home & Library" intro:@"Changes apply after you restart Spotify. The gradient's colour, strength and height apply straight away." sections:sections footer:nil];
}
diff --git a/tweak/Sources/Features/Navbar/Navbar.h b/tweak/Sources/Features/Navbar/Navbar.h
index 7e9dd30b..07377ab5 100644
--- a/tweak/Sources/Features/Navbar/Navbar.h
+++ b/tweak/Sources/Features/Navbar/Navbar.h
@@ -23,4 +23,5 @@ void SGLogTabBarRow(UIView *tabBar);
// Lays the bar out again after the Navbar page changes something, so it does not wait for a touch.
void SGRefreshTabBar(void);
-UIViewController *SGNavbarSettingsPage(void);
+UIViewController *SGNavbarSettingsPage(void); // the glass switches of the bar, then the tab editor
+UIViewController *SGNavbarEditorPage(void); // the tab editor alone, for the welcome tour
diff --git a/tweak/Sources/Features/Navbar/NavbarSettings.m b/tweak/Sources/Features/Navbar/NavbarSettings.m
index 0ecc9684..17e2cb69 100644
--- a/tweak/Sources/Features/Navbar/NavbarSettings.m
+++ b/tweak/Sources/Features/Navbar/NavbarSettings.m
@@ -2,6 +2,7 @@
#import "Settings/SGPage.h"
#import "Settings/SGPageStyle.h"
#import "Navbar.h"
+#import "Features/Appearance/Appearance.h"
// What "Add a tab" offers: URIs Spotify's own router resolves to a page of its own, each with the
// name of the SPTEncoreIcon class method that draws its glyph.
@@ -152,19 +153,39 @@ static void appendTab(NSDictionary *tab) {
@end
+typedef NS_ENUM(NSInteger, SGNavbarSection) {
+ SGNavbarSectionGlass,
+ SGNavbarSectionSwitch,
+ SGNavbarSectionTabs,
+ SGNavbarSectionAdd,
+ SGNavbarSectionReset,
+ SGNavbarSectionCount,
+};
+
+static NSArray<NSArray<NSString *> *> *glassRows(void) {
+ return @[
+ @[@"Glass tab bar", @"The system glass tab bar in place of Spotify's", SGKeyTabBar],
+ @[@"Glass search field", @"A glass capsule instead of the white field on Search", SGKeySearchField],
+ ];
+}
+
// The tabs, in the order the bar shows them: drag to reorder, tap to show or hide, swipe a tab of
-// your own away. Spotify's own tabs can only be hidden, never removed.
+// your own away. Spotify's own tabs can only be hidden, never removed. In Mod Settings the glass
+// switches of the bar sit above them; the welcome tour embeds the editor without.
@interface SGNavbarPage : SGPage
+- (instancetype)initWithGlass:(BOOL)glass;
@end
@implementation SGNavbarPage {
NSMutableArray<NSMutableDictionary *> *_entries;
UIView *_intro;
+ BOOL _glass;
}
-- (instancetype)init {
+- (instancetype)initWithGlass:(BOOL)glass {
if (!(self = [super initWithStyle:UITableViewStyleInsetGrouped])) return nil;
self.title = @"Navbar";
+ _glass = glass;
return self;
}
@@ -172,7 +193,8 @@ static void appendTab(NSDictionary *tab) {
[super viewDidLoad];
self.tableView.allowsSelectionDuringEditing = YES;
self.tableView.editing = YES;
- _intro = SGNote(@"Drag a tab by the handle to move it, tap it to show or hide it. The bar follows straight away.");
+ _intro = SGNote(_glass ? @"Drag a tab by the handle to move it, tap it to show or hide it. The bar follows straight away; the glass switches apply after you restart Spotify."
+ : @"Drag a tab by the handle to move it, tap it to show or hide it. The bar follows straight away.");
self.tableView.tableHeaderView = _intro;
_entries = navbarEntries();
}
@@ -200,19 +222,29 @@ static void appendTab(NSDictionary *tab) {
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)table {
- return 4;
+ return SGNavbarSectionCount;
}
- (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section {
- return section == 1 ? (NSInteger)_entries.count : 1;
+ if (section == SGNavbarSectionGlass) return _glass ? (NSInteger)glassRows().count : 0;
+ return section == SGNavbarSectionTabs ? (NSInteger)_entries.count : 1;
+}
+
+- (NSString *)headerFor:(NSInteger)section {
+ if (section == SGNavbarSectionGlass && _glass) return @"Liquid Glass";
+ if (section == SGNavbarSectionSwitch && _glass) return @"Tabs";
+ if (section == SGNavbarSectionTabs && !_glass) return @"Tabs";
+ return nil;
}
- (UIView *)tableView:(UITableView *)table viewForHeaderInSection:(NSInteger)section {
- return section == 1 ? SGSectionHeader(table, @"Tabs") : nil;
+ NSString *title = [self headerFor:section];
+ return title ? SGSectionHeader(table, title) : nil;
}
- (CGFloat)tableView:(UITableView *)table heightForHeaderInSection:(NSInteger)section {
- return section == 1 ? SGSectionHeaderHeight : CGFLOAT_MIN;
+ if ([self headerFor:section]) return SGSectionHeaderHeight;
+ return [self tableView:table numberOfRowsInSection:section] ? SGSectionGap : CGFLOAT_MIN;
}
- (CGFloat)tableView:(UITableView *)table heightForFooterInSection:(NSInteger)section {
@@ -222,7 +254,18 @@ static void appendTab(NSDictionary *tab) {
- (UITableViewCell *)tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)path {
UITableViewCell *cell = SGDequeueCell(table, @"navbar");
switch (path.section) {
- case 0: {
+ case SGNavbarSectionGlass: {
+ NSArray<NSString *> *row = glassRows()[(NSUInteger)path.row];
+ SGFillCell(cell, row[0], row[1], nil, nil);
+ UISwitch *toggle = [UISwitch new];
+ toggle.onTintColor = SGGreen();
+ toggle.on = SGFlag(row[2], NO);
+ toggle.tag = path.row;
+ [toggle addTarget:self action:@selector(glassToggled:) forControlEvents:UIControlEventValueChanged];
+ cell.accessoryView = toggle;
+ break;
+ }
+ case SGNavbarSectionSwitch: {
SGFillCell(cell, @"Custom navbar", @"Off leaves the bar exactly as Spotify built it", nil, nil);
UISwitch *toggle = [UISwitch new];
toggle.onTintColor = SGGreen();
@@ -231,7 +274,7 @@ static void appendTab(NSDictionary *tab) {
cell.accessoryView = toggle;
break;
}
- case 1: {
+ case SGNavbarSectionTabs: {
NSDictionary *entry = _entries[(NSUInteger)path.row];
BOOL hidden = [entry[SGNavbarHidden] boolValue];
NSString *uri = entry[SGNavbarURI];
@@ -239,7 +282,7 @@ static void appendTab(NSDictionary *tab) {
hidden ? SGGrey() : nil, hidden ? @"eye.slash" : @"eye");
break;
}
- case 2:
+ case SGNavbarSectionAdd:
SGFillCell(cell, @"Add a tab…", @"A page of Spotify's, or any link", nil, @"plus");
cell.selectionStyle = UITableViewCellSelectionStyleDefault;
break;
@@ -252,21 +295,21 @@ static void appendTab(NSDictionary *tab) {
}
- (BOOL)tableView:(UITableView *)table canMoveRowAtIndexPath:(NSIndexPath *)path {
- return path.section == 1;
+ return path.section == SGNavbarSectionTabs;
}
- (BOOL)tableView:(UITableView *)table canEditRowAtIndexPath:(NSIndexPath *)path {
- return path.section == 1;
+ return path.section == SGNavbarSectionTabs;
}
// Spotify's own tabs stay on the list to be switched back on; only the mod's own can go.
- (UITableViewCellEditingStyle)tableView:(UITableView *)table editingStyleForRowAtIndexPath:(NSIndexPath *)path {
- if (path.section != 1) return UITableViewCellEditingStyleNone;
+ if (path.section != SGNavbarSectionTabs) return UITableViewCellEditingStyleNone;
return _entries[(NSUInteger)path.row][SGNavbarURI] ? UITableViewCellEditingStyleDelete : UITableViewCellEditingStyleNone;
}
- (NSIndexPath *)tableView:(UITableView *)table targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)from toProposedIndexPath:(NSIndexPath *)to {
- return to.section == 1 ? to : from;
+ return to.section == SGNavbarSectionTabs ? to : from;
}
- (void)tableView:(UITableView *)table moveRowAtIndexPath:(NSIndexPath *)from toIndexPath:(NSIndexPath *)to {
@@ -285,14 +328,14 @@ static void appendTab(NSDictionary *tab) {
- (void)tableView:(UITableView *)table didSelectRowAtIndexPath:(NSIndexPath *)path {
[table deselectRowAtIndexPath:path animated:YES];
- if (path.section == 1) {
+ if (path.section == SGNavbarSectionTabs) {
NSMutableDictionary *entry = _entries[(NSUInteger)path.row];
entry[SGNavbarHidden] = [entry[SGNavbarHidden] boolValue] ? nil : @YES;
[self save];
[table reloadRowsAtIndexPaths:@[path] withRowAnimation:UITableViewRowAnimationNone];
- } else if (path.section == 2) {
+ } else if (path.section == SGNavbarSectionAdd) {
[self.navigationController pushViewController:[SGTabPickerPage new] animated:YES];
- } else if (path.section == 3) {
+ } else if (path.section == SGNavbarSectionReset) {
[self reset];
}
}
@@ -302,6 +345,10 @@ static void appendTab(NSDictionary *tab) {
SGRefreshTabBar();
}
+- (void)glassToggled:(UISwitch *)toggle {
+ SGSetEnabled(glassRows()[(NSUInteger)toggle.tag][2], toggle.on);
+}
+
- (void)reset {
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Use Spotify's order"
message:@"Every tab of Spotify's comes back where Spotify put it, and the tabs you added go."
@@ -319,5 +366,9 @@ static void appendTab(NSDictionary *tab) {
@end
UIViewController *SGNavbarSettingsPage(void) {
- return [SGNavbarPage new];
+ return [[SGNavbarPage alloc] initWithGlass:YES];
+}
+
+UIViewController *SGNavbarEditorPage(void) {
+ return [[SGNavbarPage alloc] initWithGlass:NO];
}
diff --git a/tweak/Sources/Features/NowPlaying/NowPlayingSettings.m b/tweak/Sources/Features/NowPlaying/NowPlayingSettings.m
index bfd6335c..8e0fa67c 100644
--- a/tweak/Sources/Features/NowPlaying/NowPlayingSettings.m
+++ b/tweak/Sources/Features/NowPlaying/NowPlayingSettings.m
@@ -1,66 +1,104 @@
+#import "Core/SGCore.h"
#import "Settings/SGModPage.h"
#import "NowPlaying.h"
#import "Features/Declutter/Declutter.h"
-#import "Features/Flags/Flags.h"
#import "Features/Gestures/Gestures.h"
#import "Features/ArtistBlock/ArtistBlock.h"
#import "Features/Karaoke/Karaoke.h"
+static UIViewController *nowPlayingBarPage(void) {
+ return [[SGModPage alloc] initWithTitle:@"Now playing bar" intro:SGRestartNote sections:@[
+ SGSection(nil, @[
+ SGOptionRow(@"Glass now playing bar", @"Glass card with round artwork", SGKeyNowPlayingBar),
+ SGHideRow(@"Hide the device button", @"The speaker icon in the bar", SGHideBarConnect),
+ ]),
+ SGSection(@"Spotify's flags", @[
+ SGFlagRow(@"Two lines of track info", @"ios-feature-nowplayingbar.two_lines_information_unit"),
+ SGFlagRow(@"Save button", @"ios-feature-nowplayingbar.add_button"),
+ SGFlagRow(@"Queue badge", @"ios-feature-nowplayingbar.queue_badge"),
+ SGFlagRow(@"Hold and drag to resize", @"ios-feature-nowplayingbar.hold_and_drag_to_resize"),
+ SGFlagRow(@"Video in the mini player", @"ios-feature-nowplaying.video_in_miniplayer"),
+ SGFlagRow(@"Bar to cover art animation", @"ios-feature-nowplaying.bartocoverart_animation_enabled"),
+ SGFlagRow(@"Mini player transition animations", @"ios-feature-nowplaying.miniplayer_transition_animations"),
+ ]),
+ ] footer:nil];
+}
+
static UIViewController *lyricsPage(void) {
return [[SGModPage alloc] initWithTitle:@"Lyrics" intro:SGRestartNote sections:@[
SGSection(nil, @[
SGOptionRow(@"Apple Music style", @"Word by word on the full screen page; timing inside a line is estimated", SGKeyKaraokeLyrics),
+ SGOptionRow(@"Glass lyrics", @"Glass card, and the page it expands into", SGKeyLyricsCard),
+ ]),
+ SGSection(@"Hide in the player", @[
+ SGHideRow(@"Lyrics card", @"The lyrics card below the player", SGHideLyricsCard),
+ SGHideRow(@"Lyrics preview", @"The lyric lines shown under the artwork", SGHideLyricsInline),
]),
SGSection(@"Spotify's flags", @[
SGFlagRow(@"Translations in the player", @"ios-feature-lyrics.enable_lyrics_multilanguage_npv"),
SGFlagRow(@"Translations full screen", @"ios-feature-lyrics.enable_lyrics_multilanguage_fullscreen"),
SGFlagRow(@"Keep lyrics offline", @"ios-feature-lyrics.lyrics_offline_enabled"),
- SGFlagRow(@"Lyrics toggle in the context menu", @"ios-feature-lyrics.lyrics_context_menu_toggle_enabled"),
SGFlagRow(@"Dynamic colours", @"ios-feature-lyrics.enable_dynamic_colors"),
SGFlagRow(@"Centre a single line", @"ios-feature-lyrics.is_single_line_centering_enabled"),
SGFlagRow(@"Full screen on track change", @"ios-feature-lyrics.enable_fullscreen_track_change"),
+ SGFlagRow(@"Lyrics toggle in the context menu", @"ios-feature-lyrics.lyrics_context_menu_toggle_enabled"),
+ ]),
+ ] footer:nil];
+}
+
+static UIViewController *queuePage(void) {
+ return [[SGModPage alloc] initWithTitle:@"Queue & devices" intro:SGRestartNote sections:@[
+ SGNotedSection(@"Bottom sheets", @[
+ SGFlagRow(@"Queue as a bottom sheet", @"ios-feature-nowplaying.bottom_sheet_queue_enabled"),
+ SGFlagRow(@"Connect as a bottom sheet", @"ios-feature-nowplaying-elements.enable_connect_bottom_sheet"),
+ SGFlagRow(@"Connect sheet from the video switcher", @"ios-playbackcontrol-audiovideoswitcher-impl.enable_connect_bottom_sheet"),
+ ], @"Locked on while Liquid Glass UI is on."),
+ SGSection(@"Queue", @[
+ SGFlagRow(@"Queue flip transition", @"ios-feature-nowplaying.queue_flip_transition_enabled"),
+ SGFlagRow(@"Play next in the context menu", @"ios-feature-queue.is_play_next_context_menu_enabled"),
+ ]),
+ ] footer:nil];
+}
+
+static UIViewController *lockScreenPage(void) {
+ return [[SGModPage alloc] initWithTitle:@"Lock screen widget" intro:SGRestartNote sections:@[
+ SGSection(@"Controls", @[
+ SGFlagRow(@"Like and dislike buttons", @"ios-feature-lockscreen.like_dislike_enabled"),
+ SGFlagRow(@"Skip button on podcasts", @"ios-feature-lockscreen.skip_button_on_podcasts"),
+ SGFlagRow(@"Chapter skip controls", @"ios-feature-lockscreen.enable_chapter_skip_controls"),
+ SGFlagRow(@"Burst skip", @"ios-feature-lockscreen.burst_skip_enabled"),
+ ]),
+ SGSection(@"Artwork", @[
+ SGFlagRow(@"Animated artwork", @"ios-feature-lockscreen.animated_artwork_enabled"),
+ SGFlagRow(@"Video artwork", @"ios-feature-lockscreen.vit_artwork_enabled"),
+ SGFlagRow(@"Companion content", @"ios-feature-lockscreen.companion_content_enabled"),
]),
] footer:nil];
}
UIViewController *SGNowPlayingSettingsPage(void) {
- NSMutableArray<SGModSection *> *sections = [NSMutableArray arrayWithArray:@[
+ SGModRow *blocked = SGPageRow(@"Blocked artists", ^UIViewController *{ return SGArtistBlockSettingsPage(); });
+ blocked.value = ^NSString *{
+ return SGFlag(SGKeyArtistBlock, NO) ? @(SGBlockedArtists().count).stringValue : @"Off";
+ };
+
+ return [[SGModPage alloc] initWithTitle:@"Player" intro:@"Changes apply after you restart Spotify. Gestures and Blocked artists apply straight away." sections:@[
SGSection(nil, @[
- SGPageRow(@"Gestures", ^UIViewController *{ return SGGesturesSettingsPage(); }),
- SGPageRow(@"Lyrics", ^UIViewController *{ return lyricsPage(); }),
- SGPageRow(@"Blocked artists", ^UIViewController *{ return SGArtistBlockSettingsPage(); }),
+ SGWithSymbol(SGPageRow(@"Gestures", ^UIViewController *{ return SGGesturesSettingsPage(); }), @"hand.tap"),
+ SGWithSymbol(SGPageRow(@"Lyrics", ^UIViewController *{ return lyricsPage(); }), @"quote.bubble"),
+ SGWithSymbol(blocked, @"person.crop.circle.badge.xmark"),
+ SGWithSymbol(SGPageRow(@"Now playing bar", ^UIViewController *{ return nowPlayingBarPage(); }), @"rectangle.bottomthird.inset.filled"),
]),
- SGSection(@"Liquid Glass", @[
- SGOptionRow(@"Now playing bar", @"Glass card with round artwork", SGKeyNowPlayingBar),
+ SGNotedSection(@"Player screen", @[
SGOptionRow(@"Artwork background", @"The cover blurred and dimmed behind the player instead of the flat album colour", SGKeyPlayerBackdrop),
- SGOptionRow(@"Header buttons", @"Glass circles behind close and more, over the artwork", SGKeyPlayer),
- SGOptionRow(@"Lyrics", @"Glass card, and the page it expands into", SGKeyLyricsCard),
- ]),
- SGSection(@"Spotify's flags", @[
+ SGOptionRow(@"Glass header buttons", @"Glass circles behind close and more, over the artwork", SGKeyPlayer),
+ SGKillRow(@"Disable Canvas", @"ios-feature-canvas.canvas_enabled"),
SGFlagRow(@"Sheet style player", @"ios-feature-nowplaying.sheet_style_npv"),
- SGFlagRow(@"Queue as a bottom sheet", @"ios-feature-nowplaying.bottom_sheet_queue_enabled"),
- SGFlagRow(@"Queue flip transition", @"ios-feature-nowplaying.queue_flip_transition_enabled"),
- SGFlagRow(@"Mini player transition animations", @"ios-feature-nowplaying.miniplayer_transition_animations"),
- SGFlagRow(@"Bar to cover art animation", @"ios-feature-nowplaying.bartocoverart_animation_enabled"),
+ SGFlagRow(@"Redesigned header", @"ios-feature-nowplaying.new_redesign_header_with_context_menu_enabled"),
+ SGFlagRow(@"New progress slider", @"ios-feature-encoreexperiments.new_npv_slider_enabled"),
SGFlagRow(@"Expand the sticky header on tap", @"ios-feature-nowplaying.expand_sticky_header_on_tap"),
- SGFlagRow(@"Redesigned header with context menu", @"ios-feature-nowplaying.new_redesign_header_with_context_menu_enabled"),
- SGFlagRow(@"Video in the mini player", @"ios-feature-nowplaying.video_in_miniplayer"),
- SGKillRow(@"Disable Canvas", @"ios-feature-canvas.canvas_enabled"),
- ]),
- SGSection(@"Hide buttons", @[
- SGHideRow(@"Shuffle", @"Left of the playback controls", SGHideShuffle),
- SGHideRow(@"Repeat", @"Right of the playback controls", SGHideRepeat),
- SGHideRow(@"Connect to a device", @"The speaker and device name in the bottom row", SGHideConnect),
- SGHideRow(@"Share", @"The share button in the bottom row", SGHideShare),
- SGHideRow(@"Device button in the bar", @"The speaker icon in the now playing bar", SGHideBarConnect),
- SGHideRow(@"Queue", @"The queue button in the bottom row", SGHideQueue),
- SGHideRow(@"Add to playlist", @"The plus next to the track title", SGHideAddTo),
- ]),
- SGSection(@"Under the artwork", @[
- SGHideRow(@"Lyrics preview", @"The lyric lines shown under the artwork", SGHideLyricsInline),
- ]),
- SGSection(@"Hide cards below the player", @[
- SGHideRow(@"Lyrics", @"The lyrics card", SGHideLyricsCard),
+ ], @"Liquid Glass UI turns the first two on or off with it, and locks the sheet, header and slider on."),
+ SGNotedSection(@"Hide cards below the player", @[
SGHideRow(@"About the artist", @"Photo, listeners and biography", SGHideAboutArtist),
SGHideRow(@"Related videos", @"The video carousel", SGHideRelatedVideos),
SGHideRow(@"SongDNA", @"Discover the people behind the song", SGHideSongDNA),
@@ -69,9 +107,18 @@ UIViewController *SGNowPlayingSettingsPage(void) {
SGHideRow(@"Credits", @"Performers and writers", SGHideCredits),
SGHideRow(@"Merch", @"The artist's shop", SGHideMerch),
SGHideRow(@"Recommendations", @"\"Artist: what you might like\", the episode and track rows", SGHideRecommendations),
+ ], @"The lyrics card is hidden from the Lyrics page."),
+ SGSection(@"Hide player buttons", @[
+ SGHideRow(@"Shuffle", @"Left of the playback controls", SGHideShuffle),
+ SGHideRow(@"Repeat", @"Right of the playback controls", SGHideRepeat),
+ SGHideRow(@"Add to playlist", @"The plus next to the track title", SGHideAddTo),
+ SGHideRow(@"Queue", @"The queue button in the bottom row", SGHideQueue),
+ SGHideRow(@"Share", @"The share button in the bottom row", SGHideShare),
+ SGHideRow(@"Connect to a device", @"The speaker and device name in the bottom row", SGHideConnect),
]),
- ]];
- [sections addObjectsFromArray:SGPlaybackSections()];
- [sections addObject:SGLockScreenSection()];
- return [[SGModPage alloc] initWithTitle:@"Player" intro:SGRestartNote sections:sections footer:nil];
+ SGNotedSection(nil, @[
+ SGWithSymbol(SGPageRow(@"Queue & devices", ^UIViewController *{ return queuePage(); }), @"text.line.first.and.arrowtriangle.forward"),
+ SGWithSymbol(SGPageRow(@"Lock screen widget", ^UIViewController *{ return lockScreenPage(); }), @"lock"),
+ ], @"Spotify's own options, some of them only rolled out to some accounts."),
+ ] footer:nil];
}
diff --git a/tweak/Sources/Features/Onboarding/Tour.m b/tweak/Sources/Features/Onboarding/Tour.m
index 79d1ad26..e239b402 100644
--- a/tweak/Sources/Features/Onboarding/Tour.m
+++ b/tweak/Sources/Features/Onboarding/Tour.m
@@ -321,11 +321,11 @@ static SGTourRow *actionRow(NSString *symbol, NSString *title, NSString *subtitl
return page;
}
-// The Navbar page as it is in Mod Settings, over the scrim instead of its own black, in a
-// navigation controller of its own so Add a tab has somewhere to push.
+// The tab editor of the Navbar page, over the scrim instead of its own black, in a navigation
+// controller of its own so Add a tab has somewhere to push.
- (SGTourPage *)navbarPage {
SGTourPage *page = [self pageWithSymbol:@"dock.rectangle" heading:@"Your tabs." body:@"Drag to reorder, tap to hide, add any Spotify link as a tab of its own. The bar follows straight away." rows:@[]];
- UIViewController *editor = SGNavbarSettingsPage();
+ UIViewController *editor = SGNavbarEditorPage();
editor.view.backgroundColor = UIColor.clearColor;
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:editor];
nav.navigationBarHidden = YES;
diff --git a/tweak/Sources/Features/Playlist/Playlist.h b/tweak/Sources/Features/Playlist/Playlist.h
index 251e96da..e9b0dd06 100644
--- a/tweak/Sources/Features/Playlist/Playlist.h
+++ b/tweak/Sources/Features/Playlist/Playlist.h
@@ -13,4 +13,5 @@
#define SGHidePlaylistPills @"spotifyglass.hide.playlistPills"
#define SGHidePlaylistFind @"spotifyglass.hide.playlistFind"
-UIViewController *SGPlaylistSettingsPage(void);
+@class SGModSection;
+NSArray<SGModSection *> *SGPlaylistSections(void); // the playlist sections of the Home & Library page
diff --git a/tweak/Sources/Features/Playlist/Playlist.x b/tweak/Sources/Features/Playlist/Playlist.x
index 1e6cd8f5..dde9d32b 100644
--- a/tweak/Sources/Features/Playlist/Playlist.x
+++ b/tweak/Sources/Features/Playlist/Playlist.x
@@ -1,4 +1,4 @@
-// Playlist: hides parts of a playlist page, one switch each in Mod Settings > Playlist. Album and
+// Playlist: hides parts of a playlist page, one switch each in Mod Settings > Home & Library. Album and
// artist pages are built by another framework and are left alone.
//
// The header parts are hidden from the layout pass that places them, not from the view
diff --git a/tweak/Sources/Features/Playlist/PlaylistSettings.m b/tweak/Sources/Features/Playlist/PlaylistSettings.m
index de04711f..6b118ae6 100644
--- a/tweak/Sources/Features/Playlist/PlaylistSettings.m
+++ b/tweak/Sources/Features/Playlist/PlaylistSettings.m
@@ -1,24 +1,24 @@
#import "Settings/SGModPage.h"
#import "Playlist.h"
-UIViewController *SGPlaylistSettingsPage(void) {
- return [[SGModPage alloc] initWithTitle:@"Playlist" intro:SGRestartNote sections:@[
- SGSection(@"Hide in the header", @[
+NSArray<SGModSection *> *SGPlaylistSections(void) {
+ return @[
+ SGSection(@"Hide in the playlist header", @[
SGHideRow(@"Cover artwork", @"The square cover over the title", SGHidePlaylistArtwork),
SGHideRow(@"Description", @"The text under the title", SGHidePlaylistDescription),
SGHideRow(@"Creator and collaborators", @"The faces, the name and Message", SGHidePlaylistCreator),
SGHideRow(@"Length and saves", @"The line under the creator", SGHidePlaylistLength),
]),
- SGSection(@"Hide header buttons", @[
+ SGSection(@"Hide playlist buttons", @[
SGHideRow(@"Video", @"The stack of clips at the start of the row", SGHidePlaylistVideo),
SGHideRow(@"Add to library", @"The plus", SGHidePlaylistAddTo),
SGHideRow(@"Download", @"The download arrow", SGHidePlaylistDownload),
SGHideRow(@"Share", @"The button that opens the share sheet", SGHidePlaylistShare),
SGHideRow(@"More", @"The three dots at the end of the row", SGHidePlaylistMore),
]),
- SGSection(@"Hide over the tracks", @[
+ SGSection(@"Hide above the tracks", @[
SGHideRow(@"Curation pills", @"Add, Mix, Video, Edit, Sort and the rest", SGHidePlaylistPills),
SGHideRow(@"Find and sort bar", @"Find on page and Sort, under the header", SGHidePlaylistFind),
]),
- ] footer:nil];
+ ];
}
diff --git a/tweak/Sources/Features/Privacy/Privacy.h b/tweak/Sources/Features/Privacy/Privacy.h
index 0141998f..f176a3af 100644
--- a/tweak/Sources/Features/Privacy/Privacy.h
+++ b/tweak/Sources/Features/Privacy/Privacy.h
@@ -11,4 +11,6 @@ NSUInteger SGBlockedCount(NSString *label);
void SGResetBlocked(void);
@class SGModSection;
-NSArray<SGModSection *> *SGPrivacySections(void); // the telemetry rows of the Premium & ads page
+// The telemetry switch and what it has stopped, on the Premium, ads & privacy page.
+SGModSection *SGPrivacySection(void);
+SGModSection *SGPrivacyCountersSection(void);
diff --git a/tweak/Sources/Features/Privacy/PrivacySettings.m b/tweak/Sources/Features/Privacy/PrivacySettings.m
index 9bf51ad5..45d504a1 100644
--- a/tweak/Sources/Features/Privacy/PrivacySettings.m
+++ b/tweak/Sources/Features/Privacy/PrivacySettings.m
@@ -1,7 +1,13 @@
#import "Settings/SGModPage.h"
#import "Privacy.h"
-NSArray<SGModSection *> *SGPrivacySections(void) {
+SGModSection *SGPrivacySection(void) {
+ return SGSection(@"Privacy", @[
+ SGWithSymbol(SGSwitchRow(@"Block telemetry", @"Answer the analytics endpoints with an empty reply instead of letting the request out", SGKeyBlockTelemetry), @"antenna.radiowaves.left.and.right.slash"),
+ ]);
+}
+
+SGModSection *SGPrivacyCountersSection(void) {
NSMutableArray<SGModRow *> *counts = [NSMutableArray array];
for (NSString *label in SGBlockedLabels()) {
[counts addObject:SGStatRow(label, ^NSString *{
@@ -11,13 +17,6 @@ NSArray<SGModSection *> *SGPrivacySections(void) {
[counts addObject:SGStatRow(@"Total", ^NSString *{
return @(SGBlockedCount(nil)).stringValue;
})];
- return @[
- SGSection(@"Telemetry", @[
- SGSwitchRow(@"Block telemetry", @"Answer the analytics endpoints with an empty reply instead of letting the request out", SGKeyBlockTelemetry),
- ]),
- SGSection(@"Telemetry blocked so far", counts),
- SGSection(nil, @[
- SGActionRow(@"Reset the telemetry counters", @"Start counting from zero", ^{ SGResetBlocked(); }),
- ]),
- ];
+ [counts addObject:SGActionRow(@"Reset the telemetry counters", @"Start counting from zero", ^{ SGResetBlocked(); })];
+ return SGSection(@"Telemetry blocked so far", counts);
}
diff --git a/tweak/Sources/Settings/SGModPage.h b/tweak/Sources/Settings/SGModPage.h
index 992b45bd..cc07f7ee 100644
--- a/tweak/Sources/Settings/SGModPage.h
+++ b/tweak/Sources/Settings/SGModPage.h
@@ -26,6 +26,7 @@
@interface SGModSection : NSObject
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSArray<SGModRow *> *rows;
+@property (nonatomic, copy) NSString *footer;
@end
@interface SGModPage : SGPage
@@ -54,3 +55,6 @@ SGModRow *SGChoiceRow(NSString *title, NSString *subtitle, NSString *key, NSArra
SGModRow *SGLinkRow(NSString *title, NSString *subtitle, NSString *url);
SGModRow *SGStatActionRow(NSString *title, NSString *subtitle, NSString *(^value)(void), void (^action)(void));
SGModSection *SGSection(NSString *title, NSArray<SGModRow *> *rows);
+SGModSection *SGNotedSection(NSString *title, NSArray<SGModRow *> *rows, NSString *footer);
+// Gives a row its leading symbol, drawn on a tile unless the row has a colour of its own.
+SGModRow *SGWithSymbol(SGModRow *row, NSString *symbol);
diff --git a/tweak/Sources/Settings/SGModPage.m b/tweak/Sources/Settings/SGModPage.m
index bd880d22..c4501c79 100644
--- a/tweak/Sources/Settings/SGModPage.m
+++ b/tweak/Sources/Settings/SGModPage.m
@@ -187,6 +187,17 @@ SGModSection *SGSection(NSString *title, NSArray<SGModRow *> *rows) {
return s;
}
+SGModSection *SGNotedSection(NSString *title, NSArray<SGModRow *> *rows, NSString *footer) {
+ SGModSection *s = SGSection(title, rows);
+ s.footer = footer;
+ return s;
+}
+
+SGModRow *SGWithSymbol(SGModRow *row, NSString *symbol) {
+ row.symbol = symbol;
+ return row;
+}
+
// What a page row carrying a value shows on the right: the value, then the chevron, the same
// distance apart as Spotify's own rows keep them.
static UIView *valueAndChevron(NSString *text) {
@@ -263,7 +274,9 @@ static BOOL flagRowLocked(SGModRow *row) {
[self.tableView reloadData];
if (!_live) return;
// The counters climb while the page is open; the labels are written straight into the cells so
- // that a reload never lands under a switch being dragged.
+ // 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];
}
@@ -302,11 +315,17 @@ static BOOL flagRowLocked(SGModRow *row) {
}
- (CGFloat)tableView:(UITableView *)table heightForHeaderInSection:(NSInteger)section {
- return _sections[(NSUInteger)section].title ? SGSectionHeaderHeight : 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;
}
- (CGFloat)tableView:(UITableView *)table heightForFooterInSection:(NSInteger)section {
- return CGFLOAT_MIN;
+ NSString *footer = _sections[(NSUInteger)section].footer;
+ return footer ? SGSectionFooterHeight(table, footer) : CGFLOAT_MIN;
}
- (UITableViewCell *)tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)path {
@@ -315,9 +334,10 @@ static BOOL flagRowLocked(SGModRow *row) {
SGFillCell(cell, row.title, row.subtitle, row.color, row.symbol);
UIListContentConfiguration *content = (UIListContentConfiguration *)cell.contentConfiguration;
if (row.color) content.secondaryTextProperties.color = row.color;
- if (row.page && row.symbol) content.image = SGTileImage(row.symbol);
+ BOOL tile = row.symbol && !row.color;
+ if (tile) content.image = SGTileImage(row.symbol);
cell.contentConfiguration = content;
- cell.separatorInset = UIEdgeInsetsMake(0, row.symbol ? (row.page ? 58 : 48) : 16, 0, 0);
+ cell.separatorInset = UIEdgeInsetsMake(0, row.symbol ? (tile ? 58 : 48) : 16, 0, 0);
if (row.key) {
UISwitch *toggle = [UISwitch new];
diff --git a/tweak/Sources/Settings/SGModSettings.x b/tweak/Sources/Settings/SGModSettings.x
index 31d0fd2d..5e74607a 100644
--- a/tweak/Sources/Settings/SGModSettings.x
+++ b/tweak/Sources/Settings/SGModSettings.x
@@ -1,11 +1,11 @@
-// Settings: a Mod Settings row at the end of Spotify's settings list opens the mod's own pages:
-// Appearance (with the Navbar, the tab bar's own composition, under it), Home & Library, Playlist
-// and Player, each sections of switches (the mod's own and a few of Spotify's remote-config
-// flags), Premium & ads and Labs, All flags, a searchable list of every flag with an override per
-// flag, and Mod, the build, its updates and links. The same row leads the side drawer's list
-// (trees/test6.txt), above Your plan, so the page is a tap from Home. The tweaks read the switches
-// when they run, so a change shows after Spotify restarts; the Navbar page is the exception and
-// applies as soon as the bar lays out again.
+// Settings: a Mod Settings row at the end of Spotify's settings list opens the mod's own page: the
+// Appearance card that styles the whole app, then a page per part of Spotify, each holding that
+// part's glass, hide switches and flags (Navbar, Player, Home & Library), Premium, ads & privacy
+// and Labs, All flags, a searchable list of every flag with an override per flag, and Mod, the
+// build, its updates and links. The same row leads the side drawer's list (trees/test6.txt), above
+// Your plan, so the page is a tap from Home. The tweaks read the switches when they run, so a change
+// shows after Spotify restarts; the tab editor on the Navbar page applies as soon as the bar lays
+// out again.
//
// Tree (trees/settings.txt): SettingsListViewController.view > SettingsListCollectionView of
// Element_List cells 402x56: 24pt icon at x 12, 13pt white title and 11pt grey subtitle at
@@ -16,9 +16,10 @@
#import "SGPageStyle.h"
#import "SGModPage.h"
#import "Features/Appearance/Appearance.h"
+#import "Features/Navbar/Navbar.h"
#import "Features/Home/Home.h"
-#import "Features/Playlist/Playlist.h"
#import "Features/NowPlaying/NowPlaying.h"
+#import "Features/AdBlock/AdBlock.h"
#import "Features/Flags/Flags.h"
#import "Features/About/About.h"
@@ -26,9 +27,7 @@ static const CGFloat kRowHeight = 56;
static char kRowKey, kInsetKey;
static SGModRow *pageRow(NSString *title, NSString *symbol, UIViewController *(^page)(void)) {
- SGModRow *row = SGPageRow(title, page);
- row.symbol = symbol;
- return row;
+ return SGWithSymbol(SGPageRow(title, page), symbol);
}
static UIViewController *modSettingsPage(void) {
@@ -42,14 +41,14 @@ static UIViewController *modSettingsPage(void) {
SGModRow *mod = pageRow(@"Mod", @"info.circle", ^UIViewController *{ return SGAboutPage(); });
mod.value = ^NSString *{ return @(SG_VERSION); };
[sections addObjectsFromArray:@[
+ SGAppearanceSection(),
SGSection(nil, @[
- pageRow(@"Appearance", @"paintbrush", ^UIViewController *{ return SGAppearanceSettingsPage(); }),
- pageRow(@"Home & Library", @"house", ^UIViewController *{ return SGHomeSettingsPage(); }),
- pageRow(@"Playlist", @"music.note.list", ^UIViewController *{ return SGPlaylistSettingsPage(); }),
+ pageRow(@"Navbar", @"dock.rectangle", ^UIViewController *{ return SGNavbarSettingsPage(); }),
pageRow(@"Player", @"play.circle", ^UIViewController *{ return SGNowPlayingSettingsPage(); }),
+ pageRow(@"Home & Library", @"house", ^UIViewController *{ return SGHomeSettingsPage(); }),
]),
SGSection(nil, @[
- pageRow(@"Premium & ads", @"crown", ^UIViewController *{ return SGAdsSettingsPage(); }),
+ pageRow(@"Premium, ads & privacy", @"crown", ^UIViewController *{ return SGAdsSettingsPage(); }),
pageRow(@"Labs", @"testtube.2", ^UIViewController *{ return SGLabsPage(); }),
]),
SGSection(nil, @[
diff --git a/tweak/Sources/Settings/SGPageStyle.h b/tweak/Sources/Settings/SGPageStyle.h
index bdef8941..32efc9a0 100644
--- a/tweak/Sources/Settings/SGPageStyle.h
+++ b/tweak/Sources/Settings/SGPageStyle.h
@@ -22,8 +22,11 @@ void SGFitNote(UITableView *table, UIView *wrapper, CGFloat top, CGFloat bottom)
void SGInsetForBars(UITableView *table);
extern const CGFloat SGSectionHeaderHeight;
+extern const CGFloat SGSectionGap; // above a section with no header, so its card does not touch the one before
void SGFillCell(UITableViewCell *cell, NSString *title, NSString *subtitle, UIColor *color, NSString *symbolName);
UIView *SGSectionHeader(UITableView *table, NSString *title);
+UIView *SGSectionFooter(UITableView *table, NSString *text);
+CGFloat SGSectionFooterHeight(UITableView *table, NSString *text);
UITableViewCell *SGDequeueCell(UITableView *table, NSString *identifier);
void SGOpenURL(NSString *url);
diff --git a/tweak/Sources/Settings/SGPageStyle.m b/tweak/Sources/Settings/SGPageStyle.m
index d1c270dc..2b54da97 100644
--- a/tweak/Sources/Settings/SGPageStyle.m
+++ b/tweak/Sources/Settings/SGPageStyle.m
@@ -88,6 +88,7 @@ UIImage *SGTileImage(NSString *symbol) {
}
const CGFloat SGSectionHeaderHeight = 38;
+const CGFloat SGSectionGap = 20;
// Every page below draws Spotify's own list row: a 13pt white title over an 11pt grey subtitle,
// with an optional symbol in the leading slot.
@@ -124,6 +125,33 @@ UIView *SGSectionHeader(UITableView *table, NSString *title) {
return header;
}
+static const CGFloat kFooterTop = 8, kFooterBottom = 4;
+
+static CGFloat footerTextHeight(UITableView *table, NSString *text) {
+ CGFloat width = MAX(table.bounds.size.width - 32, 100);
+ return ceil([text boundingRectWithSize:CGSizeMake(width, CGFLOAT_MAX)
+ options:NSStringDrawingUsesLineFragmentOrigin
+ attributes:@{NSFontAttributeName: SGSubtitleFont()}
+ context:nil].size.height);
+}
+
+UIView *SGSectionFooter(UITableView *table, NSString *text) {
+ UILabel *label = [UILabel new];
+ label.text = text;
+ label.font = SGSubtitleFont();
+ label.textColor = SGGrey();
+ label.numberOfLines = 0;
+ label.frame = CGRectMake(16, kFooterTop, table.bounds.size.width - 32, footerTextHeight(table, text));
+ label.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+ UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, table.bounds.size.width, SGSectionFooterHeight(table, text))];
+ [footer addSubview:label];
+ return footer;
+}
+
+CGFloat SGSectionFooterHeight(UITableView *table, NSString *text) {
+ return kFooterTop + footerTextHeight(table, text) + kFooterBottom;
+}
+
UITableViewCell *SGDequeueCell(UITableView *table, NSString *identifier) {
return [table dequeueReusableCellWithIdentifier:identifier]
?: [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];