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: a long settings value no longer runs off the left of the screen

My-Name-Is-Jeffc3b097558c56
diff --git a/tweak/Sources/Settings/SGModPage.m b/tweak/Sources/Settings/SGModPage.m
index 8dda7a8a..5197cb93 100644
--- a/tweak/Sources/Settings/SGModPage.m
+++ b/tweak/Sources/Settings/SGModPage.m
@@ -301,12 +301,17 @@ SGModRow *SGWithTile(SGModRow *row, NSString *symbol, UIColor *color) {
// 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.
+// A value never takes more than this much of the row, so a long one ends in "…" and leaves the title its room.
+static const CGFloat kValueMaxWidth = 170;
+
static UIView *valueAndChevron(NSString *text) {
UILabel *label = [UILabel new];
label.font = SGTitleFont();
label.textColor = SGGrey();
label.text = text;
+ label.lineBreakMode = NSLineBreakByTruncatingTail;
[label sizeToFit];
+ if (label.bounds.size.width > kValueMaxWidth) label.bounds = CGRectMake(0, 0, kValueMaxWidth, label.bounds.size.height);
UIImageView *chevron = SGChevronView();
CGFloat height = MAX(label.bounds.size.height, chevron.bounds.size.height);
UIView *box = [[UIView alloc] initWithFrame:CGRectMake(0, 0, label.bounds.size.width + 6 + chevron.bounds.size.width, height)];
diff --git a/tweak/Sources/Shared/AnimatedArtwork/MotionSources.m b/tweak/Sources/Shared/AnimatedArtwork/MotionSources.m
index 7033d54a..fde0df36 100644
--- a/tweak/Sources/Shared/AnimatedArtwork/MotionSources.m
+++ b/tweak/Sources/Shared/AnimatedArtwork/MotionSources.m
@@ -68,9 +68,8 @@ SGModRow *SGMotionSourcesRow(void) {
row.value = ^NSString * {
NSArray<NSString *> *order = SGMotionSourceOrder();
if (!order.count) return @"Off";
- NSMutableArray<NSString *> *names = [NSMutableArray array];
- for (NSString *key in order) [names addObject:[key isEqualToString:kCanvas] ? @"Canvas" : @"Apple Music"];
- return [names componentsJoinedByString:@", "];
+ NSString *first = [order.firstObject isEqualToString:kCanvas] ? @"Canvas" : @"Apple Music";
+ return order.count == 1 ? first : [NSString stringWithFormat:@"%@ +%lu", first, (unsigned long)order.count - 1];
};
return SGWithSymbol(row, @"square.stack.3d.down.right");
}
diff --git a/tweak/Sources/Shared/Lyrics/LyricsSettings.m b/tweak/Sources/Shared/Lyrics/LyricsSettings.m
index eab57735..a348b3e6 100644
--- a/tweak/Sources/Shared/Lyrics/LyricsSettings.m
+++ b/tweak/Sources/Shared/Lyrics/LyricsSettings.m
@@ -9,9 +9,11 @@
SGModSection *SGLyricsSourcesSection(BOOL namingSource) {
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";
+ // The first one asked and how many follow it, short enough to sit beside the title.
+ NSArray<NSString *> *order = SGLyricsOrder();
+ if (!order.count) return @"Off";
+ NSString *first = SGLyricsProviderFor(order.firstObject).name;
+ return order.count == 1 ? first : [NSString stringWithFormat:@"%@ +%lu", first, (unsigned long)order.count - 1];
};
SGModRow *imported = SGPageRow(@"Imported LRC files", ^UIViewController *{ return SGImportedLRCPage(); });
imported.value = ^NSString *{