mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-28 18:40:26 +01:00
61 lines
1.4 KiB
Swift
61 lines
1.4 KiB
Swift
//
|
|
// ArticleStatus+Database.swift
|
|
// Database
|
|
//
|
|
// Created by Brent Simmons on 7/3/17.
|
|
// Copyright © 2017 Ranchero Software. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import RSDatabase
|
|
import Data
|
|
|
|
extension ArticleStatus {
|
|
|
|
init(articleID: String, dateArrived: Date, row: FMResultSet) {
|
|
|
|
let read = row.bool(forColumn: DatabaseKey.read)
|
|
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)
|
|
}
|
|
|
|
}
|
|
|
|
extension ArticleStatus: DatabaseObject {
|
|
|
|
public var databaseID: String {
|
|
get {
|
|
return articleID
|
|
}
|
|
}
|
|
|
|
public func databaseDictionary() -> NSDictionary? {
|
|
|
|
let d = NSMutableDictionary()
|
|
|
|
d[DatabaseKey.articleID] = articleID
|
|
d[DatabaseKey.read] = read
|
|
d[DatabaseKey.starred] = starred
|
|
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)
|
|
}
|
|
}
|
|
|
|
extension Set where Element == ArticleStatus {
|
|
|
|
func articleIDs() -> Set<String> {
|
|
|
|
return Set<String>(map { $0.articleID })
|
|
}
|
|
}
|