Skip to content

Commit

Permalink
remove alternative date calculation from refresh manager
Browse files Browse the repository at this point in the history
The current implementation interfers with the new usage of the update date
We may need to restore the behavior that sets the updated date to the newsfeed update date.
That could be a setting on a per-feed basis.
  • Loading branch information
TAKeanice committed Nov 3, 2024
1 parent f64bceb commit 2c1aee6
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions Vienna/Sources/Fetching/RefreshManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -832,28 +832,11 @@ -(void)finalizeFolderRefresh:(NSDictionary *)parameters
NSMutableArray *articleArray = [NSMutableArray array];
NSMutableArray *articleGuidArray = [NSMutableArray array];

NSDate *itemAlternativeDate = newFeed.modificationDate;
if (itemAlternativeDate == nil) {
itemAlternativeDate = [NSDate date];
}

// Parse off items.

for (id<VNAFeedItem> newsItem in newFeed.items) {
NSDate * articleDate = newsItem.publicationDate;
NSDate * modificationDate = newsItem.modificationDate;

NSString * articleGuid = newsItem.guid;


// set the article date if it is missing. We'll use the
// last modified date of the feed and set each article to be 1 second older than the
// previous one. So the array is effectively newest first.
if (articleDate == nil) {
articleDate = itemAlternativeDate;
itemAlternativeDate = [itemAlternativeDate dateByAddingTimeInterval:-1.0];
}
NSString * articleGuid = [self getOrCalculateArticleGuid:newsItem articleDate:articleDate folderId:folderId articles:articleArray articleGuidArray:articleGuidArray];
NSString * articleGuid = [self getOrCalculateArticleGuid:newsItem folderId:folderId articles:articleArray articleGuidArray:articleGuidArray];
[articleGuidArray addObject:articleGuid];

Article * article = [[Article alloc] initWithGuid:articleGuid];
Expand All @@ -878,8 +861,8 @@ -(void)finalizeFolderRefresh:(NSDictionary *)parameters
articleLink = feedLink;
}
article.link = articleLink;
article.publicationDate = articleDate;
article.lastUpdate = modificationDate;
article.publicationDate = newsItem.publicationDate;
article.lastUpdate = newsItem.modificationDate;
NSString * enclosureLink = newsItem.enclosure;
if ([enclosureLink isNotEqualTo:@""] && ![enclosureLink hasPrefix:@"http:"] && ![enclosureLink hasPrefix:@"https:"]) {
enclosureLink = [NSURL URLWithString:enclosureLink relativeToURL:url].absoluteString;
Expand Down

0 comments on commit 2c1aee6

Please sign in to comment.