mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-11 09:14:06 +01:00
Back date the Feedbin since parameter to pick up updates done within 24 hours of the original post. Fixes #2549
This commit is contained in:
parent
77743f734d
commit
1a3d2987f0
@ -34,6 +34,7 @@ final class FeedbinAPICaller: NSObject {
|
|||||||
private let feedbinBaseURL = URL(string: "https://api.feedbin.com/v2/")!
|
private let feedbinBaseURL = URL(string: "https://api.feedbin.com/v2/")!
|
||||||
private var transport: Transport!
|
private var transport: Transport!
|
||||||
private var suspended = false
|
private var suspended = false
|
||||||
|
private var lastBackdateStartTime: Date?
|
||||||
|
|
||||||
var credentials: Credentials?
|
var credentials: Credentials?
|
||||||
weak var accountMetadata: AccountMetadata?
|
weak var accountMetadata: AccountMetadata?
|
||||||
@ -486,10 +487,26 @@ final class FeedbinAPICaller: NSObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func retrieveEntries(completion: @escaping (Result<([FeedbinEntry]?, String?, Date?, Int?), Error>) -> Void) {
|
func retrieveEntries(completion: @escaping (Result<([FeedbinEntry]?, String?, Date?, Int?), Error>) -> Void) {
|
||||||
|
|
||||||
|
// If this is an initial sync, go and grab the previous 3 months of entries. If not, use the last
|
||||||
|
// article fetch to only get the articles **published** since the last article fetch.
|
||||||
|
//
|
||||||
|
// We do a backdate fetch every launch or every 24 hours. This will help with
|
||||||
|
// getting **updated** articles that normally wouldn't be found with a regular fetch.
|
||||||
|
// https://github.com/Ranchero-Software/NetNewsWire/issues/2549#issuecomment-722341356
|
||||||
let since: Date = {
|
let since: Date = {
|
||||||
if let lastArticleFetch = accountMetadata?.lastArticleFetchStartTime {
|
if let lastArticleFetch = accountMetadata?.lastArticleFetchStartTime {
|
||||||
return lastArticleFetch
|
if let lastBackdateStartTime = lastBackdateStartTime {
|
||||||
|
if lastBackdateStartTime.byAdding(days: 1) < lastArticleFetch {
|
||||||
|
self.lastBackdateStartTime = lastArticleFetch
|
||||||
|
return lastArticleFetch.bySubtracting(days: 1)
|
||||||
|
} else {
|
||||||
|
return lastArticleFetch
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
self.lastBackdateStartTime = lastArticleFetch
|
||||||
|
return lastArticleFetch.bySubtracting(days: 1)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return Calendar.current.date(byAdding: .month, value: -3, to: Date()) ?? Date()
|
return Calendar.current.date(byAdding: .month, value: -3, to: Date()) ?? Date()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user