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: add warning to tab bar switch

Vojtěch Škopeka5e67f23d902
diff --git a/site/scarlet.json b/site/scarlet.json
index efaf0626..defd1ea1 100644
--- a/site/scarlet.json
+++ b/site/scarlet.json
@@ -9,7 +9,7 @@
"version": "0.14.1-9.1.78",
"bundleID": "com.spotify.client2",
"down": "https://files.catbox.moe/REPLACE.ipa",
- "description": "Spotify's own Liquid Glass design, unhidden from its feature flags, plus a pure black AMOLED background, a decluttered player and Home, a tab bar you can reorder or add your own links to, an editor for all of Spotify's internal flags, and telemetry blocking.\n\nPurely cosmetic. It does not unlock Premium.",
+ "description": "Like and dislike back on the lock screen widget, speed control and trim silence for music and not only podcasts, Spotify's own Liquid Glass with every flag of it on at once, a pure black AMOLED background, picture in picture, lyrics translations and vocal removal, a tab bar you reorder or add your own links to, no ad on app open and no upsells or tooltips, telemetry blocking with a count of what it stopped, and an editor for every one of Spotify's internal flags.\n\nPurely cosmetic. It does not unlock Premium.",
"icon": "https://spoti.pw/icon.png",
"dev": "vojta"
}
diff --git a/tweak/src/SGCommon.m b/tweak/src/SGCommon.m
index d10e8a65..0f785cd5 100644
--- a/tweak/src/SGCommon.m
+++ b/tweak/src/SGCommon.m
@@ -227,9 +227,12 @@ BOOL SGLooksLikeCard(UIView *view, CGColorRef color) {
#pragma mark - glass
+// +effectWithStyle: is the only initialiser UIGlassEffect has; a bare -init leaves the material
+// unresolved and the pane renders as a plain blur, while the capsule shape, which is the view's
+// own property, still comes out right. Spotify's own Reprise glass builds its effect the same way.
static UIVisualEffect *glassEffect(void) {
Class glass = NSClassFromString(@"UIGlassEffect");
- if (glass) return [[glass alloc] init];
+ if ([glass respondsToSelector:@selector(effectWithStyle:)]) return [glass effectWithStyle:0];
return [UIBlurEffect effectWithStyle:UIBlurEffectStyleSystemChromeMaterialDark];
}
diff --git a/tweak/src/ui/Settings.x b/tweak/src/ui/Settings.x
index 61d180c5..7ec5bb24 100644
--- a/tweak/src/ui/Settings.x
+++ b/tweak/src/ui/Settings.x
@@ -123,6 +123,7 @@ static BOOL sg_pagesConform;
@property (nonatomic, copy) UIViewController *(^page)(void);
@property (nonatomic, copy) NSString *(^value)(void);
@property (nonatomic, copy) void (^action)(void);
+@property (nonatomic, copy) NSString *warning;
@end
@implementation SGModRow
@@ -158,6 +159,14 @@ static SGModRow *optionRow(NSString *title, NSString *subtitle, NSString *key) {
return row;
}
+// A switch whose work is not finished: turning it on says so first, and offers the repo to anyone
+// who would rather fix it than live with it.
+static SGModRow *unstableRow(NSString *title, NSString *subtitle, NSString *key, NSString *warning) {
+ SGModRow *row = switchRow(title, subtitle, key);
+ row.warning = warning;
+ return row;
+}
+
static SGModRow *flagRow(NSString *title, NSString *key) {
SGModRow *row = hideRow(title, [key substringFromIndex:[key rangeOfString:@"."].location + 1], key);
row.flag = YES;
@@ -409,6 +418,18 @@ static UITableViewCell *dequeue(UITableView *table, NSString *identifier) {
SGModRow *row = [self rowAt:[NSIndexPath indexPathForRow:toggle.tag % 1000 inSection:toggle.tag / 1000]];
if (row.flag) SGSetFlagOverride(row.key, toggle.on ? @(!row.forceOff) : nil);
else SGSetEnabled(row.key, toggle.on);
+ if (toggle.on && row.warning) [self warn:row];
+}
+
+- (void)warn:(SGModRow *)row {
+ UIAlertController *alert = [UIAlertController alertControllerWithTitle:[row.title stringByAppendingString:@" is unstable"]
+ message:row.warning
+ preferredStyle:UIAlertControllerStyleAlert];
+ [alert addAction:[UIAlertAction actionWithTitle:@"Open GitHub" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
+ SGOpenURL(SGRepoURL);
+ }]];
+ [alert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:nil]];
+ [self presentViewController:alert animated:YES completion:nil];
}
@end
@@ -901,7 +922,8 @@ static NSString *const kRestart = @"Changes apply after you restart Spotify.";
static UIViewController *uiTweaksPage(void) {
return [[SGModPage alloc] initWithTitle:@"UI Tweaks" intro:kRestart sections:@[
section(@"Liquid Glass", @[
- switchRow(@"Tab bar", @"[WIP] Unstable", SGKeyTabBar),
+ unstableRow(@"Tab bar", @"[WIP] Unstable", SGKeyTabBar,
+ @"The glass capsule does not render the way iOS draws its own, and there is no selection indicator behind the active tab. Switching this on will look wrong.\n\nIf you want to take it further, pull requests are very welcome."),
switchRow(@"Search field", @"Glass capsule instead of the white field", SGKeySearchField),
switchRow(@"Spotify's own Liquid Glass", @"The glass navigation bar, the new player slider and the new sheets, all shipped switched off", SGKeySpotifyGlass),
]),