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

fix: Sort and Mix are on the ⋯ sheet the first time it opens

Vojtěch Škopekdef7470a3428
diff --git a/harness/playlist/main.m b/harness/playlist/main.m
index 57417245..3b30a440 100644
--- a/harness/playlist/main.m
+++ b/harness/playlist/main.m
@@ -431,7 +431,11 @@ static void buildLikedSongs(UIViewController *page, CGFloat W) {
// The curation row over the first track (own-playlist/01.txt:33): Add, Mix, Notes, Video, Edit, Sort and
// Name & details in a scroll view, of which the redesign keeps Sort and Mix.
- UIView *curation = box(list, _TtC35ListUXPlatform_FreeTierPlaylistImpl25ElementCollectionViewCell.class,
+ // `nohandover` builds the row in a cell the redesign's hook never sees, the way the device has it when
+ // the collection has not laid the closed-up cell out yet: the sheet then has to find the row itself.
+ BOOL handover = ![NSProcessInfo.processInfo.arguments containsObject:@"nohandover"];
+ UIView *curation = box(list, handover ? _TtC35ListUXPlatform_FreeTierPlaylistImpl25ElementCollectionViewCell.class
+ : UICollectionViewCell.class,
CGRectMake(0, tracksTop - 52, W, 52), nil);
UIView *toolbar = box(curation, UIView.class, curation.bounds, @"PlaylistCuration.Row.CurationActionsToolbar");
toolbar.layer.backgroundColor = [UIColor colorWithWhite:0.07 alpha:1].CGColor;
@@ -740,12 +744,14 @@ static void buildLikedSongs(UIViewController *page, CGFloat W) {
}
// The list asks every cell how tall it wants to be, which is where the curation row answers 0 and
// closes up: the harness's list is a plain scroll view, so it asks the way ListLayout does.
- UICollectionViewLayoutAttributes *wanted = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:
- [NSIndexPath indexPathForItem:0 inSection:0]];
- wanted.frame = curation.frame;
- CGSize answered = [(UICollectionViewCell *)curation preferredLayoutAttributesFittingAttributes:wanted].size;
- curation.frame = CGRectMake(0, curation.frame.origin.y, answered.width, answered.height);
- NSLog(@"[harness] the curation row answered %.0fpt tall", answered.height);
+ if (handover) {
+ UICollectionViewLayoutAttributes *wanted = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:
+ [NSIndexPath indexPathForItem:0 inSection:0]];
+ wanted.frame = curation.frame;
+ CGSize answered = [(UICollectionViewCell *)curation preferredLayoutAttributesFittingAttributes:wanted].size;
+ curation.frame = CGRectMake(0, curation.frame.origin.y, answered.width, answered.height);
+ NSLog(@"[harness] the curation row answered %.0fpt tall", answered.height);
+ }
});
// The ⋯ sheet: tapping the pinned button records the page, and the menu that opens a moment later takes
@@ -756,6 +762,7 @@ static void buildLikedSongs(UIViewController *page, CGFloat W) {
for (UIView *sub in page.view.subviews) {
if ([NSStringFromClass(sub.class) isEqualToString:@"SGRMirrorButton"]) pinnedMore = (UIControl *)sub;
}
+ [pinnedMore sendActionsForControlEvents:UIControlEventTouchDown];
[pinnedMore sendActionsForControlEvents:UIControlEventTouchUpInside];
_TtC24ContextMenu_InternalImpl25ContextMenuViewController *menu =
[_TtC24ContextMenu_InternalImpl25ContextMenuViewController new];
@@ -769,8 +776,9 @@ static void buildLikedSongs(UIViewController *page, CGFloat W) {
if (!row.hidden) [rows addObject:[NSString stringWithFormat:@"%@ %@", row.accessibilityLabel,
NSStringFromCGRect(row.frame)]];
}
- NSLog(@"[harness] the sheet's header is %@ %.0fpt: %@", block ? NSStringFromClass(block.class) : @"MISSING",
- block.bounds.size.height, [rows componentsJoinedByString:@", "]);
+ NSLog(@"[harness] the sheet's header is %@ %.0fpt: %@ (handover %d)",
+ block ? NSStringFromClass(block.class) : @"MISSING", block.bounds.size.height,
+ [rows componentsJoinedByString:@", "], handover);
for (UIView *row in block.subviews) {
if (!row.hidden) [(UIControl *)row sendActionsForControlEvents:UIControlEventTouchUpInside];
}
diff --git a/tweak/Sources/Redesigned/Kit/SGRActionRow.m b/tweak/Sources/Redesigned/Kit/SGRActionRow.m
index 6c47c8d1..bb7293ef 100644
--- a/tweak/Sources/Redesigned/Kit/SGRActionRow.m
+++ b/tweak/Sources/Redesigned/Kit/SGRActionRow.m
@@ -344,6 +344,10 @@ static const CGFloat kCornerSide = 16;
// The page whose pinned ⋯ was last tapped, and when: what tells the sheet that opens a moment later which
// page's menu it is. The same trick Shared/Player/SpeedPitchMenu.x plays on the player's more button, but
// from this side of it, since this button is the redesign's own and knows its own page.
+//
+// Recorded on touch down rather than on touch up: the button's own -sgr_tap is registered first and fires
+// Spotify's ⋯ from the same event, so a sheet Spotify puts up in that same turn would ask which page it
+// belonged to before a target added after -sgr_tap had answered.
static __weak UIView *sg_morePage;
static NSTimeInterval sg_moreTappedAt;
static char kRecorderKey;
@@ -374,7 +378,7 @@ SGRMirrorButton *SGRPinnedMore(UIView *page, const void *key, UIView *source) {
// Held by the button, which is held by the page, so the recorder lives exactly as long as both.
SGRPinnedMoreRecorder *recorder = [SGRPinnedMoreRecorder new];
objc_setAssociatedObject(button, &kRecorderKey, recorder, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
- [button addTarget:recorder action:@selector(sgr_moreTapped:) forControlEvents:UIControlEventTouchUpInside];
+ [button addTarget:recorder action:@selector(sgr_moreTapped:) forControlEvents:UIControlEventTouchDown];
objc_setAssociatedObject(page, key, button, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
// Over the page's list and its header both, and put back on top whenever Spotify adds to the page.
diff --git a/tweak/Sources/Redesigned/Playlist/PlaylistMenu.x b/tweak/Sources/Redesigned/Playlist/PlaylistMenu.x
index a51e1e05..60b259be 100644
--- a/tweak/Sources/Redesigned/Playlist/PlaylistMenu.x
+++ b/tweak/Sources/Redesigned/Playlist/PlaylistMenu.x
@@ -296,13 +296,28 @@ static UITableView *tableIn(UIView *root, int depth) {
return nil;
}
-// The page this sheet belongs to, decided once: the pinned ⋯ that opened it says which page it is on, and
-// only for the few seconds after its tap.
+// The curation row of the page, held from the cell's own pass where there has been one, and looked for on
+// the page where there has not: the row is a cell closed up to nothing, and a collection view lays out
+// what it has to draw, so a page opened and left alone can reach the sheet before that cell has ever run
+// a pass. It was the only thing keeping Mix off the sheet, and the sheet only came right after the menu
+// had been opened and closed a few times (device 2026-09-20). The walk is the page's live views, which is
+// the cells on screen and no more, and it is done once per sheet.
+static UIView *curationIn(UIView *page) {
+ UIView *held = objc_getAssociatedObject(page, &kToolbarKey);
+ if (held) return held;
+ UIView *found = SGRFindByIdentifier(page, SGRPlaylistCurationIdentifier, NULL);
+ if (found) objc_setAssociatedObject(page, &kToolbarKey, found, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+ return found;
+}
+
+// The page this sheet belongs to, decided once and only from the ⋯ that opened it. What the page has to
+// show is decided pass by pass below, never here: a sheet turned down because the page was not ready yet
+// would stay turned down for as long as it was open.
static UIView *pageFor(UIViewController *menu) {
id decided = objc_getAssociatedObject(menu, &kDecidedKey);
if (decided) return decided == NSNull.null ? nil : decided;
UIView *page = SGRPinnedMoreRecentPage();
- if (page && !objc_getAssociatedObject(page, &kToolbarKey)) page = nil;
+ if (page) curationIn(page);
objc_setAssociatedObject(menu, &kDecidedKey, page ?: (id)NSNull.null, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
return page;
}
@@ -338,11 +353,10 @@ static void install(UIViewController *menu) {
pillsIn(objc_getAssociatedObject(page, &kToolbarKey), &sort, &mix);
sort = objc_getAssociatedObject(page, &kSortKey) ?: sort;
[block showSort:sort mix:mix];
+ // Nothing to show yet is not an answer: the page fills in as it lays out, and the next pass is asked
+ // again rather than the sheet being written off.
CGFloat height = [block wantedHeight];
- if (height < 1) {
- objc_setAssociatedObject(menu, &kDecidedKey, NSNull.null, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
- return;
- }
+ if (height < 1) return;
CGRect frame = CGRectMake(0, 0, width, height);
UIView *placed = inFooter ? table.tableFooterView : table.tableHeaderView;