mirror of
https://github.com/SoPat712/YTLitePlus.git
synced 2025-08-21 18:48:45 -04:00
Remove Code related to disabling YTLite Popup
I am removing it to respect the developer’s choice, no one should hate me for doing this decision of but I really don’t want to disrespect the creator of YTLite. I’m one of the “YTLitePlus Devs” and I am not the one who wanted the Popup to be hidden. It was a bad idea from the start and I should’ve removed this sooner when I saw it. Anyways have a good day everyone. - arichornlover
This commit is contained in:
@@ -170,82 +170,6 @@ BOOL isSelf() {
|
||||
%end
|
||||
%end
|
||||
|
||||
// Disable YouTube Plus incompatibility warning popup - @bhackel
|
||||
%hook UIViewController
|
||||
|
||||
- (void)presentViewController:(UIViewController *)viewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion {
|
||||
if ([NSStringFromClass([viewControllerToPresent class]) isEqualToString:@"HelperVC"]) {
|
||||
// show a toast
|
||||
[[%c(GOOHUDManagerInternal) sharedInstance] showMessageMainThread:[%c(YTHUDMessage) messageWithText:@"Bypassing Popup"]];
|
||||
// look for UIWindows of the sus type and hide them
|
||||
NSArray<UIWindow *> *windows = [UIApplication sharedApplication].windows;
|
||||
for (UIWindow *window in windows) {
|
||||
// Check the class name of the window
|
||||
if ([NSStringFromClass([window class]) isEqualToString:@"YTMainWindow"]) {
|
||||
NSLog(@"bhackel Skipping UIWindow with class YTMainWindow: %@", window);
|
||||
window.userInteractionEnabled = YES;
|
||||
continue;
|
||||
}
|
||||
NSLog(@"bhackel Yeeting UIWindow %@", window);
|
||||
window.hidden = YES;
|
||||
window.userInteractionEnabled = NO;
|
||||
}
|
||||
}
|
||||
|
||||
%orig(viewControllerToPresent, flag, completion);
|
||||
}
|
||||
|
||||
%end
|
||||
|
||||
|
||||
%hook UIView
|
||||
- (void)willMoveToWindow:(UIWindow *)newWindow {
|
||||
// yeet yeet
|
||||
UIResponder *responder = self;
|
||||
while (responder) {
|
||||
responder = [responder nextResponder];
|
||||
if ([responder isKindOfClass:NSClassFromString(@"HelperVC")]) {
|
||||
// View belongs to HelperVC, now proceed with getting the UIButton
|
||||
NSLog(@"bhackel Found HelperVC (1/5): %@", responder);
|
||||
|
||||
if ([self.subviews count] > 4 && [[self.subviews objectAtIndex:4] isKindOfClass:[UIButton class]]) {
|
||||
NSLog(@"bhackel Found UIButton (2/5): %@", [self.subviews objectAtIndex:4]);
|
||||
UIButton *button = [self.subviews objectAtIndex:4];
|
||||
|
||||
// Access the _targetActions ivar using KVC (Key-Value Coding)
|
||||
NSArray *targetActions = [button valueForKey:@"_targetActions"];
|
||||
|
||||
if ([targetActions count] > 0) {
|
||||
NSLog(@"bhackel Found targetActions (3/5): %@", targetActions);
|
||||
id controlTargetAction = [targetActions objectAtIndex:0];
|
||||
|
||||
// Use KVC to get the _actionHandler (which is of type UIAction)
|
||||
UIAction *actionHandler = [controlTargetAction valueForKey:@"_actionHandler"];
|
||||
|
||||
if (actionHandler && [actionHandler isKindOfClass:[UIAction class]]) {
|
||||
NSLog(@"bhackel Found actionHandler (4/5): %@", actionHandler);
|
||||
// Access the handler property of UIAction
|
||||
void (^handlerBlock)(void) = [actionHandler valueForKey:@"handler"];
|
||||
|
||||
// Invoke the handler block
|
||||
if (handlerBlock) {
|
||||
NSLog(@"bhackel Found handlerBlock (5/5): %@", handlerBlock);
|
||||
handlerBlock(); // Call the block
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Prevent the view from being added to the window
|
||||
[self removeFromSuperview];
|
||||
return; // Exit early to prevent further processing
|
||||
}
|
||||
}
|
||||
|
||||
%orig(newWindow); // Call the original method if the view doesn't belong to HelperVC
|
||||
}
|
||||
%end
|
||||
|
||||
// A/B flags
|
||||
%hook YTColdConfig
|
||||
- (BOOL)respectDeviceCaptionSetting { return NO; } // YouRememberCaption: https://poomsmart.github.io/repo/depictions/youremembercaption.html
|
||||
|
Reference in New Issue
Block a user