mirror of
				https://github.com/SoPat712/YTLitePlus.git
				synced 2025-10-30 20:34:04 -04:00 
			
		
		
		
	Fix YouGroupSettings addition
This commit is contained in:
		| @@ -31,7 +31,6 @@ static int contrastMode() { | |||||||
| static int appVersionSpoofer() { | static int appVersionSpoofer() { | ||||||
|     return [[NSUserDefaults standardUserDefaults] integerForKey:@"versionSpoofer"]; |     return [[NSUserDefaults standardUserDefaults] integerForKey:@"versionSpoofer"]; | ||||||
| } | } | ||||||
| static const NSInteger YTLitePlusSection = 788; |  | ||||||
|  |  | ||||||
| @interface YTSettingsSectionItemManager (YTLitePlus) | @interface YTSettingsSectionItemManager (YTLitePlus) | ||||||
| - (void)updateYTLitePlusSectionWithEntry:(id)entry; | - (void)updateYTLitePlusSectionWithEntry:(id)entry; | ||||||
| @@ -40,19 +39,19 @@ static const NSInteger YTLitePlusSection = 788; | |||||||
| extern NSBundle *YTLitePlusBundle(); | extern NSBundle *YTLitePlusBundle(); | ||||||
|  |  | ||||||
| // Add both YTLite and YTLitePlus to YouGroupSettings | // 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 | %hook YTSettingsGroupData | ||||||
| + (NSMutableArray <NSNumber *> *)tweaks { | + (NSMutableArray <NSNumber *> *)tweaks { | ||||||
|  |     NSLog(@"bhackel: called hooked 'tweaks' method."); | ||||||
|     NSMutableArray <NSNumber *> *originalTweaks = %orig; |     NSMutableArray <NSNumber *> *originalTweaks = %orig; | ||||||
|  |  | ||||||
|    // Use a static variable to ensure the array is modified only once. |  | ||||||
|     static dispatch_once_t onceToken; |     static dispatch_once_t onceToken; | ||||||
|     dispatch_once(&onceToken, ^{ |     dispatch_once(&onceToken, ^{ | ||||||
|         [originalTweaks addObject:@(YTLitePlusSection)]; |         [originalTweaks addObject:@(YTLitePlusSection)]; | ||||||
|         [originalTweaks addObject:@(YTLiteSection)]; |         [originalTweaks addObject:@(YTLiteSection)]; | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|    // Return the modified array. |  | ||||||
|     return originalTweaks; |     return originalTweaks; | ||||||
| } | } | ||||||
| %end | %end | ||||||
|   | |||||||
| @@ -667,6 +667,9 @@ static NSData *cellDividerData = nil; | |||||||
| # pragma mark - ctor | # pragma mark - ctor | ||||||
| %ctor { | %ctor { | ||||||
|     %init; |     %init; | ||||||
|  |     // Access YouGroupSettings methods | ||||||
|  |     dlopen([[NSString stringWithFormat:@"%@/Frameworks/YouGroupSettings.dylib", [[NSBundle mainBundle] bundlePath]] UTF8String], RTLD_LAZY); | ||||||
|  |  | ||||||
|     if (IsEnabled(@"hideCastButton_enabled")) { |     if (IsEnabled(@"hideCastButton_enabled")) { | ||||||
|         %init(gHideCastButton); |         %init(gHideCastButton); | ||||||
|     } |     } | ||||||
| @@ -731,7 +734,6 @@ static NSData *cellDividerData = nil; | |||||||
|         %init(gFixCasting); |         %init(gFixCasting); | ||||||
|     }     |     }     | ||||||
|  |  | ||||||
|  |  | ||||||
|     // Change the default value of some options |     // Change the default value of some options | ||||||
|     NSArray *allKeys = [[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] allKeys]; |     NSArray *allKeys = [[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] allKeys]; | ||||||
|     if (![allKeys containsObject:@"RYD-ENABLED"]) {  |     if (![allKeys containsObject:@"RYD-ENABLED"]) {  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Bryce Hackel
					Bryce Hackel