Save article statuses to new sync database as they are created

This commit is contained in:
Maurice Parker
2019-05-14 18:24:19 -05:00
parent f449ed9608
commit b1303661b2
15 changed files with 723 additions and 2 deletions

View File

@@ -0,0 +1,25 @@
//
// Constants.swift
// SyncDatabase
//
// Created by Maurice Parker on 5/14/19.
// Copyright © 2019 Ranchero Software. All rights reserved.
//
import Foundation
struct DatabaseTableName {
static let syncStatus = "syncStatus"
}
struct DatabaseKey {
// Sync Status
static let articleID = "articleID"
static let key = "key"
static let flag = "flag"
static let selected = "selected"
}

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2019 Ranchero Software. All rights reserved.</string>
</dict>
</plist>

View File

@@ -0,0 +1,39 @@
//
// SyncDatabase.swift
// NetNewsWire
//
// Created by Maurice Parker on 5/14/19.
// Copyright © 2019 Ranchero Software. All rights reserved.
//
import Foundation
import RSDatabase
public final class SyncDatabase {
private let syncStatusTable: SyncStatusTable
public init(databaseFilePath: String) {
let queue = RSDatabaseQueue(filepath: databaseFilePath, excludeFromBackup: false)
self.syncStatusTable = SyncStatusTable(queue: queue)
queue.createTables(usingStatements: SyncDatabase.tableCreationStatements)
queue.vacuumIfNeeded()
}
public func insertStatuses(_ statuses: [SyncStatus]) {
syncStatusTable.insertStatuses(statuses)
}
}
// 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));
"""
}

View File

@@ -0,0 +1,386 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
51554C15228B6F0D0055115A /* SyncStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51554C12228B6F0D0055115A /* SyncStatus.swift */; };
51554C16228B6F0D0055115A /* SyncStatusTable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51554C13228B6F0D0055115A /* SyncStatusTable.swift */; };
51554C17228B6F0D0055115A /* SyncDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51554C14228B6F0D0055115A /* SyncDatabase.swift */; };
51554C1E228B701F0055115A /* SyncDatabase_project.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 51554C19228B701F0055115A /* SyncDatabase_project.xcconfig */; };
51554C1F228B701F0055115A /* SyncDatabase_project_debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 51554C1A228B701F0055115A /* SyncDatabase_project_debug.xcconfig */; };
51554C21228B701F0055115A /* SyncDatabase_project_release.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 51554C1C228B701F0055115A /* SyncDatabase_project_release.xcconfig */; };
51554C22228B701F0055115A /* SyncDatabase_target.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 51554C1D228B701F0055115A /* SyncDatabase_target.xcconfig */; };
51554C36228B72F40055115A /* RSDatabase.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 51554C35228B72F40055115A /* RSDatabase.framework */; };
51554C38228B7DAC0055115A /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51554C37228B7DAC0055115A /* Constants.swift */; };
51554C3A228B83380055115A /* Articles.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 51554C39228B83380055115A /* Articles.framework */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
51554BEB228B6E8F0055115A /* SyncDatabase.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SyncDatabase.framework; sourceTree = BUILT_PRODUCTS_DIR; };
51554BEF228B6E8F0055115A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
51554C12228B6F0D0055115A /* SyncStatus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SyncStatus.swift; sourceTree = "<group>"; };
51554C13228B6F0D0055115A /* SyncStatusTable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SyncStatusTable.swift; sourceTree = "<group>"; };
51554C14228B6F0D0055115A /* SyncDatabase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SyncDatabase.swift; sourceTree = "<group>"; };
51554C19228B701F0055115A /* SyncDatabase_project.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = SyncDatabase_project.xcconfig; sourceTree = "<group>"; };
51554C1A228B701F0055115A /* SyncDatabase_project_debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = SyncDatabase_project_debug.xcconfig; sourceTree = "<group>"; };
51554C1C228B701F0055115A /* SyncDatabase_project_release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = SyncDatabase_project_release.xcconfig; sourceTree = "<group>"; };
51554C1D228B701F0055115A /* SyncDatabase_target.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = SyncDatabase_target.xcconfig; sourceTree = "<group>"; };
51554C35228B72F40055115A /* RSDatabase.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = RSDatabase.framework; sourceTree = BUILT_PRODUCTS_DIR; };
51554C37228B7DAC0055115A /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
51554C39228B83380055115A /* Articles.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Articles.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
51554BE8228B6E8F0055115A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
51554C3A228B83380055115A /* Articles.framework in Frameworks */,
51554C36228B72F40055115A /* RSDatabase.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
51554BE1228B6E8F0055115A = {
isa = PBXGroup;
children = (
51554C37228B7DAC0055115A /* Constants.swift */,
51554C14228B6F0D0055115A /* SyncDatabase.swift */,
51554C12228B6F0D0055115A /* SyncStatus.swift */,
51554C13228B6F0D0055115A /* SyncStatusTable.swift */,
51554BEF228B6E8F0055115A /* Info.plist */,
51554BEC228B6E8F0055115A /* Products */,
51554C18228B6FBE0055115A /* xcconfig */,
51554C34228B72F40055115A /* Frameworks */,
);
sourceTree = "<group>";
};
51554BEC228B6E8F0055115A /* Products */ = {
isa = PBXGroup;
children = (
51554BEB228B6E8F0055115A /* SyncDatabase.framework */,
);
name = Products;
sourceTree = "<group>";
};
51554C18228B6FBE0055115A /* xcconfig */ = {
isa = PBXGroup;
children = (
51554C1A228B701F0055115A /* SyncDatabase_project_debug.xcconfig */,
51554C1C228B701F0055115A /* SyncDatabase_project_release.xcconfig */,
51554C19228B701F0055115A /* SyncDatabase_project.xcconfig */,
51554C1D228B701F0055115A /* SyncDatabase_target.xcconfig */,
);
path = xcconfig;
sourceTree = "<group>";
};
51554C34228B72F40055115A /* Frameworks */ = {
isa = PBXGroup;
children = (
51554C39228B83380055115A /* Articles.framework */,
51554C35228B72F40055115A /* RSDatabase.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
51554BE6228B6E8F0055115A /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
51554BEA228B6E8F0055115A /* SyncDatabase */ = {
isa = PBXNativeTarget;
buildConfigurationList = 51554BF3228B6E8F0055115A /* Build configuration list for PBXNativeTarget "SyncDatabase" */;
buildPhases = (
51554BE6228B6E8F0055115A /* Headers */,
51554BE7228B6E8F0055115A /* Sources */,
51554BE8228B6E8F0055115A /* Frameworks */,
51554BE9228B6E8F0055115A /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = SyncDatabase;
productName = SyncDatabase;
productReference = 51554BEB228B6E8F0055115A /* SyncDatabase.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
51554BE2228B6E8F0055115A /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Ranchero Software";
TargetAttributes = {
51554BEA228B6E8F0055115A = {
CreatedOnToolsVersion = 10.2.1;
};
};
};
buildConfigurationList = 51554BE5228B6E8F0055115A /* Build configuration list for PBXProject "SyncDatabase" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 51554BE1228B6E8F0055115A;
productRefGroup = 51554BEC228B6E8F0055115A /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
51554BEA228B6E8F0055115A /* SyncDatabase */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
51554BE9228B6E8F0055115A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
51554C21228B701F0055115A /* SyncDatabase_project_release.xcconfig in Resources */,
51554C22228B701F0055115A /* SyncDatabase_target.xcconfig in Resources */,
51554C1F228B701F0055115A /* SyncDatabase_project_debug.xcconfig in Resources */,
51554C1E228B701F0055115A /* SyncDatabase_project.xcconfig in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
51554BE7228B6E8F0055115A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
51554C15228B6F0D0055115A /* SyncStatus.swift in Sources */,
51554C16228B6F0D0055115A /* SyncStatusTable.swift in Sources */,
51554C17228B6F0D0055115A /* SyncDatabase.swift in Sources */,
51554C38228B7DAC0055115A /* Constants.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
51554BF1228B6E8F0055115A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 51554C1A228B701F0055115A /* SyncDatabase_project_debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Mac Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SUPPORTED_PLATFORMS = "macosx iphonesimulator iphoneos";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
51554BF2228B6E8F0055115A /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 51554C1C228B701F0055115A /* SyncDatabase_project_release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Mac Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
SUPPORTED_PLATFORMS = "macosx iphonesimulator iphoneos";
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
51554BF4228B6E8F0055115A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 51554C1D228B701F0055115A /* SyncDatabase_target.xcconfig */;
buildSettings = {
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = SHJK2V3AJG;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.ranchero.SyncDatabase;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
51554BF5228B6E8F0055115A /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 51554C1D228B701F0055115A /* SyncDatabase_target.xcconfig */;
buildSettings = {
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = SHJK2V3AJG;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.ranchero.SyncDatabase;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
51554BE5228B6E8F0055115A /* Build configuration list for PBXProject "SyncDatabase" */ = {
isa = XCConfigurationList;
buildConfigurations = (
51554BF1228B6E8F0055115A /* Debug */,
51554BF2228B6E8F0055115A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
51554BF3228B6E8F0055115A /* Build configuration list for PBXNativeTarget "SyncDatabase" */ = {
isa = XCConfigurationList;
buildConfigurations = (
51554BF4228B6E8F0055115A /* Debug */,
51554BF5228B6E8F0055115A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 51554BE2228B6E8F0055115A /* Project object */;
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:SyncDatabase.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,31 @@
//
// SyncStatus.swift
// NetNewsWire
//
// Created by Maurice Parker on 5/14/19.
// Copyright © 2019 Ranchero Software. All rights reserved.
//
import Foundation
import Articles
import RSDatabase
public struct SyncStatus {
public let articleID: String
public let key: ArticleStatus.Key
public let flag: Bool
public let selected: Bool
public init(articleID: String, key: ArticleStatus.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]
}
}

View File

@@ -0,0 +1,28 @@
//
// SyncStatusTable.swift
// NetNewsWire
//
// Created by Maurice Parker on 5/14/19.
// Copyright © 2019 Ranchero Software. All rights reserved.
//
import Foundation
import RSDatabase
final class SyncStatusTable: DatabaseTable {
let name = DatabaseTableName.syncStatus
private let queue: RSDatabaseQueue
init(queue: RSDatabaseQueue) {
self.queue = queue
}
func insertStatuses(_ statuses: [SyncStatus]) {
self.queue.update { database in
let statusArray = statuses.map { $0.databaseDictionary()! }
self.insertRows(statusArray, insertType: .orReplace, in: database)
}
}
}

View File

@@ -0,0 +1,58 @@
CODE_SIGN_IDENTITY = Mac Developer
CODE_SIGN_STYLE = Automatic
DEVELOPMENT_TEAM = 9C84TZ7Q6Z
// See the notes in NetNewsWire_target.xcconfig on why the
// DeveloperSettings.xcconfig is #included here
#include? "../../../SharedXcodeSettings/DeveloperSettings.xcconfig"
SDKROOT = macosx
MACOSX_DEPLOYMENT_TARGET = 10.14
CLANG_ENABLE_OBJC_WEAK = YES
SWIFT_VERSION = 5.0
COMBINE_HIDPI_IMAGES = YES
COPY_PHASE_STRIP = NO
MACOSX_DEPLOYMENT_TARGET = 10.14
ALWAYS_SEARCH_USER_PATHS = NO
CURRENT_PROJECT_VERSION = 1
VERSION_INFO_PREFIX =
VERSIONING_SYSTEM = apple-generic
GCC_NO_COMMON_BLOCKS = YES
GCC_C_LANGUAGE_STANDARD = gnu99
CLANG_CXX_LANGUAGE_STANDARD = gnu++0x
CLANG_CXX_LIBRARY = libc++
CLANG_ENABLE_MODULES = YES
CLANG_ENABLE_OBJC_ARC = YES
ENABLE_STRICT_OBJC_MSGSEND = YES
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES
CLANG_WARN_DOCUMENTATION_COMMENTS = YES
CLANG_WARN_EMPTY_BODY = YES
CLANG_WARN_BOOL_CONVERSION = YES
CLANG_WARN_CONSTANT_CONVERSION = YES
GCC_WARN_64_TO_32_BIT_CONVERSION = YES
CLANG_WARN_ENUM_CONVERSION = YES
CLANG_WARN_INT_CONVERSION = YES
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES
CLANG_WARN_INFINITE_RECURSION = YES
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR
CLANG_WARN_STRICT_PROTOTYPES = YES
CLANG_WARN_COMMA = YES
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE
CLANG_WARN_UNREACHABLE_CODE = YES
GCC_WARN_UNUSED_FUNCTION = YES
GCC_WARN_UNUSED_VARIABLE = YES
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES
CLANG_WARN_SUSPICIOUS_MOVE = YES
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES
GCC_WARN_UNDECLARED_SELECTOR = YES
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
CLANG_ANALYZER_NONNULL = YES
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE
SWIFT_SWIFT3_OBJC_INFERENCE = Off

View File

@@ -0,0 +1,15 @@
#include "./SyncDatabase_project.xcconfig"
DEBUG_INFORMATION_FORMAT = dwarf
ENABLE_TESTABILITY = YES
GCC_DYNAMIC_NO_PIC = NO
GCC_OPTIMIZATION_LEVEL = 0
GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1 $(inherited)
MTL_ENABLE_DEBUG_INFO = YES
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG
SWIFT_COMPILATION_MODE = singlefile
SWIFT_OPTIMIZATION_LEVEL = -Onone
ONLY_ACTIVE_ARCH = YES

View File

@@ -0,0 +1,9 @@
#include "./SyncDatabase_project.xcconfig"
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
ENABLE_NS_ASSERTIONS = NO
MTL_ENABLE_DEBUG_INFO = NO
SWIFT_OPTIMIZATION_LEVEL = -O
SWIFT_COMPILATION_MODE = wholemodule

View File

@@ -0,0 +1,16 @@
CODE_SIGN_IDENTITY =
// DEVELOPMENT_TEAM = 9C84TZ7Q6Z
INSTALL_PATH = $(LOCAL_LIBRARY_DIR)/Frameworks
SKIP_INSTALL = YES
DYLIB_COMPATIBILITY_VERSION = 1
DYLIB_CURRENT_VERSION = 1
DYLIB_INSTALL_NAME_BASE = @rpath
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/../Frameworks @loader_path/Frameworks
DEFINES_MODULE = YES
FRAMEWORK_VERSION = A
INFOPLIST_FILE = Info.plist
PRODUCT_BUNDLE_IDENTIFIER = com.ranchero.SyncDatabase
PRODUCT_NAME = $(TARGET_NAME)
CLANG_ENABLE_MODULES = YES