Skip to content

Commit

Permalink
kvo static rules (#1425)
Browse files Browse the repository at this point in the history
  • Loading branch information
tburgin authored Sep 12, 2024
1 parent 8199348 commit 737525b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 6 additions & 1 deletion Source/common/SNTConfigurator.m
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,12 @@ + (NSSet *)keyPathsForValuesAffectingFileChangesPrefixFiltersKey {
}

+ (NSSet *)keyPathsForValuesAffectingStaticRules {
return [self configStateSet];
static NSSet *set;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
set = [NSSet setWithObject:NSStringFromSelector(@selector(cachedStaticRules))];
});
return set;
}

+ (NSSet *)keyPathsForValuesAffectingSyncBaseURL {
Expand Down
9 changes: 3 additions & 6 deletions Source/santad/Santad.mm
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,9 @@ void SantadMain(std::shared_ptr<EndpointSecurityAPI> esapi, std::shared_ptr<Logg
}],
[[SNTKVOManager alloc] initWithObject:configurator
selector:@selector(staticRules)
type:[NSArray class]
callback:^(NSArray *oldValue, NSArray *newValue) {
NSSet *oldValueSet = [NSSet setWithArray:oldValue ?: @[]];
NSSet *newValueSet = [NSSet setWithArray:newValue ?: @[]];

if ([oldValueSet isEqualToSet:newValueSet]) {
type:[NSDictionary class]
callback:^(NSDictionary *oldValue, NSDictionary *newValue) {
if ([oldValue isEqualToDictionary:newValue]) {
return;
}

Expand Down

0 comments on commit 737525b

Please sign in to comment.