diff --git a/Account/Package.swift b/Account/Package.swift index bc3a13dc8..4fe166dda 100644 --- a/Account/Package.swift +++ b/Account/Package.swift @@ -24,6 +24,7 @@ let package = Package( .package(path: "../CloudKitSync"), .package(path: "../NewsBlur"), .package(path: "../Feedbin"), + .package(path: "../LocalAccount"), .package(path: "../FeedFinder"), .package(path: "../CommonErrors") ], @@ -44,6 +45,7 @@ let package = Package( "NewsBlur", "CloudKitSync", "Feedbin", + "LocalAccount", "FeedFinder", "CommonErrors" ], diff --git a/Account/Sources/Account/Feedbin/FeedbinAccountDelegate.swift b/Account/Sources/Account/AccountDelegates/FeedbinAccountDelegate.swift similarity index 100% rename from Account/Sources/Account/Feedbin/FeedbinAccountDelegate.swift rename to Account/Sources/Account/AccountDelegates/FeedbinAccountDelegate.swift diff --git a/Account/Sources/Account/Feedbin/FeedbinAPICaller.swift b/Account/Sources/Account/FeedbinAPICaller.swift similarity index 100% rename from Account/Sources/Account/Feedbin/FeedbinAPICaller.swift rename to Account/Sources/Account/FeedbinAPICaller.swift diff --git a/Account/Sources/Account/LocalAccount/LocalAccountRefresher.swift b/Account/Sources/Account/LocalAccountRefresher.swift similarity index 100% rename from Account/Sources/Account/LocalAccount/LocalAccountRefresher.swift rename to Account/Sources/Account/LocalAccountRefresher.swift diff --git a/Feedbin/Package.swift b/Feedbin/Package.swift index 4e61f3a9c..10fedb5f2 100644 --- a/Feedbin/Package.swift +++ b/Feedbin/Package.swift @@ -13,7 +13,6 @@ let package = Package( dependencies: [ .package(path: "../Parser"), ], - targets: [ .target( name: "Feedbin", diff --git a/LocalAccount/.gitignore b/LocalAccount/.gitignore new file mode 100644 index 000000000..0023a5340 --- /dev/null +++ b/LocalAccount/.gitignore @@ -0,0 +1,8 @@ +.DS_Store +/.build +/Packages +xcuserdata/ +DerivedData/ +.swiftpm/configuration/registries.json +.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +.netrc diff --git a/LocalAccount/Package.swift b/LocalAccount/Package.swift new file mode 100644 index 000000000..f35444936 --- /dev/null +++ b/LocalAccount/Package.swift @@ -0,0 +1,32 @@ +// swift-tools-version: 5.10 + +import PackageDescription + +let package = Package( + name: "LocalAccount", + platforms: [.macOS(.v14), .iOS(.v17)], + products: [ + .library( + name: "LocalAccount", + targets: ["LocalAccount"]), + ], + dependencies: [ + .package(path: "../Parser"), + .package(path: "../Web"), + ], + targets: [ + .target( + name: "LocalAccount", + dependencies: [ + "Parser", + "Web" + ], + swiftSettings: [ + .enableExperimentalFeature("StrictConcurrency") + ] + ), + .testTarget( + name: "LocalAccountTests", + dependencies: ["LocalAccount"]), + ] +) diff --git a/Account/Sources/Account/LocalAccount/InitialFeedDownloader.swift b/LocalAccount/Sources/LocalAccount/InitialFeedDownloader.swift similarity index 81% rename from Account/Sources/Account/LocalAccount/InitialFeedDownloader.swift rename to LocalAccount/Sources/LocalAccount/InitialFeedDownloader.swift index 49b4003d6..df281c01d 100644 --- a/Account/Sources/Account/LocalAccount/InitialFeedDownloader.swift +++ b/LocalAccount/Sources/LocalAccount/InitialFeedDownloader.swift @@ -10,9 +10,9 @@ import Foundation import Parser import Web -struct InitialFeedDownloader { +public struct InitialFeedDownloader { - static func download(_ url: URL) async -> ParsedFeed? { + @MainActor public static func download(_ url: URL) async -> ParsedFeed? { await withCheckedContinuation { @MainActor continuation in self.download(url) { parsedFeed in @@ -21,7 +21,7 @@ struct InitialFeedDownloader { } } - @MainActor static func download(_ url: URL,_ completion: @escaping (_ parsedFeed: ParsedFeed?) -> Void) { + @MainActor static func download(_ url: URL,_ completion: @escaping @Sendable (_ parsedFeed: ParsedFeed?) -> Void) { downloadUsingCache(url) { (data, response, error) in guard let data = data else { diff --git a/LocalAccount/Tests/LocalAccountTests/LocalAccountTests.swift b/LocalAccount/Tests/LocalAccountTests/LocalAccountTests.swift new file mode 100644 index 000000000..ed340230a --- /dev/null +++ b/LocalAccount/Tests/LocalAccountTests/LocalAccountTests.swift @@ -0,0 +1,12 @@ +import XCTest +@testable import LocalAccount + +final class LocalAccountTests: XCTestCase { + func testExample() throws { + // XCTest Documentation + // https://developer.apple.com/documentation/xctest + + // Defining Test Cases and Test Methods + // https://developer.apple.com/documentation/xctest/defining_test_cases_and_test_methods + } +} diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index dcbdf66e6..fe1d0c453 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -1391,6 +1391,7 @@ 84A37CB4201ECD610087C5AF /* RenameWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RenameWindowController.swift; sourceTree = ""; }; 84A3EE52223B667F00557320 /* DefaultFeeds.opml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = DefaultFeeds.opml; sourceTree = ""; }; 84A699132BC34E8500605AB8 /* ArticleExtractor */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = ArticleExtractor; sourceTree = ""; }; + 84A699182BC3524C00605AB8 /* LocalAccount */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = LocalAccount; sourceTree = ""; }; 84AD1EA92031617300BC20B7 /* PasteboardFolder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasteboardFolder.swift; sourceTree = ""; }; 84AD1EB92031649C00BC20B7 /* SmartFeedPasteboardWriter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SmartFeedPasteboardWriter.swift; sourceTree = ""; }; 84AD1EBB2032AF5C00BC20B7 /* SidebarOutlineDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarOutlineDataSource.swift; sourceTree = ""; }; @@ -2350,6 +2351,7 @@ 84A699132BC34E8500605AB8 /* ArticleExtractor */, 51CD32C624D2DEF9009ABAEF /* Account */, 84FB9FAE2BC3494B00B7AFC3 /* FeedFinder */, + 84A699182BC3524C00605AB8 /* LocalAccount */, 84FB9FAD2BC344F800B7AFC3 /* Feedbin */, 84FB9FAC2BC33AFE00B7AFC3 /* NewsBlur */, 84CC98D92BC1DD25006A05C9 /* ReaderAPI */,