Skip to content

Commit

Permalink
Reduced logging for non-existing keys
Browse files Browse the repository at this point in the history
  • Loading branch information
PoomSmart committed Oct 27, 2022
1 parent c915f40 commit 940f9c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 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.1
PACKAGE_VERSION = 1.4.2

include $(THEOS)/makefiles/common.mk

Expand Down
4 changes: 3 additions & 1 deletion Tweak.xm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ static const NSInteger YTABCSection = 404;

NSMutableDictionary <NSString *, NSMutableDictionary <NSString *, NSNumber *> *> *cache;
NSUserDefaults *defaults;
NSArray <NSString *> *allKeys;

static BOOL tweakEnabled() {
return [defaults boolForKey:EnabledKey];
Expand All @@ -47,7 +48,7 @@ static NSString *getCacheKey(NSString *method, NSString *classKey) {
}

static BOOL getValue(NSString *methodKey) {
if ([defaults objectForKey:methodKey] == nil)
if (![allKeys containsObject:methodKey])
return [[cache valueForKeyPath:[methodKey substringFromIndex:Prefix.length + 1]] boolValue];
return [defaults boolForKey:methodKey];
}
Expand Down Expand Up @@ -351,6 +352,7 @@ static void hookClass(NSObject *instance) {

- (BOOL)application:(id)arg1 didFinishLaunchingWithOptions:(id)arg2 {
defaults = [NSUserDefaults standardUserDefaults];
allKeys = [defaults dictionaryRepresentation].allKeys;
if (tweakEnabled()) {
YTGlobalConfig *globalConfig = [self valueForKey:@"_globalConfig"];
YTColdConfig *coldConfig = [self valueForKey:@"_coldConfig"];
Expand Down

0 comments on commit 940f9c9

Please sign in to comment.