mirror of
https://github.com/SoPat712/YTLitePlus.git
synced 2025-08-21 18:28:47 -04:00
Change hiding method
This commit is contained in:
@@ -171,21 +171,53 @@ BOOL isSelf() {
|
|||||||
%end
|
%end
|
||||||
|
|
||||||
// Disable YouTube Plus incompatibility warning popup - @bhackel
|
// Disable YouTube Plus incompatibility warning popup - @bhackel
|
||||||
%hook HelperVC
|
%hook UIView
|
||||||
|
|
||||||
- (void)viewWillAppear:(BOOL)animated {
|
- (void)willMoveToWindow:(UIWindow *)newWindow {
|
||||||
%orig; // Call the original implementation
|
UIResponder *responder = self;
|
||||||
|
while (responder) {
|
||||||
|
responder = [responder nextResponder];
|
||||||
|
if ([responder isKindOfClass:NSClassFromString(@"HelperVC")]) {
|
||||||
|
// View belongs to HelperVC, now proceed with getting the UIButton
|
||||||
|
|
||||||
// // Hide the view before it appears
|
if ([self.subviews count] > 4 && [[self.subviews objectAtIndex:4] isKindOfClass:[UIButton class]]) {
|
||||||
// self.view.hidden = YES;
|
UIButton *button = [self.subviews objectAtIndex:4];
|
||||||
|
|
||||||
// // Optionally, you can remove the view from the superview to ensure it's gone
|
// Access the _targetActions ivar using KVC (Key-Value Coding)
|
||||||
// [self.view removeFromSuperview];
|
NSArray *targetActions = [button valueForKey:@"_targetActions"];
|
||||||
|
|
||||||
|
if ([targetActions count] > 0) {
|
||||||
|
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]]) {
|
||||||
|
// Access the handler property of UIAction
|
||||||
|
void (^handlerBlock)(void) = [actionHandler valueForKey:@"handler"];
|
||||||
|
|
||||||
|
// Invoke the handler block
|
||||||
|
if (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
|
%end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// A/B flags
|
// A/B flags
|
||||||
%hook YTColdConfig
|
%hook YTColdConfig
|
||||||
- (BOOL)respectDeviceCaptionSetting { return NO; } // YouRememberCaption: https://poomsmart.github.io/repo/depictions/youremembercaption.html
|
- (BOOL)respectDeviceCaptionSetting { return NO; } // YouRememberCaption: https://poomsmart.github.io/repo/depictions/youremembercaption.html
|
||||||
|
Reference in New Issue
Block a user