Skip to content

Commit

Permalink
Update uYouPlusSettings.xm
Browse files Browse the repository at this point in the history
  • Loading branch information
arichornlover authored Feb 12, 2024
1 parent e896415 commit 73c26d5
Showing 1 changed file with 5 additions and 53 deletions.
58 changes: 5 additions & 53 deletions Sources/uYouPlusSettings.xm
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -82,57 +74,14 @@ 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;
}
%end

%hook YTSettingsSectionItemManager
/* BROKEN
- (NSString *)getCacheSize {
NSString *cachePath = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject;
NSArray *filesArray = [[NSFileManager defaultManager] subpathsOfDirectoryAtPath:cachePath error:nil];
Expand All @@ -149,6 +98,7 @@ extern NSBundle *uYouPlusBundle();
return [formatter stringFromByteCount:folderSize];
}
*/
%new(v@:@)
- (void)updateTweakSectionWithEntry:(id)entry {
NSMutableArray *sectionItems = [NSMutableArray array];
Expand Down Expand Up @@ -199,6 +149,7 @@ extern NSBundle *uYouPlusBundle();
];
[sectionItems addObject:exitYT];

/* DISABLED
# pragma mark - Cache
SECTION_HEADER(@"Cache");
YTSettingsSectionItem *clearCache = [%c(YTSettingsSectionItem)
Expand All @@ -220,6 +171,7 @@ extern NSBundle *uYouPlusBundle();
}
];
[sectionItems addObject:clearCache];
*/

# pragma mark - App theme
SECTION_HEADER(LOC(@"THEME_OPTIONS"));
Expand Down

0 comments on commit 73c26d5

Please sign in to comment.