an option to replace Previous & Next button with Fast forward & Rewind button

This commit is contained in:
qnblackcat
2022-09-07 21:30:15 +07:00
parent 39849cac51
commit 2191478712
2 changed files with 41 additions and 14 deletions
+10 -1
View File
@@ -51,6 +51,15 @@ extern BOOL hidePaidPromotionCard();
exit(0); exit(0);
}]; }];
YTSettingsSectionItem *replacePreviousAndNextButton = [[%c(YTSettingsSectionItem) alloc] initWithTitle:LOC(@"REPLACE_PREVIOUS_NEXT_BUTTON") titleDescription:LOC(@"REPLACE_PREVIOUS_NEXT_BUTTON_DESC")];
replacePreviousAndNextButton.hasSwitch = YES;
replacePreviousAndNextButton.switchVisible = YES;
replacePreviousAndNextButton.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"replacePreviousAndNextButton_enabled"];
replacePreviousAndNextButton.switchBlock = ^BOOL (YTSettingsCell *cell, BOOL enabled) {
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"replacePreviousAndNextButton_enabled"];
return YES;
};
YTSettingsSectionItem *fixGoogleSigin = [[%c(YTSettingsSectionItem) alloc] initWithTitle:LOC(@"FIX_GOOGLE_SIGNIN") titleDescription:LOC(@"FIX_GOOGLE_SIGNIN_DESC")]; YTSettingsSectionItem *fixGoogleSigin = [[%c(YTSettingsSectionItem) alloc] initWithTitle:LOC(@"FIX_GOOGLE_SIGNIN") titleDescription:LOC(@"FIX_GOOGLE_SIGNIN_DESC")];
fixGoogleSigin.hasSwitch = YES; fixGoogleSigin.hasSwitch = YES;
fixGoogleSigin.switchVisible = YES; fixGoogleSigin.switchVisible = YES;
@@ -177,7 +186,7 @@ extern BOOL hidePaidPromotionCard();
return YES; return YES;
}; };
NSMutableArray <YTSettingsSectionItem *> *sectionItems = [NSMutableArray arrayWithArray:@[killApp, autoFull, castConfirm, ytMiniPlayer, fixGoogleSigin, hideAutoplaySwitch, hideCC, hideHUD, hidePaidPromotionCard, hidePreviousAndNextButton, hideHoverCard, bigYTMiniPlayer, oledDarkMode, oledKeyBoard, reExplore]]; NSMutableArray <YTSettingsSectionItem *> *sectionItems = [NSMutableArray arrayWithArray:@[killApp, autoFull, castConfirm, ytMiniPlayer, fixGoogleSigin, hideAutoplaySwitch, hideCC, hideHUD, hidePaidPromotionCard, hidePreviousAndNextButton, hideHoverCard, bigYTMiniPlayer, oledDarkMode, oledKeyBoard, replacePreviousAndNextButton, reExplore]];
[delegate setSectionItems:sectionItems forCategory:uYouPlusSection title:@"uYouPlus" titleDescription:nil headerHidden:NO]; [delegate setSectionItems:sectionItems forCategory:uYouPlusSection title:@"uYouPlus" titleDescription:nil headerHidden:NO];
} }
+31 -13
View File
@@ -30,6 +30,7 @@ NSBundle *uYouPlusBundle() {
} }
NSBundle *tweakBundle = uYouPlusBundle(); NSBundle *tweakBundle = uYouPlusBundle();
// Keychain patching
static NSString *accessGroupID() { static NSString *accessGroupID() {
NSDictionary *query = [NSDictionary dictionaryWithObjectsAndKeys: NSDictionary *query = [NSDictionary dictionaryWithObjectsAndKeys:
(__bridge NSString *)kSecClassGenericPassword, (__bridge NSString *)kSecClass, (__bridge NSString *)kSecClassGenericPassword, (__bridge NSString *)kSecClass,
@@ -93,6 +94,9 @@ BOOL hidePaidPromotionCard() {
BOOL fixGoogleSigin() { BOOL fixGoogleSigin() {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"fixGoogleSigin_enabled"]; return [[NSUserDefaults standardUserDefaults] boolForKey:@"fixGoogleSigin_enabled"];
} }
BOOL replacePreviousAndNextButton() {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"replacePreviousAndNextButton_enabled"];
}
# pragma mark - Tweaks # pragma mark - Tweaks
// Enable Reorder videos from playlist while on the Watch page - @PoomSmart // Enable Reorder videos from playlist while on the Watch page - @PoomSmart
@@ -114,7 +118,7 @@ BOOL fixGoogleSigin() {
} }
%end %end
// Hide CC / Autoplay switch / Next & Previous button // Hide CC / Autoplay switch
%hook YTMainAppControlsOverlayView %hook YTMainAppControlsOverlayView
- (void)setClosedCaptionsOrSubtitlesButtonAvailable:(BOOL)arg1 { // hide CC button - (void)setClosedCaptionsOrSubtitlesButtonAvailable:(BOOL)arg1 { // hide CC button
if (hideCC()) { return %orig(NO); } if (hideCC()) { return %orig(NO); }
@@ -124,15 +128,22 @@ BOOL fixGoogleSigin() {
if (hideAutoplaySwitch()) {} if (hideAutoplaySwitch()) {}
else { return %orig; } else { return %orig; }
} }
- (void)layoutSubviews { // hide Next & Previous button %end
%orig;
if (hidePreviousAndNextButton()) { // Hide Next & Previous button
MSHookIvar<YTMainAppControlsOverlayView *>(self, "_nextButton").hidden = YES; %group gHidePreviousAndNextButton
MSHookIvar<YTMainAppControlsOverlayView *>(self, "_previousButton").hidden = YES; %hook YTColdConfig
MSHookIvar<YTTransportControlsButtonView *>(self, "_nextButtonView").hidden = YES; - (BOOL)removeNextPaddleForSingletonVideos { return YES; }
MSHookIvar<YTTransportControlsButtonView *>(self, "_previousButtonView").hidden = YES; - (BOOL)removePreviousPaddleForSingletonVideos { return YES; }
} %end
} %end
// Replace Next & Previous button with Fast forward & Rewind button
%group gReplacePreviousAndNextButton
%hook YTColdConfig
- (BOOL)replaceNextPaddleWithFastForwardButtonForSingletonVods { return YES; }
- (BOOL)replacePreviousPaddleWithRewindButtonForSingletonVods { return YES; }
%end
%end %end
// Hide HUD Messages // Hide HUD Messages
@@ -250,6 +261,7 @@ BOOL fixGoogleSigin() {
// YouRememberCaption: https://poomsmart.github.io/repo/depictions/youremembercaption.html // YouRememberCaption: https://poomsmart.github.io/repo/depictions/youremembercaption.html
%hook YTColdConfig %hook YTColdConfig
- (BOOL)respectDeviceCaptionSetting { return NO; } - (BOOL)respectDeviceCaptionSetting { return NO; }
- (BOOL)isLandscapeEngagementPanelSwipeRightToDismissEnabled { return YES; }
%end %end
// NOYTPremium - https://github.com/PoomSmart/NoYTPremium/ // NOYTPremium - https://github.com/PoomSmart/NoYTPremium/
@@ -350,9 +362,9 @@ BOOL fixGoogleSigin() {
// Prevent uYou player bar from showing when not playing downloaded media // Prevent uYou player bar from showing when not playing downloaded media
%hook PlayerManager %hook PlayerManager
- (void)pause { - (void)pause {
if (isnan([self progress])) if (isnan([self progress]))
return; return;
%orig; %orig;
} }
%end %end
@@ -874,6 +886,12 @@ static void replaceTab(YTIGuideResponse *response) {
if (bigYTMiniPlayer() && (UIDevice.currentDevice.userInterfaceIdiom != UIUserInterfaceIdiomPad)) { if (bigYTMiniPlayer() && (UIDevice.currentDevice.userInterfaceIdiom != UIUserInterfaceIdiomPad)) {
%init(Main); %init(Main);
} }
if (hidePreviousAndNextButton()) {
%init(gHidePreviousAndNextButton);
}
if (replacePreviousAndNextButton()) {
%init(gReplacePreviousAndNextButton);
}
if (@available(iOS 16, *)) { if (@available(iOS 16, *)) {
%init(iOS16); %init(iOS16);
} }