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

fix: trim the Lyrics settings page

Vojtěch Škopek76b85776d1b6
diff --git a/tweak/Sources/App/Pages.m b/tweak/Sources/App/Pages.m
index 7e3795ba..d6eeb300 100644
--- a/tweak/Sources/App/Pages.m
+++ b/tweak/Sources/App/Pages.m
@@ -69,17 +69,14 @@ UIViewController *SGNavbarPage(void) {
return SGRedesignedUIStored() ? SGRNavbarSettingsPage() : SGNavbarSettingsPage();
}
-// The redesign always draws Apple Music style lyrics, and only it names their source and shows the
-// pronunciation and the translation a source has; the native look has its glass card and page instead.
+// Pronunciation, translation and word sweeping exist only in the redesign's lyrics view.
static UIViewController *lyricsPage(void) {
BOOL redesigned = SGRedesignedUIStored();
NSMutableArray<SGModRow *> *more = [NSMutableArray arrayWithObject:SGLockScreenLyricsRow()];
if (!redesigned) [more insertObject:SGGlassLyricsRow() atIndex:0];
NSMutableArray<SGModSection *> *sections = [NSMutableArray arrayWithObject:SGLyricsSourcesSection(redesigned)];
if (redesigned) {
- [sections addObject:SGNotedSection(@"Pronunciation and translation", @[SGRLyricsTextSizesRow(), SGLyricsTranslationLanguageRow()],
- @"BiniLyrics and Unison carry Apple Music's own for many songs. The button in the corner of the lyrics shows them.")];
- [sections addObject:SGLyricsWordTimingSection()];
+ [sections addObject:SGSection(@"Display", @[SGLyricsWordTimingRow(), SGRLyricsTextSizesRow(), SGLyricsTranslationLanguageRow()])];
}
[sections addObject:SGSection(nil, more)];
return [[SGModPage alloc] initWithTitle:@"Lyrics" intro:SGRestartNote sections:sections footer:nil];
diff --git a/tweak/Sources/Redesigned/Lyrics/LyricsTextSettings.m b/tweak/Sources/Redesigned/Lyrics/LyricsTextSettings.m
index 74174095..2bfd43cb 100644
--- a/tweak/Sources/Redesigned/Lyrics/LyricsTextSettings.m
+++ b/tweak/Sources/Redesigned/Lyrics/LyricsTextSettings.m
@@ -1,7 +1,4 @@
-// The sizes a line's three texts are set in, as a list of them to drag: the top one is set largest,
-// at the lyrics' own size, the next smaller and the last smallest, the way the Lyrics sources list
-// is dragged into the order the sources are asked in. Apple Music lets the lyrics or the
-// pronunciation be the larger and keeps the translation the smallest; any order goes here.
+// Drag the three texts of a line into size order, largest first.
#import "Core/SGCore.h"
#import "Settings/SGModPage.h"
#import "Settings/SGPageStyle.h"
@@ -25,8 +22,7 @@
[super viewDidLoad];
_order = [SGRLyricsTextOrder() mutableCopy];
self.tableView.editing = YES;
- _footer = SGNote(@"Drag to choose which is set largest. The pronunciation and the translation show under a line "
- "when the lyrics have them and you turn them on from the button in the lyrics' corner.");
+ _footer = SGNote(@"Pronunciation and translation are turned on from the button in the lyrics' corner.");
self.tableView.tableFooterView = _footer;
}
@@ -93,12 +89,5 @@
@end
SGModRow *SGRLyricsTextSizesRow(void) {
- SGModRow *row = SGPageRow(@"Text sizes", ^UIViewController *{ return [SGRLyricsTextPage new]; });
- row.subtitle = @"Which of the lyrics, their pronunciation and their translation is set largest";
- row.value = ^NSString *{
- NSMutableArray<NSString *> *names = [NSMutableArray array];
- for (NSNumber *text in SGRLyricsTextOrder()) [names addObject:SGRLyricsTextName(text.integerValue)];
- return [names componentsJoinedByString:@", "];
- };
- return row;
+ return SGPageRow(@"Text sizes", ^UIViewController *{ return [SGRLyricsTextPage new]; });
}
diff --git a/tweak/Sources/Settings/SGModPage.h b/tweak/Sources/Settings/SGModPage.h
index 72644932..039daf58 100644
--- a/tweak/Sources/Settings/SGModPage.h
+++ b/tweak/Sources/Settings/SGModPage.h
@@ -31,6 +31,7 @@
@property (nonatomic, copy) BOOL (^visible)(void);
// A choice row's: a line under each name in its list, in the same order, and what runs once one is stored.
@property (nonatomic, copy) NSArray<NSString *> *choiceNotes;
+@property (nonatomic, copy) NSString *choiceFooter; // under a choice row's list
@property (nonatomic, copy) void (^chosen)(NSInteger index);
// A slider row's (SGSliderRow): its range and step, and the blocks that read its number, store one and
// write one out.
diff --git a/tweak/Sources/Settings/SGModPage.m b/tweak/Sources/Settings/SGModPage.m
index 5bd18847..6b6f25c1 100644
--- a/tweak/Sources/Settings/SGModPage.m
+++ b/tweak/Sources/Settings/SGModPage.m
@@ -92,7 +92,7 @@ SGModRow *SGPageRow(NSString *title, UIViewController *(^page)(void)) {
// it came from reads the new name out and the page it sits on rebuilds around it.
@interface SGChoicePage : SGPage
- (instancetype)initWithTitle:(NSString *)title key:(NSString *)key choices:(NSArray<NSString *> *)choices notes:(NSArray<NSString *> *)notes
- fallback:(NSInteger)fallback chosen:(void (^)(NSInteger index))chosen;
+ footer:(NSString *)footer fallback:(NSInteger)fallback chosen:(void (^)(NSInteger index))chosen;
@end
@implementation SGChoicePage {
@@ -100,10 +100,11 @@ SGModRow *SGPageRow(NSString *title, UIViewController *(^page)(void)) {
NSArray<NSString *> *_choices, *_notes;
NSInteger _fallback;
void (^_chosen)(NSInteger index);
+ UIView *_footer;
}
- (instancetype)initWithTitle:(NSString *)title key:(NSString *)key choices:(NSArray<NSString *> *)choices notes:(NSArray<NSString *> *)notes
- fallback:(NSInteger)fallback chosen:(void (^)(NSInteger index))chosen {
+ footer:(NSString *)footer fallback:(NSInteger)fallback chosen:(void (^)(NSInteger index))chosen {
if (!(self = [super initWithStyle:UITableViewStyleInsetGrouped])) return nil;
self.title = title;
_key = key;
@@ -111,9 +112,20 @@ SGModRow *SGPageRow(NSString *title, UIViewController *(^page)(void)) {
_notes = notes;
_fallback = fallback;
_chosen = chosen;
+ _footer = footer ? SGNote(footer) : nil;
return self;
}
+- (void)viewDidLoad {
+ [super viewDidLoad];
+ self.tableView.tableFooterView = _footer;
+}
+
+- (void)viewWillLayoutSubviews {
+ [super viewWillLayoutSubviews];
+ if (_footer) SGFitNote(self.tableView, _footer, 16, 24);
+}
+
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
@@ -168,7 +180,7 @@ SGModRow *SGChoiceRow(NSString *title, NSString *subtitle, NSString *key, NSArra
};
__weak SGModRow *weakRow = row;
row.page = ^UIViewController *{
- return [[SGChoicePage alloc] initWithTitle:title key:key choices:choices notes:weakRow.choiceNotes fallback:fallback chosen:weakRow.chosen];
+ return [[SGChoicePage alloc] initWithTitle:title key:key choices:choices notes:weakRow.choiceNotes footer:weakRow.choiceFooter fallback:fallback chosen:weakRow.chosen];
};
return row;
}
diff --git a/tweak/Sources/Shared/Lyrics/Lyrics.h b/tweak/Sources/Shared/Lyrics/Lyrics.h
index 437961cb..66056684 100644
--- a/tweak/Sources/Shared/Lyrics/Lyrics.h
+++ b/tweak/Sources/Shared/Lyrics/Lyrics.h
@@ -15,7 +15,7 @@
SGModSection *SGLyricsSourcesSection(BOOL namingSource);
SGModRow *SGLockScreenLyricsRow(void);
SGModRow *SGLyricsTranslationLanguageRow(void);
-SGModSection *SGLyricsWordTimingSection(void);
+SGModRow *SGLyricsWordTimingRow(void);
// Sweeps a line timed only by the line word by word, on the estimate of when each word is sung, as if
// the source had timed them. Off, such a line lights up whole as it starts. Off by default: the
diff --git a/tweak/Sources/Shared/Lyrics/LyricsSettings.m b/tweak/Sources/Shared/Lyrics/LyricsSettings.m
index c6c069c8..aac07160 100644
--- a/tweak/Sources/Shared/Lyrics/LyricsSettings.m
+++ b/tweak/Sources/Shared/Lyrics/LyricsSettings.m
@@ -1,4 +1,4 @@
-// The Lyrics page's parts. The page itself is App/Pages.m's, which adds what only one look has.
+// The Lyrics page's parts; App/Pages.m assembles the page.
#import "Core/SGCore.h"
#import "Settings/SGModPage.h"
#import "Lyrics.h"
@@ -6,32 +6,29 @@
#import "Shared/LyricsSources/LyricsSources.h"
SGModSection *SGLyricsSourcesSection(BOOL namingSource) {
- // The row reads the order out, so which sources are on is visible without opening it.
- SGModRow *sources = SGPageRow(@"Lyrics sources", ^UIViewController *{ return SGLyricsSourcesPage(); });
- sources.subtitle = @"BiniLyrics, Musixmatch, Unison, NetEase and LRCLIB, in the order you put them";
+ SGModRow *sources = SGPageRow(@"Sources", ^UIViewController *{ return SGLyricsSourcesPage(); });
sources.value = ^NSString *{
NSMutableArray<NSString *> *names = [NSMutableArray array];
for (NSString *key in SGLyricsOrder()) [names addObject:SGLyricsProviderFor(key).name];
return names.count ? [names componentsJoinedByString:@", "] : @"Off";
};
NSMutableArray<SGModRow *> *rows = [NSMutableArray arrayWithObjects:sources,
- SGOptionRow(@"Lyrics for every track", @"Offers the lyrics card on tracks Spotify has no lyrics for; needs a source above", SGKeyLyricsAllTracks), nil];
- if (namingSource) [rows addObject:SGOptionRow(@"Name the source", @"Reads out which source the lines on the full screen page came from", SGKeyLyricsCredit)];
- return SGNotedSection(@"Where lyrics come from", rows, @"With no source on, Spotify's own lyrics are left alone.");
+ SGOptionRow(@"Lyrics for every track", @"Even where Spotify has none", SGKeyLyricsAllTracks), nil];
+ if (namingSource) [rows addObject:SGOptionRow(@"Show source", nil, SGKeyLyricsCredit)];
+ return SGSection(@"Sources", rows);
}
SGModRow *SGLockScreenLyricsRow(void) {
- return SGOptionRow(@"Replace artist with lyrics", @"The line being sung shows in place of the artist, so lyrics show up on the lock screen and in CarPlay", SGKeyLockScreenLyrics);
+ return SGOptionRow(@"Lock screen lyrics", @"Current line in place of the artist", SGKeyLockScreenLyrics);
}
SGModRow *SGLyricsTranslationLanguageRow(void) {
- return SGChoiceRow(@"Translation language", @"Of the translations the lyrics come with, the one to show; Any shows the first",
- SGKeyLyricsTranslationLanguage, SGLyricsTranslationLanguageNames(), 0);
+ SGModRow *row = SGChoiceRow(@"Translation language", nil, SGKeyLyricsTranslationLanguage, SGLyricsTranslationLanguageNames(), 0);
+ row.choiceFooter = @"Used when the lyrics come with translations. Any shows the first.";
+ return row;
}
-// Read by the redesign's lyrics view, the one place words are swept, so the page offers it there only.
-SGModSection *SGLyricsWordTimingSection(void) {
- SGModRow *row = SGOptionRow(@"Simulate word-by-word timing", @"Guesses when each word of a line-synced line is sung, and sweeps it as if the source had timed it", SGKeyLyricsSimulateWords);
- return SGNotedSection(@"Word timing", @[row],
- @"Off, lyrics synced by the line light up a line at a time, and lyrics with no timing show as plain text. Word-synced lyrics sweep word by word either way.");
+// Only the redesign's lyrics view sweeps words.
+SGModRow *SGLyricsWordTimingRow(void) {
+ return SGOptionRow(@"Simulate word timing", nil, SGKeyLyricsSimulateWords);
}
diff --git a/tweak/Sources/Shared/LyricsSources/LyricsSources.m b/tweak/Sources/Shared/LyricsSources/LyricsSources.m
index 566925bd..b4484114 100644
--- a/tweak/Sources/Shared/LyricsSources/LyricsSources.m
+++ b/tweak/Sources/Shared/LyricsSources/LyricsSources.m
@@ -149,12 +149,12 @@ NSArray<SGLyricsProvider *> *SGLyricsAllProviders(void) {
return provider;
};
all = @[
- make(@"spicylyrics", @"Spicy Lyrics", @"Syllable timing matched by track id; asks with your Spotify token", SGSpicyLyricsAsk),
- make(@"binilyrics", @"BiniLyrics", @"Apple Music's own word timing, over a million tracks", SGBiniLyricsAsk),
- make(@"musixmatch", @"Musixmatch", @"The catalogue Spotify licenses; matched by track, never by name", SGMusixmatchAsk),
- make(@"unison", @"Unison", @"Written by hand for Better Lyrics: few tracks, the best of them", SGUnisonAsk),
- make(@"netease", @"NetEase", @"Word timing only, for what the others line time; swearing is starred out", SGNetEaseAsk),
- make(@"lrclib", @"LRCLIB", @"Open and keyless, timed by the line: the floor under the rest", SGLrcLibAsk),
+ make(@"spicylyrics", @"Spicy Lyrics", @"Syllable timing, uses your Spotify token", SGSpicyLyricsAsk),
+ make(@"binilyrics", @"BiniLyrics", @"Apple Music word timing", SGBiniLyricsAsk),
+ make(@"musixmatch", @"Musixmatch", @"Spotify's licensed catalogue", SGMusixmatchAsk),
+ make(@"unison", @"Unison", @"Hand-timed, few tracks", SGUnisonAsk),
+ make(@"netease", @"NetEase", @"Word timing, censored", SGNetEaseAsk),
+ make(@"lrclib", @"LRCLIB", @"Line timing, open fallback", SGLrcLibAsk),
];
});
return all;
diff --git a/tweak/Sources/Shared/LyricsSources/LyricsSourcesPage.m b/tweak/Sources/Shared/LyricsSources/LyricsSourcesPage.m
index 7c8773cb..0d2ef21f 100644
--- a/tweak/Sources/Shared/LyricsSources/LyricsSourcesPage.m
+++ b/tweak/Sources/Shared/LyricsSources/LyricsSourcesPage.m
@@ -1,7 +1,4 @@
-// The order the sources are asked in, as a list to drag into shape. Switched-on sources sit at the
-// top in the order they are asked; the rest wait below. Dragging one up makes it the first asked,
-// which is the whole point: the source you trust most answers first, and the ones under it only
-// fill in what it could not.
+// Drag sources into the order they are asked; the ones below the line are off.
#import "Core/SGCore.h"
#import "Settings/SGPage.h"
#import "Settings/SGPageStyle.h"
@@ -45,13 +42,8 @@ typedef NS_ENUM(NSInteger, SGSourcesSection) {
[self read];
self.tableView.editing = YES;
self.tableView.allowsSelectionDuringEditing = YES;
- _footer = SGNote(@"Each source is asked in turn until every word is timed. A source that only has "
- "the plain words does not shut out a later one that times them.\n\n"
- "Musixmatch is sent the track's id with an anonymous token; BiniLyrics, Unison, "
- "NetEase and LRCLIB are sent the title, artist and length. None of those is told "
- "anything of your Spotify account. Spicy Lyrics is the one exception: it answers "
- "only a signed-in Spotify client, so it is sent this app's own access token along "
- "with the track's id. Changes apply after you restart Spotify.");
+ _footer = SGNote(@"Asked top to bottom until one has word timing. Spicy Lyrics is sent your Spotify "
+ "access token; the others get only the track, never your account.");
self.tableView.tableFooterView = _footer;
}