mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-02-02 12:06:58 +01:00
Make code formatting match current style.
This commit is contained in:
parent
5d3cd8889f
commit
cc458ecab7
@ -1,6 +1,6 @@
|
||||
//
|
||||
// Keys.swift
|
||||
// Database
|
||||
// NetNewsWire
|
||||
//
|
||||
// Created by Brent Simmons on 7/3/17.
|
||||
// Copyright © 2017 Ranchero Software. All rights reserved.
|
||||
|
@ -1,6 +1,6 @@
|
||||
//
|
||||
// DatabaseArticle.swift
|
||||
// Database
|
||||
// NetNewsWire
|
||||
//
|
||||
// Created by Brent Simmons on 9/21/17.
|
||||
// Copyright © 2017 Ranchero Software. All rights reserved.
|
||||
|
@ -1,6 +1,6 @@
|
||||
//
|
||||
// Article+Database.swift
|
||||
// Database
|
||||
// NetNewsWire
|
||||
//
|
||||
// Created by Brent Simmons on 7/3/17.
|
||||
// Copyright © 2017 Ranchero Software. All rights reserved.
|
||||
@ -14,12 +14,10 @@ import RSParser
|
||||
extension Article {
|
||||
|
||||
init(databaseArticle: DatabaseArticle, accountID: String, authors: Set<Author>?, attachments: Set<Attachment>?) {
|
||||
|
||||
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, attachments: attachments, status: databaseArticle.status)
|
||||
}
|
||||
|
||||
init(parsedItem: ParsedItem, maximumDateAllowed: Date, accountID: String, feedID: String, status: ArticleStatus) {
|
||||
|
||||
let authors = Author.authorsWithParsedAuthors(parsedItem.authors)
|
||||
let attachments = Attachment.attachmentsWithParsedAttachments(parsedItem.attachments)
|
||||
|
||||
@ -135,7 +133,6 @@ extension Article: DatabaseObject {
|
||||
}
|
||||
|
||||
public func relatedObjectsWithName(_ name: String) -> [DatabaseObject]? {
|
||||
|
||||
switch name {
|
||||
case RelationshipName.authors:
|
||||
return databaseObjectArray(with: authors)
|
||||
@ -147,7 +144,6 @@ extension Article: DatabaseObject {
|
||||
}
|
||||
|
||||
private func databaseObjectArray<T: DatabaseObject>(with objects: Set<T>?) -> [DatabaseObject]? {
|
||||
|
||||
guard let objects = objects else {
|
||||
return nil
|
||||
}
|
||||
@ -158,12 +154,10 @@ extension Article: DatabaseObject {
|
||||
extension Set where Element == Article {
|
||||
|
||||
func statuses() -> Set<ArticleStatus> {
|
||||
|
||||
return Set<ArticleStatus>(map { $0.status })
|
||||
}
|
||||
|
||||
func dictionary() -> [String: Article] {
|
||||
|
||||
var d = [String: Article]()
|
||||
for article in self {
|
||||
d[article.articleID] = article
|
||||
@ -172,12 +166,10 @@ extension Set where Element == Article {
|
||||
}
|
||||
|
||||
func databaseObjects() -> [DatabaseObject] {
|
||||
|
||||
return self.map{ $0 as DatabaseObject }
|
||||
}
|
||||
|
||||
func databaseDictionaries() -> [DatabaseDictionary]? {
|
||||
|
||||
return self.compactMap { $0.databaseDictionary() }
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
//
|
||||
// ArticleStatus+Database.swift
|
||||
// Database
|
||||
// NetNewsWire
|
||||
//
|
||||
// Created by Brent Simmons on 7/3/17.
|
||||
// Copyright © 2017 Ranchero Software. All rights reserved.
|
||||
@ -13,7 +13,6 @@ import Articles
|
||||
extension ArticleStatus {
|
||||
|
||||
convenience 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)
|
||||
|
@ -1,6 +1,6 @@
|
||||
//
|
||||
// Author+Database.swift
|
||||
// Database
|
||||
// NetNewsWire
|
||||
//
|
||||
// Created by Brent Simmons on 7/8/17.
|
||||
// Copyright © 2017 Ranchero Software. All rights reserved.
|
||||
@ -16,7 +16,6 @@ import RSParser
|
||||
extension Author {
|
||||
|
||||
init?(row: FMResultSet) {
|
||||
|
||||
let authorID = row.string(forColumn: DatabaseKey.authorID)
|
||||
let name = row.string(forColumn: DatabaseKey.name)
|
||||
let url = row.string(forColumn: DatabaseKey.url)
|
||||
@ -27,12 +26,10 @@ extension Author {
|
||||
}
|
||||
|
||||
init?(parsedAuthor: ParsedAuthor) {
|
||||
|
||||
self.init(authorID: nil, name: parsedAuthor.name, url: parsedAuthor.url, avatarURL: parsedAuthor.avatarURL, emailAddress: parsedAuthor.emailAddress)
|
||||
}
|
||||
|
||||
public static func authorsWithParsedAuthors(_ parsedAuthors: Set<ParsedAuthor>?) -> Set<Author>? {
|
||||
|
||||
guard let parsedAuthors = parsedAuthors else {
|
||||
return nil
|
||||
}
|
||||
@ -49,7 +46,6 @@ extension Author: DatabaseObject {
|
||||
}
|
||||
|
||||
public func databaseDictionary() -> DatabaseDictionary? {
|
||||
|
||||
var d: DatabaseDictionary = [DatabaseKey.authorID: authorID]
|
||||
if let name = name {
|
||||
d[DatabaseKey.name] = name
|
||||
|
@ -1,6 +1,6 @@
|
||||
//
|
||||
// ParsedArticle+Database.swift
|
||||
// Database
|
||||
// NetNewsWire
|
||||
//
|
||||
// Created by Brent Simmons on 9/18/17.
|
||||
// Copyright © 2017 Ranchero Software. All rights reserved.
|
||||
|
@ -1,6 +1,6 @@
|
||||
//
|
||||
// SearchTable.swift
|
||||
// ArticlesDatabase
|
||||
// NetNewsWire
|
||||
//
|
||||
// Created by Brent Simmons on 2/23/19.
|
||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
||||
|
Loading…
x
Reference in New Issue
Block a user