Delete some commented-out code that has been superseded.

This commit is contained in:
Brent Simmons 2017-08-26 16:44:39 -07:00
parent 2d1c63403d
commit 3c43732e25
2 changed files with 2 additions and 100 deletions

View File

@ -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
//
// func numberOfArticlesWithFeedID(_ feedID: String, callback: @escaping FeedCountCallback) {
@ -221,23 +199,10 @@ private extension ArticlesTable {
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 {
// Main thread only unlike the other object caches.

View File

@ -46,37 +46,11 @@ public final class Database {
public func fetchArticles(for feed: Feed) -> Set<Article> {
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) {
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> {
@ -330,37 +304,6 @@ private extension Database {
// 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
//
// func numberOfArticles(_ feedID: String, _ database: FMDatabase) -> Int {
@ -436,12 +379,6 @@ private extension Database {
// return articlesSet
// }
//
//
// func feedIDsFromArticles(_ articles: Set<Article>) -> Set<String> {
//
// return Set(articles.map { $0.feedID })
// }
//
// func deletePossibleOldArticles(_ articles: Set<Article>) {
//
// let feedIDs = feedIDsFromArticles(articles)