Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.
C
feat: add gestures support
Vojtěch Škopekfb9db616fc46
diff --git a/tweak/Sources/Features/Gestures/GestureZones.m b/tweak/Sources/Features/Gestures/GestureZones.mnew file mode 100644index 00000000..44979e8e--- /dev/null+++ b/tweak/Sources/Features/Gestures/GestureZones.m@@ -0,0 +1,97 @@+// The grid the double tap is read against, and what each of its cells does.+#import "Core/SGCore.h"+#import "Gestures.h"++NSArray<NSString *> *SGGestureActionNames(void) {+ return @[@"Nothing", @"Seek back", @"Seek forward", @"Play or pause", @"Next track",+ @"Previous track", @"Shuffle", @"Repeat"];+}++NSArray<NSString *> *SGGestureSplitNames(void) {+ return @[@"Two columns", @"Three columns", @"Three by three"];+}++NSArray<NSNumber *> *SGGestureStepChoices(void) {+ return @[@5, @10, @15, @30];+}++NSInteger SGGestureSplit(void) {+ return SGInt(SGKeyGestureSplit, 1); // three columns+}++NSInteger SGGestureStepChoice(void) {+ NSInteger choice = SGInt(SGKeyGestureStep, 1); // ten seconds+ return choice >= 0 && choice < (NSInteger)SGGestureStepChoices().count ? choice : 1;+}++void SGGestureGrid(NSInteger *columns, NSInteger *rows) {+ NSInteger split = SGGestureSplit();+ *columns = split == 0 ? 2 : 3;+ *rows = split == 2 ? 3 : 1;+}++double SGGestureStep(void) {+ return SGGestureStepChoices()[(NSUInteger)SGGestureStepChoice()].doubleValue;+}++// Seek out to the sides, play or pause in the middle; a grid of three rows repeats the columns, so+// the split changes the cells to edit without changing what the player does until one is edited.+static NSArray<NSNumber *> *defaultZones(NSInteger columns, NSInteger rows) {+ NSMutableArray<NSNumber *> *zones = [NSMutableArray array];+ for (NSInteger row = 0; row < rows; row++) {+ for (NSInteger column = 0; column < columns; column++) {+ SGGestureAction action = SGGestureSeekForward;+ if (column == 0) action = SGGestureSeekBack;+ else if (columns == 3 && column == 1) action = SGGesturePlayPause;+ [zones addObject:@(action)];+ }+ }+ return zones;+}++// One saved layout per split, so switching between them and back keeps both.+static NSString *splitKey(NSInteger columns, NSInteger rows) {+ return [NSString stringWithFormat:@"%ldx%ld", (long)columns, (long)rows];+}++static NSDictionary *savedZones(void) {+ NSDictionary *saved = [NSUserDefaults.standardUserDefaults dictionaryForKey:SGKeyGestureZones];+ return [saved isKindOfClass:NSDictionary.class] ? saved : @{};+}++NSArray<NSNumber *> *SGGestureZones(void) {+ NSInteger columns, rows;+ SGGestureGrid(&columns, &rows);+ NSArray *zones = savedZones()[splitKey(columns, rows)];+ if (![zones isKindOfClass:NSArray.class] || zones.count != (NSUInteger)(columns * rows)) {+ return defaultZones(columns, rows);+ }+ for (id action in zones) if (![action isKindOfClass:NSNumber.class]) return defaultZones(columns, rows);+ return zones;+}++void SGSetGestureZone(NSInteger cell, SGGestureAction action) {+ NSInteger columns, rows;+ SGGestureGrid(&columns, &rows);+ if (cell < 0 || cell >= columns * rows) return;+ NSMutableArray<NSNumber *> *zones = [SGGestureZones() mutableCopy];+ zones[(NSUInteger)cell] = @(action);+ NSMutableDictionary *saved = [savedZones() mutableCopy];+ saved[splitKey(columns, rows)] = zones;+ [NSUserDefaults.standardUserDefaults setObject:saved forKey:SGKeyGestureZones];+}++void SGResetGestureZones(void) {+ [NSUserDefaults.standardUserDefaults removeObjectForKey:SGKeyGestureZones];+}++NSInteger SGGestureCellAt(CGPoint point, CGSize size) {+ NSInteger columns, rows;+ SGGestureGrid(&columns, &rows);+ if (size.width <= 0 || size.height <= 0) return -1;+ NSInteger column = (NSInteger)(point.x / size.width * columns);+ NSInteger row = (NSInteger)(point.y / size.height * rows);+ column = MAX(0, MIN(columns - 1, column));+ row = MAX(0, MIN(rows - 1, row));+ return row * columns + column;+}diff --git a/tweak/Sources/Features/Gestures/Gestures.h b/tweak/Sources/Features/Gestures/Gestures.hnew file mode 100644index 00000000..5ba83dd9--- /dev/null+++ b/tweak/Sources/Features/Gestures/Gestures.h@@ -0,0 +1,39 @@+// Double tap zones over the player's artwork: the artwork already answers a sideways swipe with the+// next track and a vertical drag with the cards below, so a double tap is what is left free.+#import <UIKit/UIKit.h>++#define SGKeyGestures @"spotifyglass.gestures"+#define SGKeyGestureSplit @"spotifyglass.gestures.split"+#define SGKeyGestureStep @"spotifyglass.gestures.step"+#define SGKeyGestureZones @"spotifyglass.gestures.zones"++typedef NS_ENUM(NSInteger, SGGestureAction) {+ SGGestureNothing = 0,+ SGGestureSeekBack,+ SGGestureSeekForward,+ SGGesturePlayPause,+ SGGestureNextTrack,+ SGGesturePreviousTrack,+ SGGestureShuffle,+ SGGestureRepeat,+};++NSArray<NSString *> *SGGestureActionNames(void);+NSArray<NSString *> *SGGestureSplitNames(void);+NSArray<NSNumber *> *SGGestureStepChoices(void);++// The split and the seek step as indices into the lists above, and what they mean.+NSInteger SGGestureSplit(void);+NSInteger SGGestureStepChoice(void);+// The split as a grid: 2x1, 3x1 or 3x3.+void SGGestureGrid(NSInteger *columns, NSInteger *rows);+double SGGestureStep(void);++// The action of every cell of the current split, row-major, one entry per cell.+NSArray<NSNumber *> *SGGestureZones(void);+void SGSetGestureZone(NSInteger cell, SGGestureAction action);+void SGResetGestureZones(void);+// Which cell of the current split holds `point`, in a view of size `size`.+NSInteger SGGestureCellAt(CGPoint point, CGSize size);++UIViewController *SGGesturesSettingsPage(void);diff --git a/tweak/Sources/Features/Gestures/Gestures.x b/tweak/Sources/Features/Gestures/Gestures.xnew file mode 100644index 00000000..f0eb1679--- /dev/null+++ b/tweak/Sources/Features/Gestures/Gestures.x@@ -0,0 +1,153 @@+// A double tap on the player, read against the grid Settings draws.+//+// Tree (trees/now-playing.txt): the artwork sits in AccessibleCollectionView, a full screen list of+// the queue scrolled sideways, so the recognizer goes on that and the grid is the screen. Spotify's+// controls are sibling units rather than children of it, so a tap on a button never reaches here.+//+// The player already answers a sideways swipe with the next track and a vertical drag with the+// cards below, which leaves the double tap as the one gesture free to take.+#import "Core/SGCore.h"+#import "Gestures.h"+#import "Headers/SPTNowPlayingPlaybackController.h"++static __weak SPTNowPlayingPlaybackControllerImplementation *sg_player;++#pragma mark - what a cell does++static void perform(SGGestureAction action) {+ SPTNowPlayingPlaybackControllerImplementation *player = sg_player;+ if (!player) return;+ switch (action) {+ case SGGestureNothing:+ break;+ case SGGestureSeekBack:+ if (player.seekingAllowed) [player seekBackwardBySeconds:SGGestureStep()];+ break;+ case SGGestureSeekForward:+ if (player.seekingAllowed) [player seekForwardBySeconds:SGGestureStep()];+ break;+ case SGGesturePlayPause:+ if (player.isPaused ? !player.disallowResuming : !player.disallowPausing) {+ [player setPaused:!player.isPaused];+ }+ break;+ case SGGestureNextTrack:+ if (player.canSkipNext) [player skipToNextWhileDragging:NO];+ break;+ case SGGesturePreviousTrack:+ [player skipToPreviousWhileDragging:NO];+ break;+ case SGGestureShuffle:+ [player setGlobalShuffleMode:!player.isShuffling];+ break;+ case SGGestureRepeat:+ [player toggleRepeatMode];+ break;+ }+}++#pragma mark - the recognizer++@interface SGGestureTarget : NSObject+@end++@implementation SGGestureTarget++- (void)doubleTapped:(UITapGestureRecognizer *)tap {+ // The recognizer outlives the switch: it stays on the player once attached, so the switch is+ // read here as well and the gesture stops the moment it goes off.+ if (!SGFlag(SGKeyGestures, NO)) return;+ // The host is the queue scrolled sideways, so a tap lands in content coordinates a few million+ // points out; its bounds origin is that scroll, and taking it off gives the point on screen.+ UIView *host = tap.view;+ CGRect visible = host.bounds;+ CGPoint point = [tap locationInView:host];+ point.x -= visible.origin.x;+ point.y -= visible.origin.y;+ NSInteger cell = SGGestureCellAt(point, visible.size);+ NSArray<NSNumber *> *zones = SGGestureZones();+ if (cell < 0 || cell >= (NSInteger)zones.count) return;+ perform((SGGestureAction)zones[(NSUInteger)cell].integerValue);+}++@end++static SGGestureTarget *target(void) {+ static SGGestureTarget *shared;+ static dispatch_once_t once;+ dispatch_once(&once, ^{ shared = [SGGestureTarget new]; });+ return shared;+}++// Spotify's own single tap on the player scrolls it to the cards below, and would fire on the first+// of a pair as well; every one above the artwork is asked to wait for the double tap to miss.+static void yieldSingleTaps(UIView *host, UITapGestureRecognizer *tap) {+ for (UIView *view = host; view; view = view.superview) {+ for (UIGestureRecognizer *other in view.gestureRecognizers) {+ if (other == tap || ![other isKindOfClass:UITapGestureRecognizer.class]) continue;+ if (((UITapGestureRecognizer *)other).numberOfTapsRequired != 1) continue;+ [other requireGestureRecognizerToFail:tap];+ }+ }+}++static char kTapKey, kSeenKey;++// Spotify adds its own recognizers as the player's controllers load, which is not ordered against+// this hook: the count of what stands above the artwork is watched so a later one still yields.+static NSUInteger tapsAbove(UIView *host) {+ NSUInteger count = 0;+ for (UIView *view = host; view; view = view.superview) count += view.gestureRecognizers.count;+ return count;+}++static void attachTap(UIView *host) {+ UITapGestureRecognizer *tap = objc_getAssociatedObject(host, &kTapKey);+ if (!tap) {+ tap = [[UITapGestureRecognizer alloc] initWithTarget:target() action:@selector(doubleTapped:)];+ tap.numberOfTapsRequired = 2;+ [host addGestureRecognizer:tap];+ objc_setAssociatedObject(host, &kTapKey, tap, OBJC_ASSOCIATION_RETAIN_NONATOMIC);+ }+ NSNumber *seen = objc_getAssociatedObject(host, &kSeenKey);+ NSUInteger now = tapsAbove(host);+ if (seen.unsignedIntegerValue == now) return;+ objc_setAssociatedObject(host, &kSeenKey, @(now), OBJC_ASSOCIATION_RETAIN_NONATOMIC);+ yieldSingleTaps(host, tap);+}++#pragma mark - hooks++%hook SPTNowPlayingPlaybackControllerImplementation+- (id)initWithPlayer:(id)player testManager:(id)manager inStreamClient:(id)client {+ id controller = %orig;+ sg_player = controller;+ return controller;+}+%end++// A single tap on the cover is Spotify's way into the tilt mode, the artwork alone in 3D. That is+// the half of a double tap that misses, so while the zones are on it would open on the way to every+// gesture; the tap goes back to Spotify with the switch.+%hook _TtC35CreativeWorkCommons_CoverArtTiltKit16CoverArtTiltView+- (void)handleTap {+ if (SGFlag(SGKeyGestures, NO)) return;+ %orig;+}+%end++%hook _TtC35NowPlaying_ContentLayerPlatformImpl24AccessibleCollectionView+- (void)layoutSubviews {+ %orig;+ if (SGFlag(SGKeyGestures, NO)) attachTap((UIView *)self);+}+%end++%ctor {+ %init;+ SGRequireClasses(@[+ @"SPTNowPlayingPlaybackControllerImplementation",+ @"_TtC35NowPlaying_ContentLayerPlatformImpl24AccessibleCollectionView",+ @"_TtC35CreativeWorkCommons_CoverArtTiltKit16CoverArtTiltView",+ ]);+}diff --git a/tweak/Sources/Features/Gestures/GesturesSettings.m b/tweak/Sources/Features/Gestures/GesturesSettings.mnew file mode 100644index 00000000..7c75d131--- /dev/null+++ b/tweak/Sources/Features/Gestures/GesturesSettings.m@@ -0,0 +1,241 @@+// The Gestures page: the grid over a player-shaped preview, a cell tapped to say what a double tap+// there does, under it the split, the seek step and a reset.+#import "Core/SGCore.h"+#import "Settings/SGPage.h"+#import "Settings/SGPageStyle.h"+#import "Gestures.h"++static const CGFloat kPreviewHeight = 260;+static const CGFloat kPreviewRatio = 0.46; // a phone, standing++static NSString *cellLabel(SGGestureAction action) {+ if (action == SGGestureSeekBack) return [NSString stringWithFormat:@"−%gs", SGGestureStep()];+ if (action == SGGestureSeekForward) return [NSString stringWithFormat:@"+%gs", SGGestureStep()];+ NSArray<NSString *> *names = SGGestureActionNames();+ return action >= 0 && action < (NSInteger)names.count ? names[(NSUInteger)action] : @"";+}++#pragma mark - the preview++// The grid the player is read against, drawn at the size of a phone and read the same way, so what+// the page shows and what the double tap does cannot drift apart.+@interface SGZoneGridView : UIView+@property (nonatomic, copy) void (^picked)(NSInteger cell);+- (void)reload;+@end++@implementation SGZoneGridView {+ NSMutableArray<UILabel *> *_labels;+ UIView *_frame;+}++- (instancetype)initWithFrame:(CGRect)frame {+ if (!(self = [super initWithFrame:frame])) return nil;+ _labels = [NSMutableArray array];+ _frame = [[UIView alloc] initWithFrame:CGRectZero];+ _frame.layer.cornerRadius = 18;+ _frame.layer.cornerCurve = kCACornerCurveContinuous;+ _frame.layer.borderWidth = 1;+ _frame.layer.borderColor = [UIColor colorWithWhite:1 alpha:0.22].CGColor;+ _frame.backgroundColor = [UIColor colorWithWhite:1 alpha:0.05];+ _frame.clipsToBounds = YES;+ [self addSubview:_frame];+ UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped:)];+ [_frame addGestureRecognizer:tap];+ [self reload];+ return self;+}++- (void)reload {+ NSArray<NSNumber *> *zones = SGGestureZones();+ while (_labels.count > zones.count) {+ [_labels.lastObject removeFromSuperview];+ [_labels removeLastObject];+ }+ while (_labels.count < zones.count) {+ UILabel *label = [UILabel new];+ label.font = SGSubtitleFont();+ label.textColor = UIColor.whiteColor;+ label.textAlignment = NSTextAlignmentCenter;+ label.numberOfLines = 2;+ label.layer.borderWidth = 0.5;+ label.layer.borderColor = [UIColor colorWithWhite:1 alpha:0.18].CGColor;+ [_frame addSubview:label];+ [_labels addObject:label];+ }+ [zones enumerateObjectsUsingBlock:^(NSNumber *action, NSUInteger index, BOOL *stop) {+ UILabel *label = self->_labels[index];+ SGGestureAction value = (SGGestureAction)action.integerValue;+ label.text = cellLabel(value);+ label.textColor = value == SGGestureNothing ? SGGrey() : UIColor.whiteColor;+ }];+ [self setNeedsLayout];+}++- (void)layoutSubviews {+ [super layoutSubviews];+ CGFloat height = self.bounds.size.height;+ CGFloat width = height * kPreviewRatio;+ _frame.frame = CGRectMake((self.bounds.size.width - width) / 2, 0, width, height);++ NSInteger columns, rows;+ SGGestureGrid(&columns, &rows);+ CGFloat cellWidth = width / columns, cellHeight = height / rows;+ [_labels enumerateObjectsUsingBlock:^(UILabel *label, NSUInteger index, BOOL *stop) {+ NSInteger column = (NSInteger)index % columns, row = (NSInteger)index / columns;+ label.frame = CGRectMake(column * cellWidth, row * cellHeight, cellWidth, cellHeight);+ }];+}++- (void)tapped:(UITapGestureRecognizer *)tap {+ NSInteger cell = SGGestureCellAt([tap locationInView:_frame], _frame.bounds.size);+ if (cell >= 0 && self.picked) self.picked(cell);+}++@end++#pragma mark - the page++@interface SGGesturesPage : SGPage+@end++@implementation SGGesturesPage {+ SGZoneGridView *_grid;+ UIView *_header;+ UIView *_footer;+}++- (instancetype)init {+ if (!(self = [super initWithStyle:UITableViewStyleInsetGrouped])) return nil;+ self.title = @"Gestures";+ return self;+}++- (void)viewDidLoad {+ [super viewDidLoad];+ _grid = [[SGZoneGridView alloc] initWithFrame:CGRectMake(0, 12, 0, kPreviewHeight)];+ __weak typeof(self) weakSelf = self;+ _grid.picked = ^(NSInteger cell) { [weakSelf pickActionFor:cell]; };+ // The table sets its header's width itself, and the grid follows it, so the header never has to+ // be handed back during layout: doing that lays the table out again and never settles.+ _grid.autoresizingMask = UIViewAutoresizingFlexibleWidth;+ _header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, kPreviewHeight + 24)];+ _header.autoresizingMask = UIViewAutoresizingFlexibleWidth;+ [_header addSubview:_grid];+ self.tableView.tableHeaderView = _header;+ _footer = SGNote(@"The player answers a sideways swipe with the next track and a drag upwards "+ "with the cards below, so the double tap is what is left. Spotify's own buttons "+ "sit above the grid and keep their taps.");+ self.tableView.tableFooterView = _footer;+}++- (void)viewWillLayoutSubviews {+ [super viewWillLayoutSubviews];+ SGFitNote(self.tableView, _footer, 16, 24);+}++- (void)viewDidLayoutSubviews {+ [super viewDidLayoutSubviews];+ SGInsetForBars(self.tableView);+}++- (void)refresh {+ [_grid reload];+ [self.tableView reloadData];+}++- (void)pickActionFor:(NSInteger)cell {+ NSArray<NSString *> *names = SGGestureActionNames();+ UIAlertController *sheet = [UIAlertController alertControllerWithTitle:@"Double tap here"+ message:nil+ preferredStyle:UIAlertControllerStyleActionSheet];+ [names enumerateObjectsUsingBlock:^(NSString *name, NSUInteger index, BOOL *stop) {+ [sheet addAction:[UIAlertAction actionWithTitle:name style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {+ SGSetGestureZone(cell, (SGGestureAction)index);+ [self refresh];+ }]];+ }];+ [sheet addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]];+ sheet.popoverPresentationController.sourceView = _grid;+ sheet.popoverPresentationController.sourceRect = _grid.bounds;+ [self presentViewController:sheet animated:YES completion:nil];+}++- (NSInteger)numberOfSectionsInTableView:(UITableView *)table {+ return 4;+}++- (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section {+ switch (section) {+ case 1: return (NSInteger)SGGestureSplitNames().count;+ case 2: return (NSInteger)SGGestureStepChoices().count;+ default: return 1;+ }+}++- (UIView *)tableView:(UITableView *)table viewForHeaderInSection:(NSInteger)section {+ if (section == 1) return SGSectionHeader(table, @"Split");+ if (section == 2) return SGSectionHeader(table, @"Seek step");+ return nil;+}++- (CGFloat)tableView:(UITableView *)table heightForHeaderInSection:(NSInteger)section {+ return section == 1 || section == 2 ? SGSectionHeaderHeight : CGFLOAT_MIN;+}++- (CGFloat)tableView:(UITableView *)table heightForFooterInSection:(NSInteger)section {+ return CGFLOAT_MIN;+}++- (UITableViewCell *)tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)path {+ UITableViewCell *cell = SGDequeueCell(table, @"gesture");+ switch (path.section) {+ case 0: {+ SGFillCell(cell, @"Double tap the player", @"Tap a cell above to say what it does", nil, nil);+ UISwitch *toggle = [UISwitch new];+ toggle.onTintColor = SGGreen();+ toggle.on = SGFlag(SGKeyGestures, NO);+ [toggle addTarget:self action:@selector(toggled:) forControlEvents:UIControlEventValueChanged];+ cell.accessoryView = toggle;+ break;+ }+ case 1:+ case 2: {+ BOOL split = path.section == 1;+ NSString *title = split ? SGGestureSplitNames()[(NSUInteger)path.row]+ : [NSString stringWithFormat:@"%@ seconds", SGGestureStepChoices()[(NSUInteger)path.row]];+ SGFillCell(cell, title, nil, nil, nil);+ cell.selectionStyle = UITableViewCellSelectionStyleDefault;+ if (path.row == (split ? SGGestureSplit() : SGGestureStepChoice())) {+ UIImageView *tick = SGSymbolView(@"checkmark", 13, UIImageSymbolWeightSemibold, 16);+ tick.tintColor = SGGreen();+ cell.accessoryView = tick;+ }+ break;+ }+ default:+ SGFillCell(cell, @"Start over", @"Every cell back to seeking and play or pause", nil, @"arrow.uturn.backward");+ cell.selectionStyle = UITableViewCellSelectionStyleDefault;+ break;+ }+ return cell;+}++- (void)tableView:(UITableView *)table didSelectRowAtIndexPath:(NSIndexPath *)path {+ [table deselectRowAtIndexPath:path animated:YES];+ if (path.section == 1) SGSetInt(SGKeyGestureSplit, path.row);+ else if (path.section == 2) SGSetInt(SGKeyGestureStep, path.row);+ else if (path.section == 3) SGResetGestureZones();+ else return;+ [self refresh];+}++- (void)toggled:(UISwitch *)toggle {+ SGSetEnabled(SGKeyGestures, toggle.on);+}++@end++UIViewController *SGGesturesSettingsPage(void) {+ return [SGGesturesPage new];+}diff --git a/tweak/Sources/Features/NowPlaying/NowPlayingSettings.m b/tweak/Sources/Features/NowPlaying/NowPlayingSettings.mindex 39c7cb7e..1d51912a 100644--- a/tweak/Sources/Features/NowPlaying/NowPlayingSettings.m+++ b/tweak/Sources/Features/NowPlaying/NowPlayingSettings.m@@ -2,6 +2,7 @@#import "NowPlaying.h"#import "Features/Declutter/Declutter.h"#import "Features/Flags/Flags.h"+#import "Features/Gestures/Gestures.h"static UIViewController *lyricsPage(void) {return [[SGModPage alloc] initWithTitle:@"Lyrics" intro:SGRestartNote sections:@[@@ -19,6 +20,10 @@ static UIViewController *lyricsPage(void) {UIViewController *SGNowPlayingSettingsPage(void) {NSMutableArray<SGModSection *> *sections = [NSMutableArray arrayWithArray:@[+ SGSection(nil, @[+ SGPageRow(@"Gestures", ^UIViewController *{ return SGGesturesSettingsPage(); }),+ SGPageRow(@"Lyrics", ^UIViewController *{ return lyricsPage(); }),+ ]),SGSection(@"Liquid Glass", @[SGOptionRow(@"Now playing bar", @"Glass card with round artwork", SGKeyNowPlayingBar),SGOptionRow(@"Artwork background", @"The cover blurred and dimmed behind the player instead of the flat album colour", SGKeyPlayerBackdrop),@@ -60,11 +65,6 @@ UIViewController *SGNowPlayingSettingsPage(void) {]),]];[sections addObjectsFromArray:SGPlaybackSections()];- [sections addObjectsFromArray:@[- SGLockScreenSection(),- SGSection(nil, @[- SGPageRow(@"Lyrics", ^UIViewController *{ return lyricsPage(); }),- ]),- ]];+ [sections addObject:SGLockScreenSection()];return [[SGModPage alloc] initWithTitle:@"Player" intro:SGRestartNote sections:sections footer:nil];}diff --git a/tweak/Sources/Headers/SPTNowPlayingPlaybackController.h b/tweak/Sources/Headers/SPTNowPlayingPlaybackController.hnew file mode 100644index 00000000..de9aadcf--- /dev/null+++ b/tweak/Sources/Headers/SPTNowPlayingPlaybackController.h@@ -0,0 +1,19 @@+// The object the player's own controls drive: the seek amounts are named in seconds by the+// selectors themselves, so a gesture needs no unit of its own.+#import <Foundation/Foundation.h>++@interface SPTNowPlayingPlaybackControllerImplementation : NSObject+- (void)seekForwardBySeconds:(double)seconds;+- (void)seekBackwardBySeconds:(double)seconds;+- (void)skipToNextWhileDragging:(BOOL)dragging;+- (void)skipToPreviousWhileDragging:(BOOL)dragging;+- (void)setPaused:(BOOL)paused;+- (void)setGlobalShuffleMode:(BOOL)shuffling;+- (void)toggleRepeatMode;+@property (nonatomic, readonly, getter=isPaused) BOOL paused;+@property (nonatomic, readonly, getter=isShuffling) BOOL shuffling;+@property (nonatomic, readonly) BOOL seekingAllowed;+@property (nonatomic, readonly) BOOL canSkipNext;+@property (nonatomic, readonly) BOOL disallowPausing;+@property (nonatomic, readonly) BOOL disallowResuming;+@end