Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.
C
fix: the welcome tour and the mod's sheets stay dark in light mode
My-Name-Is-Jeffd58cca4658fc
diff --git a/AGENTS.md b/AGENTS.mdindex 8c93e50b..810bcbae 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -71,4 +71,6 @@ Rules:for main, and at launch main waits on Spotify's CoreThread, so Spotify hangs and is killed. Use `queue:nil`and `dispatch_async` to main. Glass takes the appearance it inherits, and outside Spotify's navigationstacks (the tab bar, the now playing bar, the player) that is the system's: set every pane of the- mod's to `overrideUserInterfaceStyle = UIUserInterfaceStyleDark`, or it goes light in light mode.+ mod's to `overrideUserInterfaceStyle = UIUserInterfaceStyleDark`, or it goes light in light mode. Present a+ controller of the mod's through `SGPresentDark` (`Core/SGGlass.h`): a sheet's glass is its presentation's, and the+ controller's own override does not reach it.diff --git a/tweak/Sources/App/Onboarding/Tour.m b/tweak/Sources/App/Onboarding/Tour.mindex 7963a152..8bc4cdf7 100644--- a/tweak/Sources/App/Onboarding/Tour.m+++ b/tweak/Sources/App/Onboarding/Tour.m@@ -298,6 +298,8 @@ static const CGFloat kLogoRadius = 22;if (!(self = [super initWithNibName:nil bundle:nil])) return nil;self.modalPresentationStyle = UIModalPresentationOverFullScreen;self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;+ // Its text is white, and the glass under it would take the system's appearance, light in light mode.+ SGPresentDark(self);return self;}diff --git a/tweak/Sources/App/Onboarding/WhatsNew.m b/tweak/Sources/App/Onboarding/WhatsNew.mindex b87f3274..2646f726 100644--- a/tweak/Sources/App/Onboarding/WhatsNew.m+++ b/tweak/Sources/App/Onboarding/WhatsNew.m@@ -51,7 +51,7 @@ static UILabel *label(NSString *text, UIFontTextStyle style, UIFontWeight weight- (instancetype)init {if (!(self = [super initWithNibName:nil bundle:nil])) return nil;self.modalPresentationStyle = UIModalPresentationPageSheet;- self.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;+ SGPresentDark(self);self.sheetPresentationController.prefersGrabberVisible = YES;return self;}diff --git a/tweak/Sources/Core/SGGlass.h b/tweak/Sources/Core/SGGlass.hindex 06a6d001..6cc3e21e 100644--- a/tweak/Sources/Core/SGGlass.h+++ b/tweak/Sources/Core/SGGlass.h@@ -10,5 +10,9 @@ void SGHideGlassFrom(UIView *host, NSUInteger count);// Glass takes its shape from cornerConfiguration on iOS 26; layer.cornerRadius is the fallback.void SGShapeGlass(UIView *glass, CGFloat radius, BOOL capsule);+// Dark whatever the system is set to, for a controller the mod presents. A sheet's glass is its presentation's,+// which the controller's own override does not reach. Call it after modalPresentationStyle is set.+void SGPresentDark(UIViewController *controller);+// The areas each look keeps transparent are its own: Native/Appearance/Repaint.h and// Redesigned/Kit/SGRRepaint.h.diff --git a/tweak/Sources/Core/SGGlass.m b/tweak/Sources/Core/SGGlass.mindex 05d70831..44d5540a 100644--- a/tweak/Sources/Core/SGGlass.m+++ b/tweak/Sources/Core/SGGlass.m@@ -69,3 +69,8 @@ void SGShapeGlass(UIView *glass, CGFloat radius, BOOL capsule) {glass.clipsToBounds = YES;}}++void SGPresentDark(UIViewController *controller) {+ controller.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;+ controller.presentationController.overrideTraitCollection = [UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleDark];+}diff --git a/tweak/Sources/Redesigned/Lyrics/LyricsLookSettings.m b/tweak/Sources/Redesigned/Lyrics/LyricsLookSettings.mindex 152f538d..ff356517 100644--- a/tweak/Sources/Redesigned/Lyrics/LyricsLookSettings.m+++ b/tweak/Sources/Redesigned/Lyrics/LyricsLookSettings.m@@ -104,7 +104,7 @@ static void presentStyleSheet(UIViewController *owner) {UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:page];nav.view.backgroundColor = UIColor.clearColor;// Outside Spotify's own stacks the sheet would take the system's appearance, light in light mode.- nav.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;+ SGPresentDark(nav);UISheetPresentationController *sheet = nav.sheetPresentationController;// As tall as the sliders, half the screen until they are measured, so the preview at the top of the page stays// in sight and undimmed, and its buttons live.diff --git a/tweak/Sources/Redesigned/Lyrics/MeaningSheet.m b/tweak/Sources/Redesigned/Lyrics/MeaningSheet.mindex 3a1e0b29..119c152a 100644--- a/tweak/Sources/Redesigned/Lyrics/MeaningSheet.m+++ b/tweak/Sources/Redesigned/Lyrics/MeaningSheet.m@@ -37,8 +37,8 @@ static NSString *authorSymbol(SGLyricsMeaningAuthor author) {if (!self) return nil;_lineText = [lineText copy];_meanings = [meanings copy];- self.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;self.modalPresentationStyle = UIModalPresentationPageSheet;+ SGPresentDark(self);UISheetPresentationController *sheet = self.sheetPresentationController;sheet.detents = @[UISheetPresentationControllerDetent.mediumDetent, UISheetPresentationControllerDetent.largeDetent];sheet.prefersGrabberVisible = YES;diff --git a/tweak/Sources/Settings/SGModPage.m b/tweak/Sources/Settings/SGModPage.mindex 4cbff1d8..d53db3d1 100644--- a/tweak/Sources/Settings/SGModPage.m+++ b/tweak/Sources/Settings/SGModPage.m@@ -256,7 +256,7 @@ void SGPickColor(NSString *title, NSInteger initial, void (^picked)(NSInteger rgpicker.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemClose target:sheet action:@selector(cancel)];UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:picker];nav.modalPresentationStyle = UIModalPresentationPageSheet;- nav.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;+ SGPresentDark(nav);objc_setAssociatedObject(nav, @selector(confirm), sheet, OBJC_ASSOCIATION_RETAIN_NONATOMIC);[SGTopController() presentViewController:nav animated:YES completion:nil];}diff --git a/tweak/Sources/Settings/SGPage.m b/tweak/Sources/Settings/SGPage.mindex a9315092..076adff2 100644--- a/tweak/Sources/Settings/SGPage.m+++ b/tweak/Sources/Settings/SGPage.m@@ -48,5 +48,9 @@ void SGRegisterPages(void) {void SGShowPage(UIViewController *owner, UIViewController *page) {if (owner.navigationController && sg_pagesConform) [owner.navigationController pushViewController:page animated:YES];- else [owner presentViewController:[[UINavigationController alloc] initWithRootViewController:page] animated:YES completion:nil];+ else {+ UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:page];+ SGPresentDark(nav);+ [owner presentViewController:nav animated:YES completion:nil];+ }}diff --git a/tweak/Sources/Shared/HeadGestures/HeadGesturesTeach.m b/tweak/Sources/Shared/HeadGestures/HeadGesturesTeach.mindex 288a2ad1..0e482633 100644--- a/tweak/Sources/Shared/HeadGestures/HeadGesturesTeach.m+++ b/tweak/Sources/Shared/HeadGestures/HeadGesturesTeach.m@@ -546,8 +546,8 @@ void SGPresentHeadGesturesTeaching(UIViewController *owner, void (^closed)(void)SGTeachController *teach = [[SGTeachController alloc] initWithClosed:closed];UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:teach];// Outside Spotify's own stacks the sheet would take the system's appearance, light in light mode.- nav.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;nav.modalPresentationStyle = UIModalPresentationPageSheet;+ SGPresentDark(nav);nav.sheetPresentationController.prefersGrabberVisible = YES;[owner presentViewController:nav animated:YES completion:nil];}diff --git a/tweak/Sources/Shared/LocalFiles/EditInfoMenu.x b/tweak/Sources/Shared/LocalFiles/EditInfoMenu.xindex 0c571c1e..cd1415db 100644--- a/tweak/Sources/Shared/LocalFiles/EditInfoMenu.x+++ b/tweak/Sources/Shared/LocalFiles/EditInfoMenu.x@@ -372,7 +372,7 @@ void SGLocalFilePresentEditor(UIViewController *presenter, NSString *uri) {UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:editor];navigation.modalPresentationStyle = UIModalPresentationFormSheet;// Outside Spotify's navigation stacks a sheet takes the system's appearance, light in light mode.- navigation.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;+ SGPresentDark(navigation);navigation.presentationController.delegate = editor;UISheetPresentationController *sheet = navigation.sheetPresentationController;sheet.detents = @[UISheetPresentationControllerDetent.mediumDetent, UISheetPresentationControllerDetent.largeDetent];diff --git a/tweak/Sources/Shared/Navigation/AddTabSheet.m b/tweak/Sources/Shared/Navigation/AddTabSheet.mindex 28eb5ee0..1fbe4dc6 100644--- a/tweak/Sources/Shared/Navigation/AddTabSheet.m+++ b/tweak/Sources/Shared/Navigation/AddTabSheet.m@@ -545,7 +545,7 @@ typedef NS_ENUM(NSInteger, SGAddTabSection) {static void presentSheet(UIViewController *owner, SGAddTabPage *page) {UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:page];// Outside Spotify's own stacks the sheet would take the system's appearance, light in light mode.- nav.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;+ SGPresentDark(nav);UISheetPresentationController *sheet = nav.sheetPresentationController;// Tall enough for the name and the two rows under the navigation bar, and Remove Tab while editing; the// keyboard lifts it.