Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Commit 2191478

Browse files
committed
an option to replace Previous & Next button with Fast forward & Rewind button
1 parent 39849ca commit 2191478

File tree

2 files changed

+41
-14
lines changed

2 files changed

+41
-14
lines changed

Settings.xm

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ extern BOOL hidePaidPromotionCard();
5151
exit(0);
5252
}];
5353

54+
YTSettingsSectionItem *replacePreviousAndNextButton = [[%c(YTSettingsSectionItem) alloc] initWithTitle:LOC(@"REPLACE_PREVIOUS_NEXT_BUTTON") titleDescription:LOC(@"REPLACE_PREVIOUS_NEXT_BUTTON_DESC")];
55+
replacePreviousAndNextButton.hasSwitch = YES;
56+
replacePreviousAndNextButton.switchVisible = YES;
57+
replacePreviousAndNextButton.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"replacePreviousAndNextButton_enabled"];
58+
replacePreviousAndNextButton.switchBlock = ^BOOL (YTSettingsCell *cell, BOOL enabled) {
59+
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"replacePreviousAndNextButton_enabled"];
60+
return YES;
61+
};
62+
5463
YTSettingsSectionItem *fixGoogleSigin = [[%c(YTSettingsSectionItem) alloc] initWithTitle:LOC(@"FIX_GOOGLE_SIGNIN") titleDescription:LOC(@"FIX_GOOGLE_SIGNIN_DESC")];
5564
fixGoogleSigin.hasSwitch = YES;
5665
fixGoogleSigin.switchVisible = YES;
@@ -177,7 +186,7 @@ extern BOOL hidePaidPromotionCard();
177186
return YES;
178187
};
179188

180-
NSMutableArray <YTSettingsSectionItem *> *sectionItems = [NSMutableArray arrayWithArray:@[killApp, autoFull, castConfirm, ytMiniPlayer, fixGoogleSigin, hideAutoplaySwitch, hideCC, hideHUD, hidePaidPromotionCard, hidePreviousAndNextButton, hideHoverCard, bigYTMiniPlayer, oledDarkMode, oledKeyBoard, reExplore]];
189+
NSMutableArray <YTSettingsSectionItem *> *sectionItems = [NSMutableArray arrayWithArray:@[killApp, autoFull, castConfirm, ytMiniPlayer, fixGoogleSigin, hideAutoplaySwitch, hideCC, hideHUD, hidePaidPromotionCard, hidePreviousAndNextButton, hideHoverCard, bigYTMiniPlayer, oledDarkMode, oledKeyBoard, replacePreviousAndNextButton, reExplore]];
181190
[delegate setSectionItems:sectionItems forCategory:uYouPlusSection title:@"uYouPlus" titleDescription:nil headerHidden:NO];
182191
}
183192

uYouPlus.xm

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ NSBundle *uYouPlusBundle() {
3030
}
3131
NSBundle *tweakBundle = uYouPlusBundle();
3232

33+
// Keychain patching
3334
static NSString *accessGroupID() {
3435
NSDictionary *query = [NSDictionary dictionaryWithObjectsAndKeys:
3536
(__bridge NSString *)kSecClassGenericPassword, (__bridge NSString *)kSecClass,
@@ -93,6 +94,9 @@ BOOL hidePaidPromotionCard() {
9394
BOOL fixGoogleSigin() {
9495
return [[NSUserDefaults standardUserDefaults] boolForKey:@"fixGoogleSigin_enabled"];
9596
}
97+
BOOL replacePreviousAndNextButton() {
98+
return [[NSUserDefaults standardUserDefaults] boolForKey:@"replacePreviousAndNextButton_enabled"];
99+
}
96100

97101
# pragma mark - Tweaks
98102
// Enable Reorder videos from playlist while on the Watch page - @PoomSmart
@@ -114,7 +118,7 @@ BOOL fixGoogleSigin() {
114118
}
115119
%end
116120

117-
// Hide CC / Autoplay switch / Next & Previous button
121+
// Hide CC / Autoplay switch
118122
%hook YTMainAppControlsOverlayView
119123
- (void)setClosedCaptionsOrSubtitlesButtonAvailable:(BOOL)arg1 { // hide CC button
120124
if (hideCC()) { return %orig(NO); }
@@ -124,15 +128,22 @@ BOOL fixGoogleSigin() {
124128
if (hideAutoplaySwitch()) {}
125129
else { return %orig; }
126130
}
127-
- (void)layoutSubviews { // hide Next & Previous button
128-
%orig;
129-
if (hidePreviousAndNextButton()) {
130-
MSHookIvar<YTMainAppControlsOverlayView *>(self, "_nextButton").hidden = YES;
131-
MSHookIvar<YTMainAppControlsOverlayView *>(self, "_previousButton").hidden = YES;
132-
MSHookIvar<YTTransportControlsButtonView *>(self, "_nextButtonView").hidden = YES;
133-
MSHookIvar<YTTransportControlsButtonView *>(self, "_previousButtonView").hidden = YES;
134-
}
135-
}
131+
%end
132+
133+
// Hide Next & Previous button
134+
%group gHidePreviousAndNextButton
135+
%hook YTColdConfig
136+
- (BOOL)removeNextPaddleForSingletonVideos { return YES; }
137+
- (BOOL)removePreviousPaddleForSingletonVideos { return YES; }
138+
%end
139+
%end
140+
141+
// Replace Next & Previous button with Fast forward & Rewind button
142+
%group gReplacePreviousAndNextButton
143+
%hook YTColdConfig
144+
- (BOOL)replaceNextPaddleWithFastForwardButtonForSingletonVods { return YES; }
145+
- (BOOL)replacePreviousPaddleWithRewindButtonForSingletonVods { return YES; }
146+
%end
136147
%end
137148

138149
// Hide HUD Messages
@@ -250,6 +261,7 @@ BOOL fixGoogleSigin() {
250261
// YouRememberCaption: https://poomsmart.github.io/repo/depictions/youremembercaption.html
251262
%hook YTColdConfig
252263
- (BOOL)respectDeviceCaptionSetting { return NO; }
264+
- (BOOL)isLandscapeEngagementPanelSwipeRightToDismissEnabled { return YES; }
253265
%end
254266

255267
// NOYTPremium - https://github.com/PoomSmart/NoYTPremium/
@@ -350,9 +362,9 @@ BOOL fixGoogleSigin() {
350362
// Prevent uYou player bar from showing when not playing downloaded media
351363
%hook PlayerManager
352364
- (void)pause {
353-
if (isnan([self progress]))
354-
return;
355-
%orig;
365+
if (isnan([self progress]))
366+
return;
367+
%orig;
356368
}
357369
%end
358370

@@ -874,6 +886,12 @@ static void replaceTab(YTIGuideResponse *response) {
874886
if (bigYTMiniPlayer() && (UIDevice.currentDevice.userInterfaceIdiom != UIUserInterfaceIdiomPad)) {
875887
%init(Main);
876888
}
889+
if (hidePreviousAndNextButton()) {
890+
%init(gHidePreviousAndNextButton);
891+
}
892+
if (replacePreviousAndNextButton()) {
893+
%init(gReplacePreviousAndNextButton);
894+
}
877895
if (@available(iOS 16, *)) {
878896
%init(iOS16);
879897
}

0 commit comments

Comments
 (0)