fix app crash upon launching on some devices

This commit is contained in:
qnblackcat 2022-05-17 09:44:54 +07:00
parent f63cfa8b43
commit 5e9d719882

View file

@ -1,7 +1,6 @@
#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/YTSettingsSectionItem.h"
@ -53,15 +52,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
@ -550,7 +546,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);