Fix issue where unread and unstar statuses were getting lost if there wasn't already an article. Issue #708
This commit is contained in:
parent
7e6db47956
commit
886b82f3bd
|
@ -1122,6 +1122,15 @@ private extension FeedbinAccountDelegate {
|
||||||
_ = account.update(markUnreadArticles, statusKey: .read, flag: false)
|
_ = account.update(markUnreadArticles, statusKey: .read, flag: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save any unread statuses for articles we haven't yet received
|
||||||
|
let markUnreadArticleIDs = Set(markUnreadArticles.map { $0.articleID })
|
||||||
|
let missingUnreadArticleIDs = deltaUnreadArticleIDs.subtracting(markUnreadArticleIDs)
|
||||||
|
if !missingUnreadArticleIDs.isEmpty {
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
account.ensureStatuses(missingUnreadArticleIDs, .read, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Mark articles as read
|
// Mark articles as read
|
||||||
let deltaReadArticleIDs = currentUnreadArticleIDs.subtracting(feedbinUnreadArticleIDs)
|
let deltaReadArticleIDs = currentUnreadArticleIDs.subtracting(feedbinUnreadArticleIDs)
|
||||||
let markReadArticles = account.fetchArticles(forArticleIDs: deltaReadArticleIDs)
|
let markReadArticles = account.fetchArticles(forArticleIDs: deltaReadArticleIDs)
|
||||||
|
@ -1129,12 +1138,12 @@ private extension FeedbinAccountDelegate {
|
||||||
_ = account.update(markReadArticles, statusKey: .read, flag: true)
|
_ = account.update(markReadArticles, statusKey: .read, flag: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save any unread statuses for articles we haven't yet received
|
// Save any read statuses for articles we haven't yet received
|
||||||
let markUnreadArticleIDs = Set(markUnreadArticles.map { $0.articleID })
|
let markReadArticleIDs = Set(markReadArticles.map { $0.articleID })
|
||||||
let missingUnreadArticleIDs = deltaUnreadArticleIDs.subtracting(markUnreadArticleIDs)
|
let missingReadArticleIDs = deltaReadArticleIDs.subtracting(markReadArticleIDs)
|
||||||
if !missingUnreadArticleIDs.isEmpty {
|
if !missingReadArticleIDs.isEmpty {
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
account.ensureStatuses(missingUnreadArticleIDs, .read, false)
|
account.ensureStatuses(missingReadArticleIDs, .read, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1156,13 +1165,6 @@ private extension FeedbinAccountDelegate {
|
||||||
_ = account.update(markStarredArticles, statusKey: .starred, flag: true)
|
_ = account.update(markStarredArticles, statusKey: .starred, flag: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark articles as unstarred
|
|
||||||
let deltaUnstarredArticleIDs = currentStarredArticleIDs.subtracting(feedbinStarredArticleIDs)
|
|
||||||
let markUnstarredArticles = account.fetchArticles(forArticleIDs: deltaUnstarredArticleIDs)
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
_ = account.update(markUnstarredArticles, statusKey: .starred, flag: false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save any starred statuses for articles we haven't yet received
|
// Save any starred statuses for articles we haven't yet received
|
||||||
let markStarredArticleIDs = Set(markStarredArticles.map { $0.articleID })
|
let markStarredArticleIDs = Set(markStarredArticles.map { $0.articleID })
|
||||||
let missingStarredArticleIDs = deltaStarredArticleIDs.subtracting(markStarredArticleIDs)
|
let missingStarredArticleIDs = deltaStarredArticleIDs.subtracting(markStarredArticleIDs)
|
||||||
|
@ -1172,6 +1174,22 @@ private extension FeedbinAccountDelegate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mark articles as unstarred
|
||||||
|
let deltaUnstarredArticleIDs = currentStarredArticleIDs.subtracting(feedbinStarredArticleIDs)
|
||||||
|
let markUnstarredArticles = account.fetchArticles(forArticleIDs: deltaUnstarredArticleIDs)
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
_ = account.update(markUnstarredArticles, statusKey: .starred, flag: false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save any unstarred statuses for articles we haven't yet received
|
||||||
|
let markUnstarredArticleIDs = Set(markUnstarredArticles.map { $0.articleID })
|
||||||
|
let missingUnstarredArticleIDs = deltaUnstarredArticleIDs.subtracting(markUnstarredArticleIDs)
|
||||||
|
if !missingUnstarredArticleIDs.isEmpty {
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
account.ensureStatuses(missingUnstarredArticleIDs, .starred, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue