Skip to content

Commit

Permalink
Adapt the "Last Refresh" filter
Browse files Browse the repository at this point in the history
As the meaning of `createddate` has changed, we have to adopt another
approach which provides similar (but not identical) results.
  • Loading branch information
barijaona committed Aug 26, 2024
1 parent 0b979ef commit bb06760
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 11 deletions.
4 changes: 0 additions & 4 deletions Vienna/Sources/Application/AppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1764,10 +1764,6 @@ -(void)handleFolderNameChange:(NSNotification *)nc
-(void)handleRefreshStatusChange:(NSNotification *)nc
{
if (self.connecting) {
// Save the date/time of this refresh so we do the right thing when
// we apply the filter.
[[Preferences standardPreferences] setObject:[NSDate date] forKey:MAPref_LastRefreshDate];

// Toggle the refresh button
NSToolbarItem *item = [self toolbarItemWithIdentifier:@"Refresh"];
item.action = @selector(cancelAllRefreshesToolbar:);
Expand Down
5 changes: 1 addition & 4 deletions Vienna/Sources/Main window/ArticleController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1021,10 +1021,7 @@ - (BOOL)filterArticle:(Article *)article usingMode:(NSInteger)filterMode {
case VNAFilterUnread:
return !article.read;
case VNAFilterLastRefresh: {
NSDate *date = article.publicationDate;
Preferences *prefs = [Preferences standardPreferences];
NSComparisonResult result = [date compare:[prefs objectForKey:MAPref_LastRefreshDate]];
return result != NSOrderedAscending;
return article.status == ArticleStatusNew || article.status == ArticleStatusUpdated;
}
case VNAFilterToday:
return [NSCalendar.currentCalendar isDateInToday:article.lastUpdate];
Expand Down
1 change: 0 additions & 1 deletion Vienna/Sources/Preferences window/Preferences.m
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ -(NSDictionary *)allocFactoryDefaults
defaultValues[MAPref_FilterMode] = [NSNumber numberWithInt:VNAFilterAll];
defaultValues[MAPref_MinimumFontSize] = @(MA_Default_MinimumFontSize);
defaultValues[MAPref_AutoExpireDuration] = @(MA_Default_AutoExpireDuration);
defaultValues[MAPref_LastRefreshDate] = [NSDate distantPast];
defaultValues[MAPref_Layout] = [NSNumber numberWithInt:VNALayoutReport];
defaultValues[MAPref_NewArticlesNotification] = [NSNumber numberWithInt:0];
defaultValues[MAPref_EmptyTrashNotification] = [NSNumber numberWithInt:VNAEmptyTrashWithWarning];
Expand Down
1 change: 0 additions & 1 deletion Vienna/Sources/Shared/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ extern NSString * const MAPref_UseJavaScript;
extern NSString * const MAPref_CachedArticleGUID;
extern NSString * const MAPref_ArticleListSortOrders;
extern NSString * const MAPref_FilterMode;
extern NSString * const MAPref_LastRefreshDate;
extern NSString * const MAPref_TabList;
extern NSString * const MAPref_TabTitleDictionary;
extern NSString * const MAPref_Layout;
Expand Down
1 change: 0 additions & 1 deletion Vienna/Sources/Shared/Constants.m
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
NSString * const MAPref_CachedArticleGUID = @"CachedArticleGUID";
NSString * const MAPref_ArticleListSortOrders = @"ArticleListSortOrders";
NSString * const MAPref_FilterMode = @"FilterMode";
NSString * const MAPref_LastRefreshDate = @"LastRefreshDate";
NSString * const MAPref_TabList = @"TabList";
NSString * const MAPref_TabTitleDictionary = @"TabTitleDict";
NSString * const MAPref_Layout = @"Layout";
Expand Down

0 comments on commit bb06760

Please sign in to comment.