mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-22 23:58:36 +01:00
Add some logging to LocalAccountDelegate.
This commit is contained in:
parent
b5d132717d
commit
b0263c4ff3
@ -221,15 +221,16 @@ extension LocalAccountDelegate: FeedDownloaderDelegate {
|
||||
|
||||
func feedDownloader(_: FeedDownloader, requestCompletedForFeedURL feedURL: URL, response: URLResponse?, data: Data?, error: Error?) {
|
||||
|
||||
guard let account, let feed = account.existingFeed(urlString: feedURL.absoluteString) else {
|
||||
if let error {
|
||||
logger.debug("Error downloading: \(feedURL) - \(error)")
|
||||
return
|
||||
}
|
||||
|
||||
if let error {
|
||||
logger.debug("Error downloading \(feed.url) - \(error)")
|
||||
guard let response, let data, !data.isEmpty else {
|
||||
logger.debug("Missing response and/or data: \(feedURL)")
|
||||
return
|
||||
}
|
||||
guard let response, let data, !data.isEmpty else {
|
||||
guard let account, let feed = account.existingFeed(urlString: feedURL.absoluteString) else {
|
||||
return
|
||||
}
|
||||
|
||||
@ -238,11 +239,12 @@ extension LocalAccountDelegate: FeedDownloaderDelegate {
|
||||
|
||||
func feedDownloader(_: FeedDownloader, requestCanceledForFeedURL feedURL: URL, response: URLResponse?, data: Data?, error: Error?, reason: FeedDownloader.CancellationReason) {
|
||||
|
||||
// nothing to do
|
||||
logger.debug("Request canceled: \(feedURL) - \(reason)")
|
||||
}
|
||||
|
||||
func feedDownloaderSessionDidComplete(_: FeedDownloader) {
|
||||
|
||||
logger.debug("Feed downloader session did complete")
|
||||
account?.metadata.lastArticleFetchEndTime = Date()
|
||||
}
|
||||
|
||||
|
@ -25,11 +25,25 @@ public protocol FeedDownloaderDelegate: AnyObject {
|
||||
/// Use this to download feeds directly (local and iCloud accounts).
|
||||
@MainActor public final class FeedDownloader {
|
||||
|
||||
public enum CancellationReason {
|
||||
public enum CancellationReason: CustomStringConvertible {
|
||||
|
||||
case suspended
|
||||
case notFeedData
|
||||
case unexpectedResponse
|
||||
case notModified
|
||||
|
||||
public var description: String {
|
||||
switch self {
|
||||
case .suspended:
|
||||
return "suspended"
|
||||
case .notFeedData:
|
||||
return "notFeedData"
|
||||
case .unexpectedResponse:
|
||||
return "unexpectedResponse"
|
||||
case .notModified:
|
||||
return "notModified"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public weak var delegate: FeedDownloaderDelegate?
|
||||
|
Loading…
Reference in New Issue
Block a user