@@ -17,7 +17,7 @@ @interface BNCURLFilter () {
1717@property (strong ) NSArray <NSRegularExpression*> *ignoredURLRegex;
1818@property (assign ) NSInteger blackListVersion;
1919@property (strong ) id <BNCNetworkServiceProtocol> networkService;
20- @property (assign ) BOOL hasRefreshedBlackListFromServer ;
20+ @property (assign ) BOOL hasUpdatedPatternList ;
2121@property (strong ) NSError *error;
2222@property (strong ) NSURL *blackListJSONURL;
2323@end
@@ -28,7 +28,7 @@ - (instancetype) init {
2828 self = [super init ];
2929 if (!self) return self;
3030
31- self.blackList = @[
31+ self.patternList = @[
3232 @" ^fb\\ d+:" ,
3333 @" ^li\\ d+:" ,
3434 @" ^pdk\\ d+:" ,
@@ -41,12 +41,12 @@ - (instancetype) init {
4141
4242 NSArray *storedList = [BNCPreferenceHelper preferenceHelper ].URLBlackList ;
4343 if (storedList.count > 0 ) {
44- self.blackList = storedList;
44+ self.patternList = storedList;
4545 self.blackListVersion = [BNCPreferenceHelper preferenceHelper ].URLBlackListVersion ;
4646 }
4747
4848 NSError *error = nil ;
49- _ignoredURLRegex = [self .class compileRegexArray: self .blackList error: &error];
49+ _ignoredURLRegex = [self .class compileRegexArray: self .patternList error: &error];
5050 self.error = error;
5151
5252 return self;
@@ -57,14 +57,14 @@ - (void) dealloc {
5757 self.networkService = nil ;
5858}
5959
60- - (void ) setBlackList : (NSArray <NSString *> *)blackList {
60+ - (void ) setPatternList : (NSArray <NSString *> *)blackList {
6161 @synchronized (self) {
6262 _blackList = blackList;
6363 _ignoredURLRegex = [self .class compileRegexArray: _blackList error: nil ];
6464 }
6565}
6666
67- - (NSArray <NSString*>*) blackList {
67+ - (NSArray <NSString*>*) patternList {
6868 @synchronized (self) {
6969 return _blackList;
7070 }
@@ -108,16 +108,16 @@ - (BOOL) shouldIgnoreURL:(NSURL *)url {
108108}
109109
110110- (void ) refreshBlackListFromServer {
111- [self refreshBlackListFromServerWithCompletion :nil ];
111+ [self updatePatternListWithCompletion :nil ];
112112}
113113
114- - (void ) refreshBlackListFromServerWithCompletion : (void (^) (NSError *error, NSArray *list))completion {
114+ - (void ) updatePatternListWithCompletion : (void (^) (NSError *error, NSArray *list))completion {
115115 @synchronized (self) {
116- if (self.hasRefreshedBlackListFromServer ) {
117- if (completion) completion (self.error , self.blackList );
116+ if (self.hasUpdatedPatternList ) {
117+ if (completion) completion (self.error , self.patternList );
118118 return ;
119119 }
120- self.hasRefreshedBlackListFromServer = YES ;
120+ self.hasUpdatedPatternList = YES ;
121121 }
122122
123123 self.error = nil ;
@@ -135,7 +135,7 @@ - (void) refreshBlackListFromServerWithCompletion:(void (^) (NSError*error, NSAr
135135 [self .networkService networkOperationWithURLRequest: request completion:
136136 ^(id <BNCNetworkOperationProtocol> operation) {
137137 [self processServerOperation: operation];
138- if (completion) completion (self.error , self.blackList );
138+ if (completion) completion (self.error , self.patternList );
139139 [self .networkService cancelAllOperations ];
140140 self.networkService = nil ;
141141 }
@@ -172,9 +172,9 @@ - (void) processServerOperation:(id<BNCNetworkOperationProtocol>)operation {
172172 NSNumber *blackListVersion = dictionary[@" version" ];
173173 if (![blackListVersion isKindOfClass: NSNumber .class]) return ;
174174
175- self.blackList = blackListURLs;
175+ self.patternList = blackListURLs;
176176 self.blackListVersion = [blackListVersion longValue ];
177- [BNCPreferenceHelper preferenceHelper ].URLBlackList = self.blackList ;
177+ [BNCPreferenceHelper preferenceHelper ].URLBlackList = self.patternList ;
178178 [BNCPreferenceHelper preferenceHelper ].URLBlackListVersion = self.blackListVersion ;
179179}
180180
0 commit comments