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
+5 -8
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 {
@@ -121,7 +117,8 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
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