Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.
C
fix: Spotify no longer hangs at launch on a settings write
My-Name-Is-Jeff8dbfb07425cb
diff --git a/AGENTS.md b/AGENTS.mdindex 8cc0a8be..e7d8ea78 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -66,6 +66,9 @@ Rules:- Known traps: anything pushed onto Spotify's nav stack must conform to `SPTPageController`(`Settings/SGPage.m`). Setting `hidden` on views inside Spotify's `OverflowStackView` or its Encorestacks crashes, so use alpha. A `CADisplayLink` capped at 60 Hz drags the player's 120 Hz- transitions down with it. Glass takes the appearance it inherits, and outside Spotify's navigation+ transitions down with it. Never observe a notification that other threads post (`NSUserDefaultsDidChangeNotification`,+ `AVAudioSessionRouteChangeNotification`) with `queue:NSOperationQueue.mainQueue`: the posting thread waits+ 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 themod's to `overrideUserInterfaceStyle = UIUserInterfaceStyleDark`, or it goes light in light mode.diff --git a/tweak/Sources/Shared/AnimatedArtwork/LockScreenMotion.x b/tweak/Sources/Shared/AnimatedArtwork/LockScreenMotion.xindex 6061bd79..ac3b8464 100644--- a/tweak/Sources/Shared/AnimatedArtwork/LockScreenMotion.x+++ b/tweak/Sources/Shared/AnimatedArtwork/LockScreenMotion.x@@ -166,13 +166,17 @@ static void showCover(NSString *picture) {if (file) show(file);else if (sg_choice == SGLockArtworkEverySong) showCover(sg_picture);}];- [NSNotificationCenter.defaultCenter addObserverForName:NSUserDefaultsDidChangeNotification object:nil queue:NSOperationQueue.mainQueue+ // Heard on the writing thread and handed to main without waiting: a main-queue observer makes every+ // background defaults write wait for main, which deadlocks launch while main waits on Spotify's CoreThread.+ [NSNotificationCenter.defaultCenter addObserverForName:NSUserDefaultsDidChangeNotification object:nil queue:nilusingBlock:^(NSNotification *note) {- SGLockArtwork choice = SGLockScreenArtwork();- if (choice == sg_choice) return;- SGLog(@"lock motion: the choice changed to %ld, the playing track looked up again", (long)choice);- sg_choice = choice;- [sg_follower restart];+ dispatch_async(dispatch_get_main_queue(), ^{+ SGLockArtwork choice = SGLockScreenArtwork();+ if (choice == sg_choice) return;+ SGLog(@"lock motion: the choice changed to %ld, the playing track looked up again", (long)choice);+ sg_choice = choice;+ [sg_follower restart];+ });}];SGLog(@"lock motion: %@, the lock screen takes %@", motionOn(sg_choice) ? (sg_choice == SGLockArtworkEverySong ? @"on for every song" : @"on") : @"off",MPNowPlayingInfoCenter.supportedAnimatedArtworkKeys);diff --git a/tweak/Sources/Shared/AudioEffects/AudioEffects.x b/tweak/Sources/Shared/AudioEffects/AudioEffects.xindex afd3a8a6..4479c796 100644--- a/tweak/Sources/Shared/AudioEffects/AudioEffects.x+++ b/tweak/Sources/Shared/AudioEffects/AudioEffects.x@@ -614,9 +614,10 @@ static void followRoute(void) {}%ctor {- [NSNotificationCenter.defaultCenter addObserverForName:AVAudioSessionRouteChangeNotification object:nil queue:NSOperationQueue.mainQueue+ // Posted on the audio session's thread: handed to main without waiting, so it cannot deadlock against main.+ [NSNotificationCenter.defaultCenter addObserverForName:AVAudioSessionRouteChangeNotification object:nil queue:nilusingBlock:^(NSNotification *note) {- followRoute();+ dispatch_async(dispatch_get_main_queue(), ^{ followRoute(); });}];dispatch_async(dispatch_get_main_queue(), ^{followRoute();diff --git a/tweak/Sources/Shared/Sing/Sing.x b/tweak/Sources/Shared/Sing/Sing.xindex 3130edd7..126b011a 100644--- a/tweak/Sources/Shared/Sing/Sing.x+++ b/tweak/Sources/Shared/Sing/Sing.x@@ -906,12 +906,15 @@ static void readHeat(void) {}];// Headphones in or out, or iOS's own spatial audio switched.for (NSNotificationName name in @[AVAudioSessionRouteChangeNotification, AVAudioSessionSpatialPlaybackCapabilitiesChangedNotification]) {- [center addObserverForName:name object:nil queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification *note) {- if (SGSingOn() && readRefusal()) {- apply();- announce();- }- updateSpatial();+ // Posted on the audio session's thread: handed to main without waiting, so it cannot deadlock against main.+ [center addObserverForName:name object:nil queue:nil usingBlock:^(NSNotification *note) {+ dispatch_async(dispatch_get_main_queue(), ^{+ if (SGSingOn() && readRefusal()) {+ apply();+ announce();+ }+ updateSpatial();+ });}];}// A load starts only while Spotify is active, so never in a launch into the background, and the faster copy