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:
Brent Simmons
2017-09-22 08:06:06 -07:00
parent 6bb1deaa9e
commit 0843c10bc5
14 changed files with 18 additions and 89 deletions

View File

@@ -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.
// Its 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
//}

View File

@@ -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 {

View File

@@ -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
}
}

View File

@@ -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 */,

View File

@@ -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