Remove accountInfo references. This was speculative anyway. I’ll figure out later what we actually need. (Which might be accountInfo after all, and might not be.)
This commit is contained in:
parent
6bb1deaa9e
commit
0843c10bc5
@ -438,7 +438,7 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView
|
||||
private func calculateRowHeight() -> CGFloat {
|
||||
|
||||
let longTitle = "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?"
|
||||
let prototypeArticle = Article(accountID: "prototype", articleID: "prototype", feedID: "prototype", uniqueID: "prototype", title: longTitle, contentHTML: nil, contentText: nil, url: nil, externalURL: nil, summary: nil, imageURL: nil, bannerImageURL: nil, datePublished: nil, dateModified: nil, authors: nil, tags: nil, attachments: nil, accountInfo: nil)
|
||||
let prototypeArticle = Article(accountID: "prototype", articleID: "prototype", feedID: "prototype", uniqueID: "prototype", title: longTitle, contentHTML: nil, contentText: nil, url: nil, externalURL: nil, summary: nil, imageURL: nil, bannerImageURL: nil, datePublished: nil, dateModified: nil, authors: nil, tags: nil, attachments: nil)
|
||||
|
||||
let prototypeCellData = TimelineCellData(article: prototypeArticle, appearance: cellAppearance, showFeedName: false)
|
||||
let height = timelineCellHeight(100, cellData: prototypeCellData, appearance: cellAppearance)
|
||||
|
@ -1,36 +0,0 @@
|
||||
//
|
||||
// AccountInfo.swift
|
||||
// Database
|
||||
//
|
||||
// Created by Brent Simmons on 7/3/17.
|
||||
// Copyright © 2017 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
// This is used by an Account that needs to store extra info.
|
||||
// It’s stored as a binary plist in the database.
|
||||
|
||||
public struct AccountInfo: Equatable {
|
||||
|
||||
var plist: [String: AnyObject]?
|
||||
|
||||
init(plist: [String: AnyObject]) {
|
||||
|
||||
self.plist = plist
|
||||
}
|
||||
|
||||
public static func ==(lhs: AccountInfo, rhs: AccountInfo) -> Bool {
|
||||
|
||||
return true // TODO
|
||||
}
|
||||
}
|
||||
|
||||
//func accountInfoWithRow(_ row: FMResultSet) -> AccountInfo? {
|
||||
//
|
||||
// guard let rawAccountInfo = row.data(forColumn: DatabaseKey.accountInfo) else {
|
||||
// return nil
|
||||
// }
|
||||
// return propertyList(withData: rawAccountInfo) as? AccountInfo
|
||||
//}
|
||||
|
@ -27,11 +27,10 @@ public struct Article: Hashable {
|
||||
public let authors: Set<Author>?
|
||||
public let tags: Set<String>?
|
||||
public let attachments: Set<Attachment>?
|
||||
public let accountInfo: AccountInfo?
|
||||
public let status: ArticleStatus
|
||||
public let hashValue: Int
|
||||
|
||||
public init(accountID: String, articleID: String?, feedID: String, uniqueID: String, title: String?, contentHTML: String?, contentText: String?, url: String?, externalURL: String?, summary: String?, imageURL: String?, bannerImageURL: String?, datePublished: Date?, dateModified: Date?, authors: Set<Author>?, tags: Set<String>?, attachments: Set<Attachment>?, accountInfo: AccountInfo?, status: ArticleStatus) {
|
||||
public init(accountID: String, articleID: String?, feedID: String, uniqueID: String, title: String?, contentHTML: String?, contentText: String?, url: String?, externalURL: String?, summary: String?, imageURL: String?, bannerImageURL: String?, datePublished: Date?, dateModified: Date?, authors: Set<Author>?, tags: Set<String>?, attachments: Set<Attachment>?, status: ArticleStatus) {
|
||||
|
||||
self.accountID = accountID
|
||||
self.feedID = feedID
|
||||
@ -49,7 +48,6 @@ public struct Article: Hashable {
|
||||
self.authors = authors
|
||||
self.tags = tags
|
||||
self.attachments = attachments
|
||||
self.accountInfo = accountInfo
|
||||
self.status = status
|
||||
|
||||
if let articleID = articleID {
|
||||
|
@ -30,22 +30,20 @@ public final class ArticleStatus: Hashable {
|
||||
public var read = false
|
||||
public var starred = false
|
||||
public var userDeleted = false
|
||||
public var accountInfo: AccountInfo?
|
||||
|
||||
public init(articleID: String, read: Bool, starred: Bool, userDeleted: Bool, dateArrived: Date, accountInfo: AccountInfo?) {
|
||||
public init(articleID: String, read: Bool, starred: Bool, userDeleted: Bool, dateArrived: Date) {
|
||||
|
||||
self.articleID = articleID
|
||||
self.read = read
|
||||
self.starred = starred
|
||||
self.userDeleted = userDeleted
|
||||
self.dateArrived = dateArrived
|
||||
self.accountInfo = accountInfo
|
||||
self.hashValue = articleID.hashValue
|
||||
}
|
||||
|
||||
public convenience init(articleID: String, dateArrived: Date) {
|
||||
|
||||
self.init(articleID: articleID, read: false, starred: false, userDeleted: false, dateArrived: dateArrived, accountInfo: nil)
|
||||
self.init(articleID: articleID, read: false, starred: false, userDeleted: false, dateArrived: dateArrived)
|
||||
}
|
||||
|
||||
public func boolStatus(forKey key: String) -> Bool {
|
||||
@ -60,9 +58,6 @@ public final class ArticleStatus: Hashable {
|
||||
return userDeleted
|
||||
}
|
||||
}
|
||||
// else if let flag = accountInfo?[key] as? Bool {
|
||||
// return flag
|
||||
// }
|
||||
return false
|
||||
}
|
||||
|
||||
@ -78,16 +73,10 @@ public final class ArticleStatus: Hashable {
|
||||
userDeleted = status
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// if accountInfo == nil {
|
||||
// accountInfo = AccountInfo()
|
||||
// }
|
||||
// accountInfo![key] = status
|
||||
// }
|
||||
}
|
||||
|
||||
public static func ==(lhs: ArticleStatus, rhs: ArticleStatus) -> Bool {
|
||||
|
||||
return lhs.hashValue == rhs.hashValue && lhs.articleID == rhs.articleID && lhs.dateArrived == rhs.dateArrived && lhs.read == rhs.read && lhs.starred == rhs.starred && lhs.userDeleted == rhs.userDeleted && lhs.accountInfo == rhs.accountInfo
|
||||
return lhs.hashValue == rhs.hashValue && lhs.articleID == rhs.articleID && lhs.dateArrived == rhs.dateArrived && lhs.read == rhs.read && lhs.starred == rhs.starred && lhs.userDeleted == rhs.userDeleted
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,6 @@
|
||||
844BEE851F0AB4DB004AB7CD /* ArticleStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 844BEE841F0AB4DB004AB7CD /* ArticleStatus.swift */; };
|
||||
844BEE871F0AB4E3004AB7CD /* BatchUpdates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 844BEE861F0AB4E3004AB7CD /* BatchUpdates.swift */; };
|
||||
844BEE891F0AB4E7004AB7CD /* Notifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = 844BEE881F0AB4E7004AB7CD /* Notifications.swift */; };
|
||||
848935221F6249AC00CEBD24 /* AccountInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848935211F6249AC00CEBD24 /* AccountInfo.swift */; };
|
||||
84C490F41F705D5F003131D2 /* RSWeb.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84C490F51F705D5F003131D2 /* RSWeb.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
@ -74,7 +73,6 @@
|
||||
844BEE861F0AB4E3004AB7CD /* BatchUpdates.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BatchUpdates.swift; sourceTree = "<group>"; };
|
||||
844BEE881F0AB4E7004AB7CD /* Notifications.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Notifications.swift; sourceTree = "<group>"; };
|
||||
844BEE9C1F0AB512004AB7CD /* RSCore.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RSCore.xcodeproj; path = ../RSCore/RSCore.xcodeproj; sourceTree = "<group>"; };
|
||||
848935211F6249AC00CEBD24 /* AccountInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountInfo.swift; sourceTree = "<group>"; };
|
||||
84C490F51F705D5F003131D2 /* RSWeb.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = RSWeb.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
@ -107,7 +105,6 @@
|
||||
844BEE801F0AB4D0004AB7CD /* Author.swift */,
|
||||
844BEE821F0AB4D6004AB7CD /* Attachment.swift */,
|
||||
844BEE841F0AB4DB004AB7CD /* ArticleStatus.swift */,
|
||||
848935211F6249AC00CEBD24 /* AccountInfo.swift */,
|
||||
840405C91F1A8E4300DF0296 /* DatabaseID.swift */,
|
||||
844BEE861F0AB4E3004AB7CD /* BatchUpdates.swift */,
|
||||
844BEE881F0AB4E7004AB7CD /* Notifications.swift */,
|
||||
@ -304,7 +301,6 @@
|
||||
844BEE7D1F0AB4C4004AB7CD /* Feed.swift in Sources */,
|
||||
841974231F6DD804006346C4 /* OPMLRepresentable.swift in Sources */,
|
||||
844BEE891F0AB4E7004AB7CD /* Notifications.swift in Sources */,
|
||||
848935221F6249AC00CEBD24 /* AccountInfo.swift in Sources */,
|
||||
844BEE831F0AB4D6004AB7CD /* Attachment.swift in Sources */,
|
||||
8419741C1F6DD613006346C4 /* UnreadCountProvider.swift in Sources */,
|
||||
841974201F6DD672006346C4 /* DisplayNameProvider.swift in Sources */,
|
||||
|
@ -18,7 +18,6 @@ public final class Feed: DisplayNameProvider, UnreadCountProvider, Hashable {
|
||||
public var homePageURL: String?
|
||||
public var name: String?
|
||||
public var editedName: String?
|
||||
public var accountInfo: AccountInfo? //If account needs to store more data
|
||||
public var conditionalGetInfo: HTTPConditionalGetInfo?
|
||||
public var contentHash: String?
|
||||
public let hashValue: Int
|
||||
|
@ -232,7 +232,7 @@ private extension ArticlesTable {
|
||||
let datePublished = row.date(forColumn: DatabaseKey.datePublished)
|
||||
let dateModified = row.date(forColumn: DatabaseKey.dateModified)
|
||||
|
||||
return DatabaseArticle(articleID: articleID, feedID: feedID, uniqueID: uniqueID, title: title, contentHTML: contentHTML, contentText: contentText, url: url, externalURL: externalURL, summary: summary, imageURL: imageURL, bannerImageURL: bannerImageURL, datePublished: datePublished, dateModified: dateModified, accountInfo: nil, status: status)
|
||||
return DatabaseArticle(articleID: articleID, feedID: feedID, uniqueID: uniqueID, title: title, contentHTML: contentHTML, contentText: contentText, url: url, externalURL: externalURL, summary: summary, imageURL: imageURL, bannerImageURL: bannerImageURL, datePublished: datePublished, dateModified: dateModified, status: status)
|
||||
}
|
||||
|
||||
return articles
|
||||
|
@ -25,7 +25,6 @@ struct DatabaseKey {
|
||||
|
||||
// Shared
|
||||
static let articleID = "articleID"
|
||||
static let accountInfo = "accountInfo"
|
||||
static let url = "url"
|
||||
static let title = "title"
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
CREATE TABLE if not EXISTS articles (articleID TEXT NOT NULL PRIMARY KEY, feedID TEXT NOT NULL, uniqueID TEXT NOT NULL, title TEXT, contentHTML TEXT, contentText TEXT, url TEXT, externalURL TEXT, summary TEXT, imageURL TEXT, bannerImageURL TEXT, datePublished DATE, dateModified DATE, accountInfo BLOB);
|
||||
CREATE TABLE if not EXISTS articles (articleID TEXT NOT NULL PRIMARY KEY, feedID TEXT NOT NULL, uniqueID TEXT NOT NULL, title TEXT, contentHTML TEXT, contentText TEXT, url TEXT, externalURL TEXT, summary TEXT, imageURL TEXT, bannerImageURL TEXT, datePublished DATE, dateModified DATE);
|
||||
|
||||
CREATE TABLE if not EXISTS statuses (articleID TEXT NOT NULL PRIMARY KEY, read BOOL NOT NULL DEFAULT 0, starred BOOL NOT NULL DEFAULT 0, userDeleted BOOL NOT NULL DEFAULT 0, dateArrived DATE NOT NULL DEFAULT 0, accountInfo BLOB);
|
||||
CREATE TABLE if not EXISTS statuses (articleID TEXT NOT NULL PRIMARY KEY, read BOOL NOT NULL DEFAULT 0, starred BOOL NOT NULL DEFAULT 0, userDeleted BOOL NOT NULL DEFAULT 0, dateArrived DATE NOT NULL DEFAULT 0);
|
||||
|
||||
CREATE TABLE if not EXISTS authors (authorID TEXT NOT NULL PRIMARY KEY, name TEXT, url TEXT, avatarURL TEXT, emailAddress TEXT);
|
||||
CREATE TABLE if not EXISTS authorsLookup (authorID TEXT NOT NULL, articleID TEXT NOT NULL, PRIMARY KEY(authorID, articleID));
|
||||
|
@ -27,11 +27,10 @@ struct DatabaseArticle: Hashable {
|
||||
let bannerImageURL: String?
|
||||
let datePublished: Date?
|
||||
let dateModified: Date?
|
||||
let accountInfo: AccountInfo?
|
||||
let status: ArticleStatus
|
||||
let hashValue: Int
|
||||
|
||||
init(articleID: String, feedID: String, uniqueID: String, title: String?, contentHTML: String?, contentText: String?, url: String?, externalURL: String?, summary: String?, imageURL: String?, bannerImageURL: String?, datePublished: Date?, dateModified: Date?, accountInfo: AccountInfo?, status: ArticleStatus) {
|
||||
init(articleID: String, feedID: String, uniqueID: String, title: String?, contentHTML: String?, contentText: String?, url: String?, externalURL: String?, summary: String?, imageURL: String?, bannerImageURL: String?, datePublished: Date?, dateModified: Date?, status: ArticleStatus) {
|
||||
|
||||
self.articleID = articleID
|
||||
self.feedID = feedID
|
||||
@ -46,7 +45,6 @@ struct DatabaseArticle: Hashable {
|
||||
self.bannerImageURL = bannerImageURL
|
||||
self.datePublished = datePublished
|
||||
self.dateModified = dateModified
|
||||
self.accountInfo = accountInfo
|
||||
self.status = status
|
||||
self.hashValue = articleID.hashValue
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ extension Article {
|
||||
|
||||
init(databaseArticle: DatabaseArticle, accountID: String, authors: Set<Author>?, attachments: Set<Attachment>?, tags: Set<String>?) {
|
||||
|
||||
self.init(accountID: accountID, articleID: databaseArticle.articleID, feedID: databaseArticle.feedID, uniqueID: databaseArticle.uniqueID, title: databaseArticle.title, contentHTML: databaseArticle.contentHTML, contentText: databaseArticle.contentText, url: databaseArticle.url, externalURL: databaseArticle.externalURL, summary: databaseArticle.summary, imageURL: databaseArticle.imageURL, bannerImageURL: databaseArticle.bannerImageURL, datePublished: databaseArticle.datePublished, dateModified: databaseArticle.dateModified, authors: authors, tags: tags, attachments: attachments, accountInfo: databaseArticle.accountInfo, status: databaseArticle.status)
|
||||
self.init(accountID: accountID, articleID: databaseArticle.articleID, feedID: databaseArticle.feedID, uniqueID: databaseArticle.uniqueID, title: databaseArticle.title, contentHTML: databaseArticle.contentHTML, contentText: databaseArticle.contentText, url: databaseArticle.url, externalURL: databaseArticle.externalURL, summary: databaseArticle.summary, imageURL: databaseArticle.imageURL, bannerImageURL: databaseArticle.bannerImageURL, datePublished: databaseArticle.datePublished, dateModified: databaseArticle.dateModified, authors: authors, tags: tags, attachments: attachments, status: databaseArticle.status)
|
||||
}
|
||||
|
||||
init(parsedItem: ParsedItem, accountID: String, feedID: String, status: ArticleStatus) {
|
||||
@ -23,7 +23,7 @@ extension Article {
|
||||
let authors = Author.authorsWithParsedAuthors(parsedItem.authors)
|
||||
let attachments = Attachment.attachmentsWithParsedAttachments(parsedItem.attachments)
|
||||
|
||||
self.init(accountID: accountID, articleID: parsedItem.syncServiceID, feedID: feedID, uniqueID: parsedItem.uniqueID, title: parsedItem.title, contentHTML: parsedItem.contentHTML, contentText: parsedItem.contentText, url: parsedItem.url, externalURL: parsedItem.externalURL, summary: parsedItem.summary, imageURL: parsedItem.imageURL, bannerImageURL: parsedItem.bannerImageURL, datePublished: parsedItem.datePublished, dateModified: parsedItem.dateModified, authors: authors, tags: parsedItem.tags, attachments: attachments, accountInfo: nil, status: status)
|
||||
self.init(accountID: accountID, articleID: parsedItem.syncServiceID, feedID: feedID, uniqueID: parsedItem.uniqueID, title: parsedItem.title, contentHTML: parsedItem.contentHTML, contentText: parsedItem.contentText, url: parsedItem.url, externalURL: parsedItem.externalURL, summary: parsedItem.summary, imageURL: parsedItem.imageURL, bannerImageURL: parsedItem.bannerImageURL, datePublished: parsedItem.datePublished, dateModified: parsedItem.dateModified, authors: authors, tags: parsedItem.tags, attachments: attachments, status: status)
|
||||
}
|
||||
|
||||
private func addPossibleStringChangeWithKeyPath(_ comparisonKeyPath: KeyPath<Article,String?>, _ otherArticle: Article, _ key: String, _ dictionary: NSMutableDictionary) {
|
||||
@ -70,8 +70,6 @@ extension Article {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: accountInfo
|
||||
|
||||
if d.count < 1 {
|
||||
return nil
|
||||
}
|
||||
@ -108,8 +106,6 @@ extension Article: DatabaseObject {
|
||||
d.addOptionalDate(datePublished, DatabaseKey.datePublished)
|
||||
d.addOptionalDate(dateModified, DatabaseKey.dateModified)
|
||||
|
||||
// TODO: accountInfo
|
||||
|
||||
return (d.copy() as! NSDictionary)
|
||||
}
|
||||
|
||||
|
@ -18,9 +18,7 @@ extension ArticleStatus {
|
||||
let starred = row.bool(forColumn: DatabaseKey.starred)
|
||||
let userDeleted = row.bool(forColumn: DatabaseKey.userDeleted)
|
||||
|
||||
// let accountInfoPlist = accountInfoWithRow(row)
|
||||
|
||||
self.init(articleID: articleID, read: read, starred: starred, userDeleted: userDeleted, dateArrived: dateArrived, accountInfo: nil)
|
||||
self.init(articleID: articleID, read: read, starred: starred, userDeleted: userDeleted, dateArrived: dateArrived)
|
||||
}
|
||||
|
||||
}
|
||||
@ -43,10 +41,6 @@ extension ArticleStatus: DatabaseObject {
|
||||
d[DatabaseKey.userDeleted] = userDeleted
|
||||
d[DatabaseKey.dateArrived] = dateArrived
|
||||
|
||||
// if let accountInfo = accountInfo, let data = PropertyListTransformer.data(withPropertyList: accountInfo) {
|
||||
// d[DatabaseKey.accountInfo] = data
|
||||
// }
|
||||
|
||||
return (d.copy() as! NSDictionary)
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import Data
|
||||
|
||||
// Article->ArticleStatus is a to-one relationship.
|
||||
//
|
||||
// CREATE TABLE if not EXISTS statuses (articleID TEXT NOT NULL PRIMARY KEY, read BOOL NOT NULL DEFAULT 0, starred BOOL NOT NULL DEFAULT 0, userDeleted BOOL NOT NULL DEFAULT 0, dateArrived DATE NOT NULL DEFAULT 0, accountInfo BLOB);
|
||||
// CREATE TABLE if not EXISTS statuses (articleID TEXT NOT NULL PRIMARY KEY, read BOOL NOT NULL DEFAULT 0, starred BOOL NOT NULL DEFAULT 0, userDeleted BOOL NOT NULL DEFAULT 0, dateArrived DATE NOT NULL DEFAULT 0);
|
||||
|
||||
final class StatusesTable: DatabaseTable {
|
||||
|
||||
|
14
ToDo.opml
14
ToDo.opml
@ -6,12 +6,12 @@
|
||||
</editor> -->
|
||||
<title>ToDo</title>
|
||||
<dateCreated>Tue, 12 Sep 2017 20:15:17 GMT</dateCreated>
|
||||
<expansionState>23,26,30,35,43,45,54,63</expansionState>
|
||||
<expansionState>23,26,30,35,43,45,51,60</expansionState>
|
||||
<vertScrollState>0</vertScrollState>
|
||||
<windowTop>542</windowTop>
|
||||
<windowLeft>42</windowLeft>
|
||||
<windowRight>774</windowRight>
|
||||
<windowBottom>1301</windowBottom>
|
||||
<windowTop>208</windowTop>
|
||||
<windowLeft>30</windowLeft>
|
||||
<windowRight>762</windowRight>
|
||||
<windowBottom>967</windowBottom>
|
||||
</head>
|
||||
<body>
|
||||
<outline text="App">
|
||||
@ -72,10 +72,6 @@
|
||||
<outline text="Account"/>
|
||||
<outline text="Database">
|
||||
<outline text="Update cutoff date periodically"/>
|
||||
<outline text="AccountInfo">
|
||||
<outline text="Serialize/deserialize"/>
|
||||
<outline text="Handle in articles and statuses"/>
|
||||
</outline>
|
||||
<outline text="Cleanup">
|
||||
<outline text="Delete old articles, statuses, authors, and attachments"/>
|
||||
</outline>
|
||||
|
Loading…
x
Reference in New Issue
Block a user