Merge pull request #138 from PoomSmart/format-cleanup

Code formatting cleanup
This commit is contained in:
Nguyễn Đạt
2022-05-03 10:52:05 +07:00
committed by GitHub
3 changed files with 262 additions and 265 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
#import "Tweaks/YouTubeHeader/YTPlayerViewController.h" #import "Tweaks/YouTubeHeader/YTPlayerViewController.h"
@interface YTMainAppVideoPlayerOverlayView : UIView @interface YTMainAppVideoPlayerOverlayView : UIView
-(UIViewController *)_viewControllerForAncestor; - (UIViewController *)_viewControllerForAncestor;
@end @end
@interface YTWatchMiniBarView : UIView @interface YTWatchMiniBarView : UIView
+7 -10
View File
@@ -11,7 +11,6 @@
#import "Tweaks/YouTubeHeader/YTIPivotBarSupportedRenderers.h" #import "Tweaks/YouTubeHeader/YTIPivotBarSupportedRenderers.h"
#import "Tweaks/YouTubeHeader/YTIPivotBarRenderer.h" #import "Tweaks/YouTubeHeader/YTIPivotBarRenderer.h"
#import "Tweaks/YouTubeHeader/YTIBrowseRequest.h" #import "Tweaks/YouTubeHeader/YTIBrowseRequest.h"
#include <RemoteLog.h>
BOOL hideHUD() { BOOL hideHUD() {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"hideHUD_enabled"]; return [[NSUserDefaults standardUserDefaults] boolForKey:@"hideHUD_enabled"];
@@ -46,7 +45,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
// Hide CC / Autoplay switch // Hide CC / Autoplay switch
%hook YTMainAppControlsOverlayView %hook YTMainAppControlsOverlayView
- (void)layoutSubviews { - (void)layoutSubviews {
%orig(); %orig;
if (hideAutoplaySwitch()) { if (hideAutoplaySwitch()) {
MSHookIvar<UIView *>(self, "_autonavSwitch").hidden = YES; MSHookIvar<UIView *>(self, "_autonavSwitch").hidden = YES;
} }
@@ -59,19 +58,16 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
// Hide HUD Messages // Hide HUD Messages
%hook YTHUDMessageView %hook YTHUDMessageView
- (id)initWithMessage:(id)arg1 dismissHandler:(id)arg2 { - (id)initWithMessage:(id)arg1 dismissHandler:(id)arg2 {
if (hideHUD()) { return hideHUD() ? nil : %orig;
return NULL;
} else { return %orig; }
} }
%end %end
// YTAutoFullScreen: https://github.com/PoomSmart/YTAutoFullScreen/ // YTAutoFullScreen: https://github.com/PoomSmart/YTAutoFullScreen/
%hook YTPlayerViewController %hook YTPlayerViewController
- (void)loadWithPlayerTransition:(id)arg1 playbackConfig:(id)arg2 { - (void)loadWithPlayerTransition:(id)arg1 playbackConfig:(id)arg2 {
if (autoFullScreen()) {
%orig; %orig;
if (autoFullScreen())
[NSTimer scheduledTimerWithTimeInterval:0.75 target:self selector:@selector(autoFullscreen) userInfo:nil repeats:NO]; [NSTimer scheduledTimerWithTimeInterval:0.75 target:self selector:@selector(autoFullscreen) userInfo:nil repeats:NO];
} else { return %orig; }
} }
%new %new
- (void)autoFullscreen { - (void)autoFullscreen {
@@ -111,17 +107,18 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
[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]]) { if ([rootViewController isKindOfClass:[%c(UITabBarController) class]]) {
rootViewController = ((UITabBarController *)rootViewController).selectedViewController; rootViewController = ((UITabBarController *)rootViewController).selectedViewController;
} }
if ([rootViewController presentedViewController] != nil) { if ([rootViewController presentedViewController] != nil) {
rootViewController = [rootViewController presentedViewController]; rootViewController = [rootViewController presentedViewController];
} }
[rootViewController presentViewController:alertController animated:YES completion:nil]; [rootViewController presentViewController:alertController animated:YES completion:nil];
} else { return %orig; } }
return %orig;
} }
%end %end