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 scrub of the redesigned player's progress bar no longer closes the player
My-Name-Is-Jeff821541b4fec7
diff --git a/tweak/Sources/Redesigned/Player/Player.h b/tweak/Sources/Redesigned/Player/Player.hindex 137b581d..98b189db 100644--- a/tweak/Sources/Redesigned/Player/Player.h+++ b/tweak/Sources/Redesigned/Player/Player.h@@ -11,7 +11,8 @@// PlayerControls.x previous, play and next as bare glyphs, monospaced times// PlayerFooter.x share gone, lyrics, Connect and queue as one row of three glyphs// PlayerCards.x every card under the player collapsed, so the list closes up-// PlayerScroll.x the list held at its top, so the player is one screen and cannot be scrolled up+// PlayerScroll.x the list held at its top, so the player is one screen and cannot be scrolled up,+// and its pull held off while the progress bar is scrubbed// PlayerLyrics.x the lyrics in the player: the cover as a thumbnail, the title up beside it// PlayerGestures.x the gestures' hookup// PlayerMorph.x the open and close grown out of the now playing bar's card, the cover flowndiff --git a/tweak/Sources/Redesigned/Player/PlayerScroll.x b/tweak/Sources/Redesigned/Player/PlayerScroll.xindex b89d9daa..1986c440 100644--- a/tweak/Sources/Redesigned/Player/PlayerScroll.x+++ b/tweak/Sources/Redesigned/Player/PlayerScroll.x@@ -1,6 +1,11 @@// Player redesign: the player never scrolls up. Scrolling stays on because Spotify's dismiss pull rides on// the list's own pan and starts only at its top, so the offset is clamped instead; the insets stay// Spotify's, since changing one mid-drag moves the offset under the finger.+//+// That pull is no scrub's, though: a finger dragging the progress bar that drifts down closed the player+// instead of seeking (issue #172). A scroll view lets a UIControl in it track a touch while its own pan+// runs on the same touch, so the list's pan is turned off from the moment the slider tracks a touch until+// it lets go.#import "Core/SGCore.h"#import "Redesigned/Kit/SGRKit.h"@@ -28,8 +33,60 @@ static void holdAtTop(UIScrollView *list) {}%end+#pragma mark - a scrub is not a pull++// The list whose pan a scrub turned off, so only that one is turned back on: a pan off for some other+// reason stays off. One finger scrubs at a time, so one is enough.+static __weak UIScrollView *sg_scrubbedList;++static void scrubBegan(UIView *slider) {+ UIScrollView *list = nil;+ for (UIView *v = slider.superview; v && !list; v = v.superview) {+ if ([v isKindOfClass:UIScrollView.class] && [v.accessibilityIdentifier isEqualToString:kListIdentifier]) list = (UIScrollView *)v;+ }+ static dispatch_once_t once;+ dispatch_once(&once, ^{ SGLog(@"redesign player: a scrub %@", list ? @"holds the list's pan" : @"found no list above the slider"); });+ if (!list.panGestureRecognizer.enabled) return;+ list.panGestureRecognizer.enabled = NO;+ sg_scrubbedList = list;+}++static void scrubEnded(void) {+ sg_scrubbedList.panGestureRecognizer.enabled = YES;+ sg_scrubbedList = nil;+}++// Shared/Haptics/ControlHaptics.x hooks the same begin for the scrub's taps; both call through.+%hook _TtCO17NowPlaying_ECMKit11ProgressBar6Slider+- (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {+ BOOL tracking = %orig;+ if (tracking) scrubBegan((UIView *)self);+ return tracking;+}++- (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {+ %orig;+ scrubEnded();+}++- (void)cancelTrackingWithEvent:(UIEvent *)event {+ %orig;+ scrubEnded();+}++// A lock, a call or the player going some other way can take the slider off screen mid-scrub, and then+// neither of the two above may come.+- (void)didMoveToWindow {+ %orig;+ if (!((UIView *)self).window) scrubEnded();+}+%end+%ctor {if (!SGRedesignedUI()) return;%init;- SGRequireClasses(@[@"_TtC21NowPlaying_ScrollImpl23NPVScrollViewController"]);+ SGRequireClasses(@[+ @"_TtC21NowPlaying_ScrollImpl23NPVScrollViewController",+ @"_TtCO17NowPlaying_ECMKit11ProgressBar6Slider",+ ]);}