Update uYouPlusSettings.xm

This commit is contained in:
arichornlover 2024-02-12 16:05:33 -06:00 committed by GitHub
parent e8964159c5
commit 73c26d5ae8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,12 +1,9 @@
// Settings.xm made by the @therealFoxster
#import "../Tweaks/YouTubeHeader/YTSettingsGroupData.h"
#import "../Tweaks/YouTubeHeader/YTSettingsViewController.h"
#import "../Tweaks/YouTubeHeader/YTSearchableSettingsViewController.h"
#import "../Tweaks/YouTubeHeader/YTSettingsSectionItem.h"
#import "../Tweaks/YouTubeHeader/YTSettingsSectionItemManager.h"
#import "../Tweaks/YouTubeHeader/YTUIUtils.h"
#import "../Tweaks/YouTubeHeader/YTSettingsPickerViewController.h"
#import "../Tweaks/YouTubeHeader/YTIIcon.h"
#import "ColourOptionsController.h"
#import "ColourOptionsController2.h"
#import "uYouPlus.h"
@ -39,15 +36,10 @@ static int appVersionSpoofer() {
return [[NSUserDefaults standardUserDefaults] integerForKey:@"versionSpoofer"];
}
static const NSInteger uYouPlusSection = 500;
static const NSUInteger GROUP_TYPE = 'psyt'; // PoomSmart/YouGroupSettings
@interface YTSettingsGroupData (YouGroupSettings) // PoomSmart/YouGroupSettings
+ (NSMutableArray <NSNumber *> *)tweaks;
@end
@interface YTSettingsSectionItemManager (uYouPlus)
- (void)updateTweakSectionWithEntry:(id)entry;
- (NSString *)getCacheSize;
// - (NSString *)getCacheSize;
@end
extern NSBundle *uYouPlusBundle();
@ -82,50 +74,6 @@ extern NSBundle *uYouPlusBundle();
}
%end
// PoomSmart/YouGroupSettings
%hook YTSettingsGroupData
%new(@@:)
+ (NSMutableArray <NSNumber *> *)tweaks {
static NSMutableArray <NSNumber *> *tweaks = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
tweaks = [NSMutableArray new];
[tweaks addObjectsFromArray:@[
@(404), // YTABConfig
@(517), // DontEatMyContent
@(1080), // Return YouTube Dislike
@(200), // YouPiP
@(500), // uYouEnhanced / uYouPlus
@(2168), // YTHoldForSpeed
@(1222), // YTVideoOverlay
]];
});
return tweaks;
}
- (NSString *)titleForSettingGroupType:(NSUInteger)type {
if (type == GROUP_TYPE) {
return @"Tweaks";
}
return %orig;
}
- (NSArray <NSNumber *> *)orderedCategoriesForGroupType:(NSUInteger)type {
if (type == GROUP_TYPE)
return [[self class] tweaks];
return %orig;
}
%end
%hook YTSettingsViewController
- (void)setSectionItems:(NSMutableArray *)sectionItems forCategory:(NSInteger)category title:(NSString *)title icon:(YTIIcon *)icon titleDescription:(NSString *)titleDescription headerHidden:(BOOL)headerHidden {
if (icon == nil && [[%c(YTSettingsGroupData) tweaks] containsObject:@(category)]) {
icon = [%c(YTIIcon) new];
icon.iconType = 44;
}
%orig;
}
%end
//
%hook YTSettingsSectionController
- (void)setSelectedItem:(NSUInteger)selectedItem {
if (selectedItem != NSNotFound) %orig;
@ -133,6 +81,7 @@ extern NSBundle *uYouPlusBundle();
%end
%hook YTSettingsSectionItemManager
/* BROKEN
- (NSString *)getCacheSize {
NSString *cachePath = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject;
NSArray *filesArray = [[NSFileManager defaultManager] subpathsOfDirectoryAtPath:cachePath error:nil];
@ -149,6 +98,7 @@ extern NSBundle *uYouPlusBundle();
return [formatter stringFromByteCount:folderSize];
}
*/
%new(v@:@)
- (void)updateTweakSectionWithEntry:(id)entry {
NSMutableArray *sectionItems = [NSMutableArray array];
@ -199,6 +149,7 @@ extern NSBundle *uYouPlusBundle();
];
[sectionItems addObject:exitYT];
/* DISABLED
# pragma mark - Cache
SECTION_HEADER(@"Cache");
YTSettingsSectionItem *clearCache = [%c(YTSettingsSectionItem)
@ -220,6 +171,7 @@ extern NSBundle *uYouPlusBundle();
}
];
[sectionItems addObject:clearCache];
*/
# pragma mark - App theme
SECTION_HEADER(LOC(@"THEME_OPTIONS"));