Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Commit 737525b

Browse files
authored
kvo static rules (#1425)
1 parent 8199348 commit 737525b

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

Diff for: Source/common/SNTConfigurator.m

+6-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,12 @@ + (NSSet *)keyPathsForValuesAffectingFileChangesPrefixFiltersKey {
368368
}
369369

370370
+ (NSSet *)keyPathsForValuesAffectingStaticRules {
371-
return [self configStateSet];
371+
static NSSet *set;
372+
static dispatch_once_t onceToken;
373+
dispatch_once(&onceToken, ^{
374+
set = [NSSet setWithObject:NSStringFromSelector(@selector(cachedStaticRules))];
375+
});
376+
return set;
372377
}
373378

374379
+ (NSSet *)keyPathsForValuesAffectingSyncBaseURL {

Diff for: Source/santad/Santad.mm

+3-6
Original file line numberDiff line numberDiff line change
@@ -315,12 +315,9 @@ void SantadMain(std::shared_ptr<EndpointSecurityAPI> esapi, std::shared_ptr<Logg
315315
}],
316316
[[SNTKVOManager alloc] initWithObject:configurator
317317
selector:@selector(staticRules)
318-
type:[NSArray class]
319-
callback:^(NSArray *oldValue, NSArray *newValue) {
320-
NSSet *oldValueSet = [NSSet setWithArray:oldValue ?: @[]];
321-
NSSet *newValueSet = [NSSet setWithArray:newValue ?: @[]];
322-
323-
if ([oldValueSet isEqualToSet:newValueSet]) {
318+
type:[NSDictionary class]
319+
callback:^(NSDictionary *oldValue, NSDictionary *newValue) {
320+
if ([oldValue isEqualToDictionary:newValue]) {
324321
return;
325322
}
326323

0 commit comments

Comments
 (0)