Compare commits

..
Author SHA1 Message Date
qnblackcat b94a5cc967 hide Previous/Next button 2022-05-20 21:38:33 +07:00
qnblackcat 8b50a3c1b7 more? 2022-05-20 21:29:30 +07:00
qnblackcat 025dc4d2cb update submodules 2022-05-20 20:58:46 +07:00
qnblackcat 9860fdb4e8 v17.19.2-2.1-F3 2022-05-17 10:07:23 +07:00
qnblackcat 5e9d719882 fix app crash upon launching on some devices 2022-05-17 09:44:54 +07:00
qnblackcat f63cfa8b43 update Makefile 2022-05-17 09:43:12 +07:00
qnblackcat 37b6b1e07e update description 2022-05-17 09:43:01 +07:00
9 changed files with 67 additions and 47 deletions
+3
View File
@@ -1,5 +1,8 @@
#import "Tweaks/YouTubeHeader/YTPlayerViewController.h" #import "Tweaks/YouTubeHeader/YTPlayerViewController.h"
@interface YTMainAppControlsOverlayView: UIView
@end
@interface YTPlaylistHeaderViewController : UIViewController @interface YTPlaylistHeaderViewController : UIViewController
@property (nonatomic, strong, readwrite) UIView *downloadsButton; @property (nonatomic, strong, readwrite) UIView *downloadsButton;
@end @end
+1 -1
View File
@@ -2,7 +2,7 @@ uYouPlus_INJECT_DYLIBS = Tweaks/uYou/Library/MobileSubstrate/DynamicLibraries/uY
TARGET = iphone:clang:latest:12.0 TARGET = iphone:clang:latest:12.0
uYouPlus_USE_FLEX = 0 uYouPlus_USE_FLEX = 0
uYouPlus_USE_FISHHOOK = 1 uYouPlus_USE_FISHHOOK = 0
ARCHS = arm64 ARCHS = arm64
MODULES = jailed MODULES = jailed
FINALPACKAGE = 1 FINALPACKAGE = 1
+1 -1
View File
@@ -78,7 +78,7 @@
- My official AtlStore repo: https://qnblackcat.github.io/AltStore/ - My official AtlStore repo: https://qnblackcat.github.io/AltStore/
- [Open in AltStore (v17.19.2-2.1)](https://tinyurl.com/2p9e76h2) - It will take a while to install because AltStore needs to download the IPA. - [Open in AltStore (v17.19.2-2.1)](https://tinyurl.com/2s49jpru) - It will take a while to install because AltStore needs to download the IPA.
- Version info: _(last update: May 16)_ - Version info: _(last update: May 16)_
+14 -4
View File
@@ -19,6 +19,7 @@ extern BOOL hideCC();
extern BOOL hideAutoplaySwitch(); extern BOOL hideAutoplaySwitch();
extern BOOL castConfirm(); extern BOOL castConfirm();
extern BOOL ytMiniPlayer(); extern BOOL ytMiniPlayer();
extern BOOL hidePreviousAndNextButton();
// Settings // Settings
%hook YTAppSettingsPresentationData %hook YTAppSettingsPresentationData
@@ -37,7 +38,16 @@ extern BOOL ytMiniPlayer();
%new - (void)updateuYouPlusSectionWithEntry:(id)entry { %new - (void)updateuYouPlusSectionWithEntry:(id)entry {
YTSettingsViewController *delegate = [self valueForKey:@"_dataDelegate"]; YTSettingsViewController *delegate = [self valueForKey:@"_dataDelegate"];
YTSettingsSectionItem *ytMiniPlayer = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"Enable the Miniplayer for all videos" titleDescription:@"App restart is required."]; YTSettingsSectionItem *hidePreviousAndNextButton = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"Hide Previous and Next button" titleDescription:@""];
hidePreviousAndNextButton.hasSwitch = YES;
hidePreviousAndNextButton.switchVisible = YES;
hidePreviousAndNextButton.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"hidePreviousAndNextButton_enabled"];
hidePreviousAndNextButton.switchBlock = ^BOOL (YTSettingsCell *cell, BOOL enabled) {
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"hidePreviousAndNextButton_enabled"];
return YES;
};
YTSettingsSectionItem *ytMiniPlayer = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"Enable the Miniplayer for all YouTube videos" titleDescription:@""];
ytMiniPlayer.hasSwitch = YES; ytMiniPlayer.hasSwitch = YES;
ytMiniPlayer.switchVisible = YES; ytMiniPlayer.switchVisible = YES;
ytMiniPlayer.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"ytMiniPlayer_enabled"]; ytMiniPlayer.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"ytMiniPlayer_enabled"];
@@ -46,7 +56,7 @@ extern BOOL ytMiniPlayer();
return YES; return YES;
}; };
YTSettingsSectionItem *castConfirm = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"Confirm alert before casting (YTCastConfirm)" titleDescription:@"Show a confirm alert before casting to prevent accidentally hijacking TV."]; YTSettingsSectionItem *castConfirm = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"Confirm alert before casting (YTCastConfirm)" titleDescription:@"Show a confirm alert before casting to prevent accidentally hijacking TV. App restart is required."];
castConfirm.hasSwitch = YES; castConfirm.hasSwitch = YES;
castConfirm.switchVisible = YES; castConfirm.switchVisible = YES;
castConfirm.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"castConfirm_enabled"]; castConfirm.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"castConfirm_enabled"];
@@ -127,7 +137,7 @@ extern BOOL ytMiniPlayer();
return YES; return YES;
}; };
YTSettingsSectionItem *oledKeyBoard = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"OLED Keyboard (Experimental)" titleDescription:@"Might not working properly in some cases . App restart is required."]; YTSettingsSectionItem *oledKeyBoard = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"OLED Keyboard (Experimental)" titleDescription:@"Might not working properly in some cases. App restart is required."];
oledKeyBoard.hasSwitch = YES; oledKeyBoard.hasSwitch = YES;
oledKeyBoard.switchVisible = YES; oledKeyBoard.switchVisible = YES;
oledKeyBoard.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"oledKeyBoard_enabled"]; oledKeyBoard.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"oledKeyBoard_enabled"];
@@ -136,7 +146,7 @@ extern BOOL ytMiniPlayer();
return YES; return YES;
}; };
NSMutableArray <YTSettingsSectionItem *> *sectionItems = [NSMutableArray arrayWithArray:@[autoFull, castConfirm, ytMiniPlayer, hideAutoplaySwitch, hideCC, hideHUD, hoverCardItem, bigYTMiniPlayer, oledKeyBoard, oledDarkMode,reExplore]]; NSMutableArray <YTSettingsSectionItem *> *sectionItems = [NSMutableArray arrayWithArray:@[autoFull, castConfirm, ytMiniPlayer, hideAutoplaySwitch, hideCC, hideHUD, hidePreviousAndNextButton, hoverCardItem, bigYTMiniPlayer, oledKeyBoard, oledDarkMode,reExplore]];
[delegate setSectionItems:sectionItems forCategory:uYouPlusSection title:@"uYouPlus" titleDescription:nil headerHidden:NO]; [delegate setSectionItems:sectionItems forCategory:uYouPlusSection title:@"uYouPlus" titleDescription:nil headerHidden:NO];
} }
+44 -37
View File
@@ -1,10 +1,8 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <objc/runtime.h> #import <objc/runtime.h>
#import <fishhook.h>
#import "Header.h" #import "Header.h"
#import "Tweaks/YouTubeHeader/YTVideoQualitySwitchOriginalController.h" #import "Tweaks/YouTubeHeader/YTVideoQualitySwitchOriginalController.h"
#import "Tweaks/YouTubeHeader/YTSettingsSectionItem.h"
#import "Tweaks/YouTubeHeader/YTPlayerViewController.h" #import "Tweaks/YouTubeHeader/YTPlayerViewController.h"
#import "Tweaks/YouTubeHeader/YTWatchController.h" #import "Tweaks/YouTubeHeader/YTWatchController.h"
#import "Tweaks/YouTubeHeader/YTIGuideResponse.h" #import "Tweaks/YouTubeHeader/YTIGuideResponse.h"
@@ -44,6 +42,9 @@ BOOL hideCC() {
BOOL hideAutoplaySwitch() { BOOL hideAutoplaySwitch() {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"hideAutoplaySwitch_enabled"]; return [[NSUserDefaults standardUserDefaults] boolForKey:@"hideAutoplaySwitch_enabled"];
} }
BOOL hidePreviousAndNextButton() {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"hidePreviousAndNextButton_enabled"];
}
BOOL castConfirm() { BOOL castConfirm() {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"castConfirm_enabled"]; return [[NSUserDefaults standardUserDefaults] boolForKey:@"castConfirm_enabled"];
} }
@@ -53,15 +54,12 @@ BOOL ytMiniPlayer() {
// Tweaks // Tweaks
// YTMiniPlayerEnabler: https://github.com/level3tjg/YTMiniplayerEnabler/ // YTMiniPlayerEnabler: https://github.com/level3tjg/YTMiniplayerEnabler/
static BOOL (*orig_class_addMethod)(Class, SEL, IMP, const char *); %hook YTWatchMiniBarViewController
static BOOL hook_class_addMethod(Class cls, SEL name, IMP imp, const char *types) { - (void)updateMiniBarPlayerStateFromRenderer {
if (ytMiniPlayer() && [cls isEqual:%c(YTIMiniplayerRenderer)] && [NSStringFromSelector(name) hasPrefix:@"has"]) { if (ytMiniPlayer()) {}
imp = imp_implementationWithBlock(^BOOL(id self, SEL _cmd) { else { return %orig; }
return NO;
});
}
return orig_class_addMethod(cls, name, imp, types);
} }
%end
// Hide CC / Autoplay switch // Hide CC / Autoplay switch
%hook YTMainAppControlsOverlayView %hook YTMainAppControlsOverlayView
@@ -73,6 +71,14 @@ static BOOL hook_class_addMethod(Class cls, SEL name, IMP imp, const char *types
if (hideAutoplaySwitch()) {} if (hideAutoplaySwitch()) {}
else { return %orig; } else { return %orig; }
} }
- (void)layoutSubviews {
if (hidePreviousAndNextButton()) {
MSHookIvar<YTMainAppControlsOverlayView *>(self, "_nextButton").hidden = YES;
MSHookIvar<YTMainAppControlsOverlayView *>(self, "_previousButton").hidden = YES;
%orig;
}
return %orig;
}
%end %end
// Hide HUD Messages // Hide HUD Messages
@@ -106,41 +112,40 @@ static BOOL hook_class_addMethod(Class cls, SEL name, IMP imp, const char *types
%end %end
//YTCastConfirm: https://github.com/JamieBerghmans/YTCastConfirm //YTCastConfirm: https://github.com/JamieBerghmans/YTCastConfirm
%group gYTCastconfirm
%hook MDXPlaybackRouteButtonController %hook MDXPlaybackRouteButtonController
- (void)didPressButton:(id)arg1 { - (void)didPressButton:(id)arg1 {
if (castConfirm()) { UIAlertController* alertController = [%c(UIAlertController) alertControllerWithTitle:@"Casting"
UIAlertController* alertController = [%c(UIAlertController) alertControllerWithTitle:@"Casting" message:@"Are you sure you want to start casting?"
message:@"Are you sure you want to start casting?" preferredStyle:UIAlertControllerStyleAlert];
preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction* defaultAction = [%c(UIAlertAction) actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
UIAlertAction* defaultAction = [%c(UIAlertAction) actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { %orig;
%orig; }];
}];
UIAlertAction* noButton = [%c(UIAlertAction) UIAlertAction* noButton = [%c(UIAlertAction)
actionWithTitle:@"Cancel" actionWithTitle:@"Cancel"
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler: ^(UIAlertAction * action) { handler: ^(UIAlertAction * action) { return; }
return; ];
}];
[alertController addAction:defaultAction]; [alertController addAction:defaultAction];
[alertController addAction:noButton]; [alertController addAction:noButton];
id rootViewController = [%c(UIApplication) sharedApplication].delegate.window.rootViewController; id rootViewController = [%c(UIApplication) sharedApplication].delegate.window.rootViewController;
if ([rootViewController isKindOfClass:[%c(UINavigationController) class]]) { if ([rootViewController isKindOfClass:[%c(UINavigationController) class]]) {
rootViewController = ((UINavigationController *)rootViewController).viewControllers.firstObject; rootViewController = ((UINavigationController *)rootViewController).viewControllers.firstObject;
}
if ([rootViewController isKindOfClass:[%c(UITabBarController) class]]) {
rootViewController = ((UITabBarController *)rootViewController).selectedViewController;
}
if ([rootViewController presentedViewController] != nil) {
rootViewController = [rootViewController presentedViewController];
}
[rootViewController presentViewController:alertController animated:YES completion:nil];
} }
if ([rootViewController isKindOfClass:[%c(UITabBarController) class]]) {
rootViewController = ((UITabBarController *)rootViewController).selectedViewController;
}
if ([rootViewController presentedViewController] != nil) {
rootViewController = [rootViewController presentedViewController];
}
[rootViewController presentViewController:alertController animated:YES completion:nil];
return %orig; return %orig;
} }
%end %end
%end
// Workaround for https://github.com/MiRO92/uYou-for-YouTube/issues/12 // Workaround for https://github.com/MiRO92/uYou-for-YouTube/issues/12
%hook YTAdsInnerTubeContextDecorator %hook YTAdsInnerTubeContextDecorator
@@ -550,7 +555,6 @@ static void replaceTab(YTIGuideResponse *response) {
%end %end
%ctor { %ctor {
rebind_symbols((struct rebinding[1]){{"class_addMethod", (void *)hook_class_addMethod, (void **)&orig_class_addMethod}}, 1);
%init; %init;
if (oled()) { if (oled()) {
%init(gOLED); %init(gOLED);
@@ -564,4 +568,7 @@ static void replaceTab(YTIGuideResponse *response) {
if (bigYTMiniPlayer() && (UIDevice.currentDevice.userInterfaceIdiom != UIUserInterfaceIdiomPad)) { if (bigYTMiniPlayer() && (UIDevice.currentDevice.userInterfaceIdiom != UIUserInterfaceIdiomPad)) {
%init(Main); %init(Main);
} }
if (castConfirm()) {
%init(gYTCastconfirm);
}
} }