mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-07 07:32:18 +01:00
Delete some commented-out code that has been superseded.
This commit is contained in:
parent
2d1c63403d
commit
3c43732e25
@ -114,28 +114,6 @@ final class ArticlesTable: DatabaseTable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// func uniquedArticles(_ fetchedArticles: Set<Article>, statusesTable: StatusesTable) -> Set<Article> {
|
|
||||||
//
|
|
||||||
// var articles = Set<Article>()
|
|
||||||
//
|
|
||||||
// for oneArticle in fetchedArticles {
|
|
||||||
//
|
|
||||||
// assert(oneArticle.status != nil)
|
|
||||||
//
|
|
||||||
// if let existingArticle = cachedArticle(oneArticle.databaseID) {
|
|
||||||
// articles.insert(existingArticle)
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// cacheArticle(oneArticle)
|
|
||||||
// articles.insert(oneArticle)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// statusesTable.attachCachedStatuses(articles)
|
|
||||||
//
|
|
||||||
// return articles
|
|
||||||
// }
|
|
||||||
|
|
||||||
// typealias FeedCountCallback = (Int) -> Void
|
// typealias FeedCountCallback = (Int) -> Void
|
||||||
//
|
//
|
||||||
// func numberOfArticlesWithFeedID(_ feedID: String, callback: @escaping FeedCountCallback) {
|
// func numberOfArticlesWithFeedID(_ feedID: String, callback: @escaping FeedCountCallback) {
|
||||||
@ -221,23 +199,10 @@ private extension ArticlesTable {
|
|||||||
|
|
||||||
return fetchArticlesWithWhereClause(database, whereClause: "articles.feedID = ?", parameters: [feedID as AnyObject])
|
return fetchArticlesWithWhereClause(database, whereClause: "articles.feedID = ?", parameters: [feedID as AnyObject])
|
||||||
}
|
}
|
||||||
|
|
||||||
// func cachedArticle(_ articleID: String) -> Article? {
|
|
||||||
//
|
|
||||||
// return cachedArticles.object(forKey: articleID as NSString)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// func cacheArticle(_ article: Article) {
|
|
||||||
//
|
|
||||||
// cachedArticles.setObject(article, forKey: article.databaseID as NSString)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// func cacheArticles(_ articles: Set<Article>) {
|
|
||||||
//
|
|
||||||
// articles.forEach { cacheArticle($0) }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: -
|
||||||
|
|
||||||
private struct ArticleCache {
|
private struct ArticleCache {
|
||||||
|
|
||||||
// Main thread only — unlike the other object caches.
|
// Main thread only — unlike the other object caches.
|
||||||
|
@ -46,37 +46,11 @@ public final class Database {
|
|||||||
public func fetchArticles(for feed: Feed) -> Set<Article> {
|
public func fetchArticles(for feed: Feed) -> Set<Article> {
|
||||||
|
|
||||||
return articlesTable.fetchArticles(feed)
|
return articlesTable.fetchArticles(feed)
|
||||||
|
|
||||||
// return Set<Article>() // TODO
|
|
||||||
// var fetchedArticles = Set<Article>()
|
|
||||||
// let feedID = feed.feedID
|
|
||||||
//
|
|
||||||
// queue.fetchSync { (database: FMDatabase!) -> Void in
|
|
||||||
//
|
|
||||||
// fetchedArticles = self.fetchArticlesForFeedID(feedID, database: database)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// let articles = articleCache.uniquedArticles(fetchedArticles, statusesTable: statusesTable)
|
|
||||||
// return filteredArticles(articles, feedCounts: [feed.feedID: fetchedArticles.count])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public func fetchArticlesAsync(for feed: Feed, _ resultBlock: @escaping ArticleResultBlock) {
|
public func fetchArticlesAsync(for feed: Feed, _ resultBlock: @escaping ArticleResultBlock) {
|
||||||
|
|
||||||
articlesTable.fetchArticlesAsync(feed, resultBlock)
|
articlesTable.fetchArticlesAsync(feed, resultBlock)
|
||||||
|
|
||||||
// let feedID = feed.feedID
|
|
||||||
//
|
|
||||||
// queue.fetch { (database: FMDatabase!) -> Void in
|
|
||||||
//
|
|
||||||
// let fetchedArticles = self.fetchArticlesForFeedID(feedID, database: database)
|
|
||||||
//
|
|
||||||
// DispatchQueue.main.async() { () -> Void in
|
|
||||||
//
|
|
||||||
// let articles = self.articleCache.uniquedArticles(fetchedArticles, statusesTable: self.statusesTable)
|
|
||||||
// let filteredArticles = self.filteredArticles(articles, feedCounts: [feed.feedID: fetchedArticles.count])
|
|
||||||
// resultBlock(filteredArticles)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public func fetchUnreadArticles(for folder: Folder) -> Set<Article> {
|
public func fetchUnreadArticles(for folder: Folder) -> Set<Article> {
|
||||||
@ -329,38 +303,7 @@ private extension Database {
|
|||||||
//
|
//
|
||||||
// return result
|
// return result
|
||||||
// }
|
// }
|
||||||
//
|
|
||||||
// // MARK: Fetching Articles
|
|
||||||
//
|
|
||||||
// func fetchArticlesWithWhereClause(_ database: FMDatabase, whereClause: String, parameters: [AnyObject]?) -> Set<Article> {
|
|
||||||
//
|
|
||||||
// let sql = "select * from articles where \(whereClause);"
|
|
||||||
// logSQL(sql)
|
|
||||||
//
|
|
||||||
// if let resultSet = database.executeQuery(sql, withArgumentsIn: parameters) {
|
|
||||||
// return articlesWithResultSet(resultSet, database)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return Set<Article>()
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// func articlesWithResultSet(_ resultSet: FMResultSet, _ database: FMDatabase) -> Set<Article> {
|
|
||||||
//
|
|
||||||
// let fetchedArticles = resultSet.mapToSet { Article(account: self.account, row: $0) }
|
|
||||||
//
|
|
||||||
// statusesTable.attachStatuses(fetchedArticles, database)
|
|
||||||
// authorsTable.attachAuthors(fetchedArticles, database)
|
|
||||||
// tagsTable.attachTags(fetchedArticles, database)
|
|
||||||
// attachmentsTable.attachAttachments(fetchedArticles, database)
|
|
||||||
//
|
|
||||||
// return fetchedArticles
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// func fetchArticlesForFeedID(_ feedID: String, database: FMDatabase) -> Set<Article> {
|
|
||||||
//
|
|
||||||
// return fetchArticlesWithWhereClause(database, whereClause: "articles.feedID = ?", parameters: [feedID as AnyObject])
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // MARK: Unread counts
|
// // MARK: Unread counts
|
||||||
//
|
//
|
||||||
// func numberOfArticles(_ feedID: String, _ database: FMDatabase) -> Int {
|
// func numberOfArticles(_ feedID: String, _ database: FMDatabase) -> Int {
|
||||||
@ -436,12 +379,6 @@ private extension Database {
|
|||||||
// return articlesSet
|
// return articlesSet
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// func feedIDsFromArticles(_ articles: Set<Article>) -> Set<String> {
|
|
||||||
//
|
|
||||||
// return Set(articles.map { $0.feedID })
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// func deletePossibleOldArticles(_ articles: Set<Article>) {
|
// func deletePossibleOldArticles(_ articles: Set<Article>) {
|
||||||
//
|
//
|
||||||
// let feedIDs = feedIDsFromArticles(articles)
|
// let feedIDs = feedIDsFromArticles(articles)
|
||||||
|
Loading…
Reference in New Issue
Block a user