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: Albums & artists offers cover, logo and download options

My-Name-Is-Jeff5e3151bb9723
diff --git a/tweak/Sources/App/ModSettings.x b/tweak/Sources/App/ModSettings.x
index 1533ed2c..84518cbd 100644
--- a/tweak/Sources/App/ModSettings.x
+++ b/tweak/Sources/App/ModSettings.x
@@ -22,6 +22,7 @@
#import "Shared/AudioEffects/AudioEffectsPage.h"
#import "Shared/LiveActivity/LiveActivity.h"
#import "App/About/About.h"
+#import "Redesigned/Album/Album.h"
#import "Pages.h"
static const CGFloat kRowHeight = 56;
@@ -57,6 +58,7 @@ static UIViewController *modSettingsPage(void) {
[parts addObject:liveActivity];
}
if (!SGRedesignedUIStored()) [parts addObject:pageRow(@"Home & Library", @"house", ^UIViewController *{ return SGHomeSettingsPage(); })];
+ else [parts addObject:pageRow(@"Albums & artists", @"square.stack", ^UIViewController *{ return SGRAlbumSettingsPage(); })];
[sections addObjectsFromArray:@[
SGAppearanceSection(),
SGSection(nil, parts),
diff --git a/tweak/Sources/Redesigned/Album/Album.h b/tweak/Sources/Redesigned/Album/Album.h
index 2fb41656..86a8d375 100644
--- a/tweak/Sources/Redesigned/Album/Album.h
+++ b/tweak/Sources/Redesigned/Album/Album.h
@@ -20,6 +20,12 @@
// Threading: main thread only.
#import <UIKit/UIKit.h>
+// Apple Music's animated cover at the top of an album, and its logo in place of an artist's name; both on
+// until switched off (AlbumSettings.m).
+#define SGRKeyAlbumMotion @"spotifyglass.redesign.album.motion"
+#define SGRKeyArtistLogo @"spotifyglass.redesign.artist.logo"
+UIViewController *SGRAlbumSettingsPage(void);
+
// The album page `view` is on, or nil: the CreativeWorkTemplateView that carries the header, the list and
// the two floating controls (trees/clean/album/01.txt:22).
UIView *SGRAlbumPageOf(UIView *view);
diff --git a/tweak/Sources/Redesigned/Album/AlbumHeader.x b/tweak/Sources/Redesigned/Album/AlbumHeader.x
index 1ae90794..576d093d 100644
--- a/tweak/Sources/Redesigned/Album/AlbumHeader.x
+++ b/tweak/Sources/Redesigned/Album/AlbumHeader.x
@@ -205,9 +205,10 @@ static void *kReadyContext = &kReadyContext;
- (void)playMotionForArtist:(NSString *)artist album:(NSString *)album {
NSString *key = artist.length && album.length ? [NSString stringWithFormat:@"%@\n%@", artist, album] : nil;
- if (!key || [key isEqualToString:_motionAlbum]) return;
+ if (!key || [key isEqualToString:_motionAlbum] || !SGEnabled(SGRKeyAlbumMotion)) return;
_motionAlbum = key;
- CGFloat pixels = MAX(self.bounds.size.width, UIScreen.mainScreen.bounds.size.width) * UIScreen.mainScreen.scale;
+ // The player's size: at the screen's full width a square cover ran to the 1920 stream, tens of MB.
+ CGFloat pixels = SGMotionPixels();
__weak SGRAlbumHero *weakSelf = self;
SGMotionAlbumCover(artist, album, SGMotionSquare, pixels, ^(NSURL *file) {
SGRAlbumHero *hero = weakSelf;
diff --git a/tweak/Sources/Redesigned/Album/AlbumSettings.m b/tweak/Sources/Redesigned/Album/AlbumSettings.m
new file mode 100644
index 00000000..a7d3520c
--- /dev/null
+++ b/tweak/Sources/Redesigned/Album/AlbumSettings.m
@@ -0,0 +1,16 @@
+// The redesign's Albums & artists page: Apple Music's animated covers on album pages and its logos on
+// artist pages, and whether their downloads run in Low Data Mode.
+#import "Core/SGCore.h"
+#import "Settings/SGModPage.h"
+#import "Shared/AnimatedArtwork/AnimatedArtwork.h"
+#import "Album.h"
+
+UIViewController *SGRAlbumSettingsPage(void) {
+ return [[SGModPage alloc] initWithTitle:@"Albums & artists" intro:SGRestartNote sections:@[
+ SGNotedSection(@"Apple Music", @[
+ SGSwitchRow(@"Animated covers", @"At the top of an album that has one, about 5 MB each", SGRKeyAlbumMotion),
+ SGSwitchRow(@"Artist logos", @"In place of the name on an artist's page", SGRKeyArtistLogo),
+ SGOptionRow(@"Download in Low Data Mode", nil, SGKeyMotionLowData),
+ ], @"Only the album's or artist's name is sent to Apple Music."),
+ ] footer:nil];
+}
diff --git a/tweak/Sources/Redesigned/Artist/ArtistHeader.x b/tweak/Sources/Redesigned/Artist/ArtistHeader.x
index 0351ed80..11141cd1 100644
--- a/tweak/Sources/Redesigned/Artist/ArtistHeader.x
+++ b/tweak/Sources/Redesigned/Artist/ArtistHeader.x
@@ -29,6 +29,7 @@
#import "Core/SGCore.h"
#import "Redesigned/Kit/SGRKit.h"
#import "Shared/AnimatedArtwork/AnimatedArtwork.h"
+#import "Redesigned/Album/Album.h"
#import "Artist.h"
// How much of the photo's height the dissolve into the field covers, and the scrim over the top of it that
@@ -68,7 +69,7 @@ static char kLogoNameKey;
// Apple Music's logo for the artist in place of the name, where Apple Music has one. Asked once per name;
// the catalog remembers the answer for the launch.
static void showLogo(SGRHeaderInfo *info, NSString *name) {
- if (!name.length || [objc_getAssociatedObject(info, &kLogoNameKey) isEqualToString:name]) return;
+ if (!name.length || !SGEnabled(SGRKeyArtistLogo) || [objc_getAssociatedObject(info, &kLogoNameKey) isEqualToString:name]) return;
objc_setAssociatedObject(info, &kLogoNameKey, name, OBJC_ASSOCIATION_COPY_NONATOMIC);
__weak SGRHeaderInfo *weakInfo = info;
CGFloat pixels = UIScreen.mainScreen.bounds.size.width * UIScreen.mainScreen.scale;