Skip to content

Commit

Permalink
Optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
PoomSmart committed Jan 12, 2023
1 parent 24c55ae commit 4ca8b2d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
TARGET := iphone:clang:latest:11.0
INSTALL_TARGET_PROCESSES = YouTube
ARCHS = arm64
PACKAGE_VERSION = 1.4.6
PACKAGE_VERSION = 1.4.7

include $(THEOS)/makefiles/common.mk

Expand Down
16 changes: 7 additions & 9 deletions Tweak.xm
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
#define _LOC(b, x) [b localizedStringForKey:x value:nil table:nil]
#define LOC(x) _LOC(tweakBundle, x)

static const NSInteger YTABCSection = 404;

@interface YTSettingsSectionItemManager (YTABConfig)
- (void)updateYTABCSectionWithEntry:(id)entry;
@end

static const NSInteger YTABCSection = 404;

NSMutableDictionary <NSString *, NSMutableDictionary <NSString *, NSNumber *> *> *cache;
NSUserDefaults *defaults;
NSArray <NSString *> *allKeys;
Expand Down Expand Up @@ -80,11 +80,8 @@ NSBundle *YTABCBundle() {
NSString *tweakBundlePath = [[NSBundle mainBundle] pathForResource:@"YTABC" ofType:@"bundle"];
if (tweakBundlePath)
bundle = [NSBundle bundleWithPath:tweakBundlePath];
else {
else
bundle = [NSBundle bundleWithPath:@"/Library/Application Support/YTABC.bundle"];
if (!bundle)
bundle = [NSBundle bundleWithPath:@"/var/jb/Library/Application Support/YTABC.bundle"];
}
});
return bundle;
}
Expand Down Expand Up @@ -146,7 +143,8 @@ static NSString *getCategory(char c, NSString *method) {
if ([method hasPrefix:@"shorts"]) return @"shorts";
if ([method hasPrefix:@"should"]) return @"should";
}
return [NSString stringWithFormat:@"%c", c]; // FIXME: Yike -stringWithFormat:
unichar uc = (unichar)c;
return [NSString stringWithCharacters:&uc length:1];;
}

%hook YTSettingsSectionItemManager
Expand Down Expand Up @@ -192,7 +190,7 @@ static NSString *getCategory(char c, NSString *method) {
YTSettingsViewController *settingsViewController = [self valueForKey:@"_settingsViewControllerDelegate"];
BOOL grouped = groupedSettings();
for (NSString *category in properties) {
NSMutableArray *rows = properties[category];
NSMutableArray <YTSettingsSectionItem *> *rows = properties[category];
totalSettings += rows.count;
if (grouped) {
NSSortDescriptor *sort = [NSSortDescriptor sortDescriptorWithKey:@"title" ascending:YES];
Expand Down Expand Up @@ -381,8 +379,8 @@ static void hookClass(NSObject *instance) {

- (BOOL)application:(id)arg1 didFinishLaunchingWithOptions:(id)arg2 {
defaults = [NSUserDefaults standardUserDefaults];
allKeys = [defaults dictionaryRepresentation].allKeys;
if (tweakEnabled()) {
allKeys = [defaults dictionaryRepresentation].allKeys;
YTGlobalConfig *globalConfig;
YTColdConfig *coldConfig;
YTHotConfig *hotConfig;
Expand Down
2 changes: 1 addition & 1 deletion control
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: com.ps.ytabconfig
Name: YTABConfig
Version: 1.0.0
Architecture: iphoneos-arm
Description: Configure A/B features in YouTube app.
Description: Configure A/B features in iOS YouTube app.
Maintainer: PoomSmart
Author: PoomSmart
Section: Tweaks
Expand Down

0 comments on commit 4ca8b2d

Please sign in to comment.