mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-28 00:04:25 +00:00
Clean whitespace-only lines.
This commit is contained in:
1 parent
9827300a9a
commit
9efde554d4
452 files changed
+5354
-5354
No files matched your search
@@ -9,13 +9,13 @@
|
||||
import Foundation
|
||||
|
||||
struct DatabaseTableName {
|
||||
|
||||
|
||||
static let syncStatus = "syncStatus"
|
||||
|
||||
|
||||
}
|
||||
|
||||
struct DatabaseKey {
|
||||
|
||||
|
||||
// Sync Status
|
||||
static let articleID = "articleID"
|
||||
static let key = "key"
|
||||
|
||||
@@ -35,7 +35,7 @@ public struct SyncDatabase {
|
||||
public func insertStatuses(_ statuses: [SyncStatus], completion: @escaping DatabaseCompletionBlock) {
|
||||
syncStatusTable.insertStatuses(statuses, completion: completion)
|
||||
}
|
||||
|
||||
|
||||
public func selectForProcessing(limit: Int? = nil, completion: @escaping SyncStatusesCompletionBlock) {
|
||||
return syncStatusTable.selectForProcessing(limit: limit, completion: completion)
|
||||
}
|
||||
@@ -47,11 +47,11 @@ public struct SyncDatabase {
|
||||
public func selectPendingReadStatusArticleIDs(completion: @escaping SyncStatusArticleIDsCompletionBlock) {
|
||||
syncStatusTable.selectPendingReadStatusArticleIDs(completion: completion)
|
||||
}
|
||||
|
||||
|
||||
public func selectPendingStarredStatusArticleIDs(completion: @escaping SyncStatusArticleIDsCompletionBlock) {
|
||||
syncStatusTable.selectPendingStarredStatusArticleIDs(completion: completion)
|
||||
}
|
||||
|
||||
|
||||
public func resetAllSelectedForProcessing(completion: DatabaseCompletionBlock? = nil) {
|
||||
syncStatusTable.resetAllSelectedForProcessing(completion: completion)
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public struct SyncDatabase {
|
||||
public func resetSelectedForProcessing(_ articleIDs: [String], completion: DatabaseCompletionBlock? = nil) {
|
||||
syncStatusTable.resetSelectedForProcessing(articleIDs, completion: completion)
|
||||
}
|
||||
|
||||
|
||||
public func deleteSelectedForProcessing(_ articleIDs: [String], completion: DatabaseCompletionBlock? = nil) {
|
||||
syncStatusTable.deleteSelectedForProcessing(articleIDs, completion: completion)
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public struct SyncDatabase {
|
||||
// MARK: - Private
|
||||
|
||||
private extension SyncDatabase {
|
||||
|
||||
|
||||
static let tableCreationStatements = """
|
||||
CREATE TABLE if not EXISTS syncStatus (articleID TEXT NOT NULL, key TEXT NOT NULL, flag BOOL NOT NULL DEFAULT 0, selected BOOL NOT NULL DEFAULT 0, PRIMARY KEY (articleID, key));
|
||||
"""
|
||||
|
||||
@@ -11,13 +11,13 @@ import Articles
|
||||
import RSDatabase
|
||||
|
||||
public struct SyncStatus: Hashable, Equatable {
|
||||
|
||||
|
||||
public enum Key: String {
|
||||
case read = "read"
|
||||
case starred = "starred"
|
||||
case deleted = "deleted"
|
||||
case new = "new"
|
||||
|
||||
|
||||
public init(_ articleStatusKey: ArticleStatus.Key) {
|
||||
switch articleStatusKey {
|
||||
case .read:
|
||||
@@ -26,23 +26,23 @@ public struct SyncStatus: Hashable, Equatable {
|
||||
self = Self.starred
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public let articleID: String
|
||||
public let key: SyncStatus.Key
|
||||
public let flag: Bool
|
||||
public let selected: Bool
|
||||
|
||||
|
||||
public init(articleID: String, key: SyncStatus.Key, flag: Bool, selected: Bool = false) {
|
||||
self.articleID = articleID
|
||||
self.key = key
|
||||
self.flag = flag
|
||||
self.selected = selected
|
||||
}
|
||||
|
||||
|
||||
public func databaseDictionary() -> DatabaseDictionary {
|
||||
return [DatabaseKey.articleID: articleID, DatabaseKey.key: key.rawValue, DatabaseKey.flag: flag, DatabaseKey.selected: selected]
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -56,7 +56,7 @@ struct SyncStatusTable: DatabaseTable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func selectPendingCount(_ completion: @escaping DatabaseIntCompletionBlock) {
|
||||
queue.runInDatabase { databaseResult in
|
||||
var count: Int = 0
|
||||
@@ -90,11 +90,11 @@ struct SyncStatusTable: DatabaseTable {
|
||||
func selectPendingReadStatusArticleIDs(completion: @escaping SyncStatusArticleIDsCompletionBlock) {
|
||||
selectPendingArticleIDsAsync(.read, completion)
|
||||
}
|
||||
|
||||
|
||||
func selectPendingStarredStatusArticleIDs(completion: @escaping SyncStatusArticleIDsCompletionBlock) {
|
||||
selectPendingArticleIDsAsync(.starred, completion)
|
||||
}
|
||||
|
||||
|
||||
func resetAllSelectedForProcessing(completion: DatabaseCompletionBlock? = nil) {
|
||||
queue.runInTransaction { databaseResult in
|
||||
|
||||
@@ -118,7 +118,7 @@ struct SyncStatusTable: DatabaseTable {
|
||||
callCompletion(completion, nil)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
queue.runInTransaction { databaseResult in
|
||||
|
||||
func makeDatabaseCall(_ database: FMDatabase) {
|
||||
@@ -137,13 +137,13 @@ struct SyncStatusTable: DatabaseTable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func deleteSelectedForProcessing(_ articleIDs: [String], completion: DatabaseCompletionBlock? = nil) {
|
||||
guard !articleIDs.isEmpty else {
|
||||
callCompletion(completion, nil)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
queue.runInTransaction { databaseResult in
|
||||
|
||||
func makeDatabaseCall(_ database: FMDatabase) {
|
||||
@@ -162,7 +162,7 @@ struct SyncStatusTable: DatabaseTable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func insertStatuses(_ statuses: [SyncStatus], completion: @escaping DatabaseCompletionBlock) {
|
||||
queue.runInTransaction { databaseResult in
|
||||
|
||||
@@ -180,7 +180,7 @@ struct SyncStatusTable: DatabaseTable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private extension SyncStatusTable {
|
||||
@@ -191,13 +191,13 @@ private extension SyncStatusTable {
|
||||
let key = SyncStatus.Key(rawValue: rawKey) else {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
let flag = row.bool(forColumn: DatabaseKey.flag)
|
||||
let selected = row.bool(forColumn: DatabaseKey.selected)
|
||||
|
||||
|
||||
return SyncStatus(articleID: articleID, key: key, flag: flag, selected: selected)
|
||||
}
|
||||
|
||||
|
||||
func selectPendingArticleIDsAsync(_ statusKey: ArticleStatus.Key, _ completion: @escaping SyncStatusArticleIDsCompletionBlock) {
|
||||
|
||||
queue.runInDatabase { databaseResult in
|
||||
@@ -228,7 +228,7 @@ private extension SyncStatusTable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private func callCompletion(_ completion: DatabaseCompletionBlock?, _ databaseError: DatabaseError?) {
|
||||
|
||||
Reference in new issue
Block a user