Fix adding feeds when offline or paused

This commit is contained in:
relikd
2019-08-14 16:47:34 +02:00
parent e6f4d05213
commit 9e7eda692b
14 changed files with 73 additions and 64 deletions

View File

@@ -72,11 +72,10 @@
@property (strong) RefreshStatisticsView *statisticsView;
@property (copy) NSString *previousURL; // check if changed and avoid multiple download
@property (copy) NSString *httpDate;
@property (copy) NSString *httpEtag;
@property (copy) NSString *faviconURL;
@property (strong) NSError *feedError; // download error or xml parser error
@property (strong) RSParsedFeed *feedResult; // parsed result
@property (strong) NSHTTPURLResponse *httpResponse;
@property (assign) BOOL didDownloadFeed; // check if feed articles need update
@end
@@ -119,7 +118,7 @@
[meta setRefreshAndSchedule:[NSDate intervalForPopup:self.view.refreshUnit andField:self.view.refreshNum]];
// updateTimer will be scheduled once preferences is closed
if (self.didDownloadFeed) {
[meta setEtag:self.httpEtag modified:self.httpDate];
[meta setSucessfulWithResponse:self.httpResponse];
[feed updateWithRSS:self.feedResult postUnreadCountChange:YES];
[feed setIconImage:self.view.favicon.image];
}
@@ -141,10 +140,9 @@
if ([self.view.name.stringValue isEqualToString:self.feedResult.title]) {
self.view.name.stringValue = @"";
}
self.feedResult = nil;
self.feedError = nil;
self.httpEtag = nil;
self.httpDate = nil;
self.feedResult = nil;
self.httpResponse = nil;
self.faviconURL = nil;
self.previousURL = self.view.url.stringValue;
}
@@ -167,8 +165,7 @@
self.didDownloadFeed = YES;
self.feedResult = result;
self.feedError = error;
self.httpEtag = [response allHeaderFields][@"Etag"];
self.httpDate = [response allHeaderFields][@"Date"]; // @"Expires", @"Last-Modified"
self.httpResponse = response;
[self postDownload:response.URL.absoluteString];
}];
}

View File

@@ -23,7 +23,7 @@
#import "SettingsFeeds+DragDrop.h"
#import "StoreCoordinator.h"
#import "Constants.h"
#import "WebFeed.h"
#import "UpdateScheduler.h"
#import "FeedGroup+Ext.h"
// Pasteboard type used during internal row reordering
@@ -160,7 +160,8 @@ const NSPasteboardType dragReorder = @"de.relikd.baRSS.drag-reorder";
[StoreCoordinator saveContext:moc andParent:YES];
if (selection.count > 0)
[self.dataStore setSelectionIndexPaths:[selection sortedArrayUsingSelector:@selector(compare:)]];
[WebFeed batchDownloadFeeds:feedsList favicons:YES showErrorAlert:YES finally:^{
[UpdateScheduler downloadList:feedsList background:NO finally:^{
[self endCoreDataChangeUndoEmpty:NO forceUndo:NO];
[self someDatesChangedScheduleUpdateTimer];
}];