@@ -49,7 +49,7 @@ NSMutableDictionary *filters;
4949returns whether a message should be filtered based on some boolean logic of filters
5050**/
5151+ (BOOL )doesMessageMatchFilterType : (BOOL )titleMatches arg2 : (BOOL )subtitleMatches arg3 : (BOOL )messageMatches arg4 : (int )filterType {
52- HBLogDebug (@" NOTIBLOCK - checking matched: title: %@ , subtitle: %@ , message: %@ , filterType: %d " ,(titleMatches ? @" true" : @" false" ), (subtitleMatches ? @" true" : @" false" ), (messageMatches ? @" true" : @" false" ), filterType);
52+ NSLog (@" NOTIBLOCK - checking matched: title: %@ , subtitle: %@ , message: %@ , filterType: %d " ,(titleMatches ? @" true" : @" false" ), (subtitleMatches ? @" true" : @" false" ), (messageMatches ? @" true" : @" false" ), filterType);
5353 if (filterType == 0 ) {
5454 return titleMatches || titleMatches || messageMatches;
5555 } else if (filterType == 1 ) {
@@ -66,42 +66,42 @@ returns whether a message should be filtered based on some boolean logic of filt
6666returns whether we are currently inbetween the start time and and time and on a weekday set to true in an array of bools
6767**/
6868+(BOOL )areWeCurrentlyInSchedule : (NSDate *)startTime arg2 : (NSDate *)endTime arg3 : (NSArray *)weekdays {
69- HBLogDebug (@" NOTIBLOCK - checking schedule" );
69+ NSLog (@" NOTIBLOCK - checking schedule" );
7070
7171 NSDate *curTime = [NSDate date ];
7272
7373
7474 NSCalendar *calendar = [NSCalendar currentCalendar ];
7575
7676 NSDateComponents *startComponents = [calendar components: (NSCalendarUnitHour | NSCalendarUnitMinute) fromDate: startTime];
77- NSCalendar *newStartCalendar = [[NSCalendar alloc ] initWithCalendarIdentifier: NSGregorianCalendar ];
77+ NSCalendar *newStartCalendar = [[NSCalendar alloc ] initWithCalendarIdentifier: NSCalendarIdentifierGregorian ];
7878 NSDate *newStartTime = [newStartCalendar dateBySettingHour: [startComponents hour ] minute: [startComponents minute ] second: 0 ofDate: curTime options: 0 ];
7979
8080 NSDateComponents *endComponents = [calendar components: (NSCalendarUnitHour | NSCalendarUnitMinute) fromDate: endTime];
81- NSCalendar *newEndCalendar = [[NSCalendar alloc ] initWithCalendarIdentifier: NSGregorianCalendar ];
81+ NSCalendar *newEndCalendar = [[NSCalendar alloc ] initWithCalendarIdentifier: NSCalendarIdentifierGregorian ];
8282 NSDate *newEndTime = [newEndCalendar dateBySettingHour: [endComponents hour ] minute: [endComponents minute ] second: 0 ofDate: curTime options: 0 ];
8383
8484
8585 NSInteger curWeekday = [[NSCalendar currentCalendar ] component: NSCalendarUnitWeekday
8686 fromDate: curTime] - 1 ;
8787 // day of week is not selected
8888 if (![((NSNumber *)weekdays[curWeekday]) boolValue ]) {
89- HBLogDebug (@" NOTIBLOCK - day is not active. skipping filter" );
89+ NSLog (@" NOTIBLOCK - day is not active. skipping filter" );
9090 return false ;
9191 }
9292
9393 if ([[newStartTime earlierDate: newEndTime] isEqualToDate: newEndTime]) { // backwards (start time before end time)
94- HBLogDebug (@" NOTIBLOCK - backwards schedule mode" );
94+ NSLog (@" NOTIBLOCK - backwards schedule mode" );
9595 return [[newStartTime earlierDate: curTime] isEqualToDate: newStartTime] || [[newEndTime earlierDate: curTime] isEqualToDate: curTime];
9696 } else { // regular, check for in between
9797
98- HBLogDebug (@" NOTIBLOCK - regular schedule mode" );
99- HBLogDebug (@" NOTIBLOCK - curTime: %f " , [curTime timeIntervalSince1970 ]);
100- HBLogDebug (@" NOTIBLOCK - newStartTime: %f " , [newStartTime timeIntervalSince1970 ]);
101- HBLogDebug (@" NOTIBLOCK - newEndTime: %f " , [newEndTime timeIntervalSince1970 ]);
98+ NSLog (@" NOTIBLOCK - regular schedule mode" );
99+ NSLog (@" NOTIBLOCK - curTime: %f " , [curTime timeIntervalSince1970 ]);
100+ NSLog (@" NOTIBLOCK - newStartTime: %f " , [newStartTime timeIntervalSince1970 ]);
101+ NSLog (@" NOTIBLOCK - newEndTime: %f " , [newEndTime timeIntervalSince1970 ]);
102102
103- HBLogDebug (@" NOTIBLOCK - is after start - %@ " ,([[newStartTime earlierDate: curTime] isEqualToDate: newStartTime] ? @" true" : @" false" ));
104- HBLogDebug (@" NOTIBLOCK - is before end - %@ " ,([[newEndTime earlierDate: curTime] isEqualToDate: curTime] ? @" true" : @" false" ));
103+ NSLog (@" NOTIBLOCK - is after start - %@ " ,([[newStartTime earlierDate: curTime] isEqualToDate: newStartTime] ? @" true" : @" false" ));
104+ NSLog (@" NOTIBLOCK - is before end - %@ " ,([[newEndTime earlierDate: curTime] isEqualToDate: curTime] ? @" true" : @" false" ));
105105 return [[newEndTime earlierDate: curTime] isEqualToDate: curTime] && [[newStartTime earlierDate: curTime] isEqualToDate: newStartTime];
106106 }
107107}
@@ -118,17 +118,17 @@ returns whether we are currently inbetween the start time and and time and on a
118118 // NSString *bulletinID = bulletin.bulletinID;
119119 NSString *sectionId = bulletin.sectionID ;
120120
121- // HBLogDebug (@"NOTIBLOCK - Entered publish bulletin for %@ with ID: %@ ", sectionId, bulletinID);
122- // HBLogDebug (@"NOTIBLOCK - BulletinID:%@ Title: %@ Subtitle: %@ Message: %@", bulletinID, title, subtitle, message );
121+ // NSLog (@"NOTIBLOCK - Entered publish bulletin for %@ with ID: %@ ", sectionId, bulletinID);
122+ // NSLog (@"NOTIBLOCK - BulletinID:%@ Title: %@ Subtitle: %@ Message: %@", bulletinID, title, subtitle, message );
123123
124124 BOOL filtered = NO ;
125125
126126 if (filters == nil ) {
127- HBLogDebug (@" NOTIBLOCK - No filters. returning" );
127+ NSLog (@" NOTIBLOCK - No filters. returning" );
128128 return 0 ;
129129 }
130130
131- HBLogDebug (@" NOTIBLOCK - loading all filters: %lu " , (unsigned long )[filters count ]);
131+ NSLog (@" NOTIBLOCK - loading all filters: %lu " , (unsigned long )[filters count ]);
132132
133133 NSMutableArray *allFilters = [filters objectForKey: @" " ];
134134 NSMutableArray *appFilters = [filters objectForKey: sectionId];
@@ -141,7 +141,7 @@ returns whether we are currently inbetween the start time and and time and on a
141141 allFilters = [[allFilters arrayByAddingObjectsFromArray: appFilters] mutableCopy ];
142142 }
143143
144- HBLogDebug (@" NOTIBLOCK - loading relevant filters for --%@ --: %lu " ,sectionId, (unsigned long )[allFilters count ]);
144+ NSLog (@" NOTIBLOCK - loading relevant filters for --%@ --: %lu " ,sectionId, (unsigned long )[allFilters count ]);
145145
146146 if (title == nil ) {
147147 title = @" " ;
@@ -161,7 +161,7 @@ returns whether we are currently inbetween the start time and and time and on a
161161 // check for schedule and skip if not inside
162162 if (filter.onSchedule && ![self areWeCurrentlyInSchedule: filter.startTime arg2: filter.endTime arg3: filter.weekDays]) {
163163 // not inside schedule, skip
164- HBLogDebug (@" NOTIBLOCK - schedule was on, but we determined it is not currently active. skipping filter" );
164+ NSLog (@" NOTIBLOCK - schedule was on, but we determined it is not currently active. skipping filter" );
165165 continue ;
166166 }
167167
@@ -172,43 +172,43 @@ returns whether we are currently inbetween the start time and and time and on a
172172
173173 // do filtering
174174 if (filter.blockType == 0 ) { // starts with
175- HBLogDebug (@" NOTIBLOCK - checking if string starts with text" );
175+ NSLog (@" NOTIBLOCK - checking if string starts with text" );
176176 titleMatches = [title hasPrefix: filterText];
177177 subtitleMatches = [subtitle hasPrefix: filterText];
178178 messageMatches = [message hasPrefix: filterText];
179179 } else if (filter.blockType == 1 ) { // ends with
180- HBLogDebug (@" NOTIBLOCK - checking if string end with text" );
180+ NSLog (@" NOTIBLOCK - checking if string end with text" );
181181 titleMatches = [title hasSuffix: filterText];
182182 subtitleMatches = [subtitle hasSuffix: filterText];
183183 messageMatches = [message hasSuffix: filterText];
184184 } else if (filter.blockType == 2 ) { // contains
185- HBLogDebug (@" NOTIBLOCK - checking if string contains text" );
185+ NSLog (@" NOTIBLOCK - checking if string contains text" );
186186 titleMatches = [title rangeOfString: filterText].location != NSNotFound ;
187187 subtitleMatches = [subtitle rangeOfString: filterText].location != NSNotFound ;
188188 messageMatches = [message rangeOfString: filterText].location != NSNotFound ;
189189 } else if (filter.blockType == 3 ) { // exact text
190- HBLogDebug (@" NOTIBLOCK - checking if string matches text" );
190+ NSLog (@" NOTIBLOCK - checking if string matches text" );
191191 titleMatches = [title isEqualToString: filterText];
192192 subtitleMatches = [subtitle isEqualToString: filterText];
193193 messageMatches = [message isEqualToString: filterText];
194194 } else if (filter.blockType == 4 ) { // regex
195- HBLogDebug (@" NOTIBLOCK - checking if string matches regex" );
195+ NSLog (@" NOTIBLOCK - checking if string matches regex" );
196196 NSPredicate *notifTest = [NSPredicate predicateWithFormat: @" SELF MATCHES %@" , filterText];
197197 titleMatches = ![title isEqualToString: @" " ] && [notifTest evaluateWithObject: title];
198198 subtitleMatches = ![subtitle isEqualToString: @" " ] && [notifTest evaluateWithObject: subtitle];
199199 messageMatches = ![message isEqualToString: @" " ] && [notifTest evaluateWithObject: message];
200200 } else if (filter.blockType == 5 ) { // always
201- HBLogDebug (@" NOTIBLOCK - app should always be filtered. filtering turned on" );
201+ NSLog (@" NOTIBLOCK - app should always be filtered. filtering turned on" );
202202 filtered = YES ;
203203 }
204204
205205 if ([self doesMessageMatchFilterType: titleMatches arg2: subtitleMatches arg3: messageMatches arg4: filter.filterType]) {
206- HBLogDebug (@" NOTIBLOCK - filtering was matched" );
206+ NSLog (@" NOTIBLOCK - filtering was matched" );
207207 filtered = YES ;
208208 }
209209
210210 if (filter.whitelistMode ) {
211- HBLogDebug (@" NOTIBLOCK - whitelist Mode on" );
211+ NSLog (@" NOTIBLOCK - whitelist Mode on" );
212212 filtered = !filtered;
213213 }
214214
@@ -242,7 +242,7 @@ Loads filters into memory from disk when springboard is loaded
242242-(void )applicationDidFinishLaunching:(id )application {
243243 %orig ;
244244
245- HBLogDebug (@" NOTIBLOCK - springboard launch" );
245+ NSLog (@" NOTIBLOCK - springboard launch" );
246246
247247 // do in background thread?
248248 HBPreferences *defaults = [[HBPreferences alloc ] initWithIdentifier: @" com.shemeshapps.notiblock" ];
@@ -252,11 +252,11 @@ Loads filters into memory from disk when springboard is loaded
252252 bool enabled = [([prefDefaults objectForKey: @" enabled" ] ?: @(YES )) boolValue ];
253253
254254 // for (NSString *key in [[prefDefaults dictionaryRepresentation] allKeys]) {
255- // HBLogDebug (@"NOTIBLOCK - pref keys: %@", key);
255+ // NSLog (@"NOTIBLOCK - pref keys: %@", key);
256256 // }
257257
258258 if (!enabled) {
259- HBLogDebug (@" NOTIBLOCK - tweak disabled. not loading filters" );
259+ NSLog (@" NOTIBLOCK - tweak disabled. not loading filters" );
260260 return ;
261261 }
262262
@@ -278,10 +278,10 @@ Loads filters into memory from disk when springboard is loaded
278278 NSMutableArray *appIdfilters = [filters objectForKey: dictKey];
279279 [appIdfilters addObject: filter];
280280
281- HBLogDebug (@" NOTIBLOCK - adding filter to dict for appkey: --%@ --" , dictKey);
281+ NSLog (@" NOTIBLOCK - adding filter to dict for appkey: --%@ --" , dictKey);
282282 }
283283 } else {
284- HBLogDebug (@" NOTIBLOCK - springboard data load was nil" );
284+ NSLog (@" NOTIBLOCK - springboard data load was nil" );
285285 }
286286}
287287
@@ -307,7 +307,7 @@ Code to hide the banner dropdown view
307307- (void )viewWillAppear:(BOOL )animated {
308308 %orig ;
309309 if (self.view .hidden ) {
310- HBLogDebug (@" NOTIBLOCK - NCNotificationShortLookViewController will appear - dismissing banner" );
310+ NSLog (@" NOTIBLOCK - NCNotificationShortLookViewController will appear - dismissing banner" );
311311 [self dismissViewControllerAnimated: NO completion: nil ];
312312 }
313313}
0 commit comments