diff --git a/Source/Settings.xm b/Source/Settings.xm index 57f2653..79ff3a4 100644 --- a/Source/Settings.xm +++ b/Source/Settings.xm @@ -31,7 +31,6 @@ static int contrastMode() { static int appVersionSpoofer() { return [[NSUserDefaults standardUserDefaults] integerForKey:@"versionSpoofer"]; } -static const NSInteger YTLitePlusSection = 788; @interface YTSettingsSectionItemManager (YTLitePlus) - (void)updateYTLitePlusSectionWithEntry:(id)entry; @@ -40,20 +39,20 @@ static const NSInteger YTLitePlusSection = 788; extern NSBundle *YTLitePlusBundle(); // Add both YTLite and YTLitePlus to YouGroupSettings -static const NSInteger YTLiteSection = 789; // Grabbed from YTLite +static const NSInteger YTLitePlusSection = 788; +static const NSInteger YTLiteSection = 789; %hook YTSettingsGroupData + (NSMutableArray *)tweaks { - NSMutableArray *originalTweaks = %orig; + NSLog(@"bhackel: called hooked 'tweaks' method."); + NSMutableArray *originalTweaks = %orig; - // Use a static variable to ensure the array is modified only once. - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - [originalTweaks addObject:@(YTLitePlusSection)]; - [originalTweaks addObject:@(YTLiteSection)]; - }); + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + [originalTweaks addObject:@(YTLitePlusSection)]; + [originalTweaks addObject:@(YTLiteSection)]; + }); - // Return the modified array. - return originalTweaks; + return originalTweaks; } %end diff --git a/YTLitePlus.xm b/YTLitePlus.xm index de60347..9063ed8 100644 --- a/YTLitePlus.xm +++ b/YTLitePlus.xm @@ -667,6 +667,9 @@ static NSData *cellDividerData = nil; # pragma mark - ctor %ctor { %init; + // Access YouGroupSettings methods + dlopen([[NSString stringWithFormat:@"%@/Frameworks/YouGroupSettings.dylib", [[NSBundle mainBundle] bundlePath]] UTF8String], RTLD_LAZY); + if (IsEnabled(@"hideCastButton_enabled")) { %init(gHideCastButton); } @@ -729,8 +732,7 @@ static NSData *cellDividerData = nil; } if (IsEnabled(@"fixCasting_enabled")) { %init(gFixCasting); - } - + } // Change the default value of some options NSArray *allKeys = [[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] allKeys];