Rename some instances of webfeed as feed.

This commit is contained in:
Brent Simmons committed 2025-11-03 08:55:25 -08:00
1 parent 48bb1b407c
commit e191c04d51
30 files changed
+176 -176

No files matched your search

+10 -10
View File
@@ -134,9 +134,9 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidat
addFolderWindowController!.runSheetOnWindow(window)
}
func showAddWebFeedSheetOnWindow(_ window: NSWindow, urlString: String?, name: String?, account: Account?, folder: Folder?) {
func showAddFeedSheetOnWindow(_ window: NSWindow, urlString: String?, name: String?, account: Account?, folder: Folder?) {
addFeedController = AddFeedController(hostWindow: window)
addFeedController?.showAddFeedSheet(.webFeed, urlString, name, account, folder)
addFeedController?.showAddFeedSheet(.feed, urlString, name, account, folder)
}
// MARK: - NSApplicationDelegate
@@ -332,10 +332,10 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidat
}
@objc func webFeedSettingDidChange(_ note: Notification) {
guard let feed = note.object as? Feed, let key = note.userInfo?[Feed.WebFeedSettingUserInfoKey] as? String else {
guard let feed = note.object as? Feed, let key = note.userInfo?[Feed.SettingUserInfoKey] as? String else {
return
}
if key == Feed.WebFeedSettingKey.homePageURL || key == Feed.WebFeedSettingKey.faviconURL {
if key == Feed.SettingKey.homePageURL || key == Feed.SettingKey.faviconURL {
_ = FaviconDownloader.shared.favicon(for: feed)
}
}
@@ -444,7 +444,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidat
return mainWindowController?.isOpen ?? false
}
if item.action == #selector(showAddWebFeedWindow(_:)) || item.action == #selector(showAddFolderWindow(_:)) {
if item.action == #selector(showAddFeedWindow(_:)) || item.action == #selector(showAddFolderWindow(_:)) {
return !isDisplayingSheet && !AccountManager.shared.activeAccounts.isEmpty
}
@@ -477,14 +477,14 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidat
}
// MARK: Add Feed
func addWebFeed(_ urlString: String?, name: String? = nil, account: Account? = nil, folder: Folder? = nil) {
func addFeed(_ urlString: String?, name: String? = nil, account: Account? = nil, folder: Folder? = nil) {
createAndShowMainWindowIfNecessary()
if mainWindowController!.isDisplayingSheet {
return
}
showAddWebFeedSheetOnWindow(mainWindowController!.window!, urlString: urlString, name: name, account: account, folder: folder)
showAddFeedSheetOnWindow(mainWindowController!.window!, urlString: urlString, name: name, account: account, folder: folder)
}
// MARK: - Dock Badge
@@ -517,8 +517,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidat
AccountManager.shared.refreshAll(errorHandler: ErrorHandler.present)
}
@IBAction func showAddWebFeedWindow(_ sender: Any?) {
addWebFeed(nil)
@IBAction func showAddFeedWindow(_ sender: Any?) {
addFeed(nil)
}
@IBAction func showAddFolderWindow(_ sender: Any?) {
@@ -591,7 +591,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidat
if AccountManager.shared.anyAccountHasNetNewsWireNewsSubscription() {
return
}
addWebFeed(AccountManager.netNewsWireNewsURL, name: "NetNewsWire News")
addFeed(AccountManager.netNewsWireNewsURL, name: "NetNewsWire News")
}
@IBAction func openWebsite(_ sender: Any?) {
+1 -1
View File
@@ -70,7 +70,7 @@
<items>
<menuItem title="New Feed…" keyEquivalent="n" id="Was-JA-tGl">
<connections>
<action selector="showAddWebFeedWindow:" target="Ady-hI-5gd" id="LkT-kx-aCR"/>
<action selector="showAddFeedWindow:" target="Ady-hI-5gd" id="jOz-hB-3zH"/>
</connections>
</menuItem>
<menuItem title="New Folder…" keyEquivalent="N" id="wkh-LX-Xp1">
@@ -38,7 +38,7 @@ final class AddFeedController: AddFeedWindowControllerDelegate {
let folderTreeController = TreeController(delegate: folderTreeControllerDelegate)
switch type {
case .webFeed:
case .feed:
addFeedWindowController = AddWebFeedWindowController(urlString: urlString ?? urlStringFromPasteboard,
name: name,
account: account,
@@ -60,7 +60,7 @@ final class AddFeedController: AddFeedWindowControllerDelegate {
}
let account = accountAndFolderSpecifier.account
if account.hasWebFeed(withURL: url.absoluteString) {
if account.hasFeed(withURL: url.absoluteString) {
showAlreadySubscribedError(url.absoluteString)
return
}
@@ -10,7 +10,7 @@ import Foundation
import Account
enum AddFeedWindowControllerType {
case webFeed
case feed
}
protocol AddFeedWindowControllerDelegate: AnyObject {
+3 -3
View File
@@ -628,8 +628,8 @@ extension MainWindowController: TimelineContainerViewControllerDelegate {
detailViewController?.setState(detailState, mode: mode)
}
func timelineRequestedWebFeedSelection(_: TimelineContainerViewController, webFeed: Feed) {
sidebarViewController?.selectFeed(webFeed)
func timelineRequestedFeedSelection(_: TimelineContainerViewController, feed: Feed) {
sidebarViewController?.selectFeed(feed)
}
func timelineInvalidatedRestorationState(_: TimelineContainerViewController) {
@@ -1386,7 +1386,7 @@ private extension MainWindowController {
let newFeedItem = NSMenuItem()
newFeedItem.title = NSLocalizedString("New Feed…", comment: "New Feed")
newFeedItem.action = Selector(("showAddWebFeedWindow:"))
newFeedItem.action = Selector(("showAddFeedWindow:"))
menu.addItem(newFeedItem)
let newFolderFeedItem = NSMenuItem()
@@ -499,11 +499,11 @@ private extension SidebarOutlineDataSource {
// Show the add-feed sheet.
if let account = parentNode.representedObject as? Account {
appDelegate.addWebFeed(draggedFeed.url, name: draggedFeed.editedName ?? draggedFeed.name, account: account, folder: nil)
appDelegate.addFeed(draggedFeed.url, name: draggedFeed.editedName ?? draggedFeed.name, account: account, folder: nil)
} else {
let account = parentNode.parent?.representedObject as? Account
let folder = parentNode.representedObject as? Folder
appDelegate.addWebFeed(draggedFeed.url, name: draggedFeed.editedName ?? draggedFeed.name, account: account, folder: folder)
appDelegate.addFeed(draggedFeed.url, name: draggedFeed.editedName ?? draggedFeed.name, account: account, folder: folder)
}
return true
@@ -525,8 +525,8 @@ private extension SidebarOutlineDataSource {
return false
}
func sameAccount(_ pasteboardWebFeed: PasteboardFeed, _ parentNode: Node) -> Bool {
if let accountID = pasteboardWebFeed.accountID {
func sameAccount(_ pasteboardFeed: PasteboardFeed, _ parentNode: Node) -> Bool {
if let accountID = pasteboardFeed.accountID {
return sameAccount(accountID, parentNode)
}
return false
@@ -635,7 +635,7 @@ private extension SidebarOutlineDataSource {
return true
}
} else {
if dropTargetAccount.hasWebFeed(withURL: draggedFeed.url) {
if dropTargetAccount.hasFeed(withURL: draggedFeed.url) {
return true
}
}
@@ -200,7 +200,7 @@ private extension SidebarViewController {
let menu = NSMenu(title: "")
menu.addItem(withTitle: NSLocalizedString("New Feed", comment: "Command"), action: #selector(AppDelegate.showAddWebFeedWindow(_:)), keyEquivalent: "")
menu.addItem(withTitle: NSLocalizedString("New Feed", comment: "Command"), action: #selector(AppDelegate.showAddFeedWindow(_:)), keyEquivalent: "")
menu.addItem(withTitle: NSLocalizedString("New Folder", comment: "Command"), action: #selector(AppDelegate.showAddFolderWindow(_:)), keyEquivalent: "")
return menu
@@ -232,10 +232,10 @@ protocol SidebarDelegate: AnyObject {
}
@objc func webFeedSettingDidChange(_ note: Notification) {
guard let webFeed = note.object as? Feed, let key = note.userInfo?[Feed.WebFeedSettingUserInfoKey] as? String else {
guard let webFeed = note.object as? Feed, let key = note.userInfo?[Feed.SettingUserInfoKey] as? String else {
return
}
if key == Feed.WebFeedSettingKey.homePageURL || key == Feed.WebFeedSettingKey.faviconURL {
if key == Feed.SettingKey.homePageURL || key == Feed.SettingKey.faviconURL {
configureCellsForRepresentedObject(webFeed)
}
}
@@ -12,7 +12,7 @@ import Articles
protocol TimelineContainerViewControllerDelegate: AnyObject {
func timelineSelectionDidChange(_: TimelineContainerViewController, articles: [Article]?, mode: TimelineSourceMode)
func timelineRequestedWebFeedSelection(_: TimelineContainerViewController, webFeed: Feed)
func timelineRequestedFeedSelection(_: TimelineContainerViewController, feed: Feed)
func timelineInvalidatedRestorationState(_: TimelineContainerViewController)
}
@@ -154,7 +154,7 @@ extension TimelineContainerViewController: TimelineDelegate {
}
func timelineRequestedWebFeedSelection(_: TimelineViewController, webFeed: Feed) {
delegate?.timelineRequestedWebFeedSelection(self, webFeed: webFeed)
delegate?.timelineRequestedFeedSelection(self, feed: webFeed)
}
func timelineInvalidatedRestorationState(_: TimelineViewController) {
@@ -1285,7 +1285,7 @@ private extension TimelineViewController {
}
else if let folder = representedObject as? Folder {
for oneFeed in webFeeds {
if folder.hasWebFeed(with: oneFeed.webFeedID) || folder.hasWebFeed(withURL: oneFeed.url) {
if folder.hasFeed(with: oneFeed.webFeedID) || folder.hasFeed(withURL: oneFeed.url) {
return true
}
}
@@ -86,7 +86,7 @@ extension AppDelegate : AppDelegateAppleEvents {
DispatchQueue.main.async {
self.addWebFeed(normalizedURLString)
self.addFeed(normalizedURLString)
}
}
}
@@ -885,7 +885,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
return _flattenedFeeds
}
public func removeWebFeed(_ feed: Feed) {
public func removeFeed(_ feed: Feed) {
topLevelFeeds.remove(feed)
structureDidChange()
postChildrenDidChangeNotification()
@@ -321,7 +321,7 @@ public final class AccountManager: UnreadCountProvider {
public func anyAccountHasAtLeastOneFeed() -> Bool {
for account in activeAccounts {
if account.hasAtLeastOneWebFeed() {
if account.hasAtLeastOneFeed() {
return true
}
}
@@ -214,14 +214,14 @@ final class CloudKitAccountDelegate: AccountDelegate {
switch result {
case .success:
account.clearFeedMetadata(feed)
container.removeWebFeed(feed)
container.removeFeed(feed)
completion(.success(()))
case .failure(let error):
switch error {
case CloudKitZoneError.corruptAccount:
// We got into a bad state and should remove the feed to clear up the bad data
account.clearFeedMetadata(feed)
container.removeWebFeed(feed)
container.removeFeed(feed)
default:
completion(.failure(error))
}
@@ -235,7 +235,7 @@ final class CloudKitAccountDelegate: AccountDelegate {
self.syncProgress.completeTask()
switch result {
case .success:
fromContainer.removeWebFeed(feed)
fromContainer.removeFeed(feed)
toContainer.addFeed(feed)
completion(.success(()))
case .failure(let error):
@@ -607,7 +607,7 @@ private extension CloudKitAccountDelegate {
feed.externalID = externalID
completion(.success(feed))
case .failure(let error):
container.removeWebFeed(feed)
container.removeFeed(feed)
completion(.failure(error))
}
}
@@ -630,7 +630,7 @@ private extension CloudKitAccountDelegate {
return
}
if account.hasWebFeed(withURL: bestFeedSpecifier.urlString) {
if account.hasFeed(withURL: bestFeedSpecifier.urlString) {
self.syncProgress.completeTasks(4)
completion(.failure(AccountError.createErrorAlreadySubscribed))
return
@@ -668,14 +668,14 @@ private extension CloudKitAccountDelegate {
self.sendNewArticlesToTheCloud(account, feed)
completion(.success(feed))
case .failure(let error):
container.removeWebFeed(feed)
container.removeFeed(feed)
self.syncProgress.completeTasks(2)
completion(.failure(error))
}
}
case .failure(let error):
container.removeWebFeed(feed)
container.removeFeed(feed)
self.syncProgress.completeTasks(3)
completion(.failure(error))
}
@@ -683,7 +683,7 @@ private extension CloudKitAccountDelegate {
}
} else {
self.syncProgress.completeTasks(3)
container.removeWebFeed(feed)
container.removeFeed(feed)
completion(.failure(AccountError.createErrorNotFound))
}
@@ -82,7 +82,7 @@ final class CloudKitAcountZoneDelegate: CloudKitZoneDelegate {
if let webFeed = account?.existingFeed(withExternalID: externalID), let containers = account?.existingContainers(withFeed: webFeed) {
for container in containers {
webFeed.dropConditionalGetInfo()
container.removeWebFeed(webFeed)
container.removeFeed(webFeed)
}
}
}
@@ -152,7 +152,7 @@ private extension CloudKitAcountZoneDelegate {
switch change {
case .remove(_, let externalID, _):
if let container = existingContainers.first(where: { $0.externalID == externalID }) {
container.removeWebFeed(webFeed)
container.removeFeed(webFeed)
}
case .insert(_, let externalID, _):
if let container = account.existingContainer(withExternalID: externalID) {
+14 -14
View File
@@ -23,20 +23,20 @@ public protocol Container: AnyObject, ContainerIdentifiable {
var folders: Set<Folder>? { get set }
var externalID: String? { get set }
func hasAtLeastOneWebFeed() -> Bool
func hasAtLeastOneFeed() -> Bool
func objectIsChild(_ object: AnyObject) -> Bool
func hasChildFolder(with: String) -> Bool
func childFolder(with: String) -> Folder?
func removeWebFeed(_ webFeed: Feed)
func addFeed(_ webFeed: Feed)
func removeFeed(_ feed: Feed)
func addFeed(_ feed: Feed)
//Recursive — checks subfolders
func flattenedFeeds() -> Set<Feed>
func has(_ webFeed: Feed) -> Bool
func hasWebFeed(with webFeedID: String) -> Bool
func hasWebFeed(withURL url: String) -> Bool
func has(_ feed: Feed) -> Bool
func hasFeed(with feedID: String) -> Bool
func hasFeed(withURL url: String) -> Bool
func existingFeed(withFeedID: String) -> Feed?
func existingFeed(withURL url: String) -> Feed?
func existingFeed(withExternalID externalID: String) -> Feed?
@@ -48,7 +48,7 @@ public protocol Container: AnyObject, ContainerIdentifiable {
public extension Container {
func hasAtLeastOneWebFeed() -> Bool {
func hasAtLeastOneFeed() -> Bool {
return topLevelFeeds.count > 0
}
@@ -89,21 +89,21 @@ public extension Container {
return feeds
}
func hasWebFeed(with webFeedID: String) -> Bool {
return existingFeed(withFeedID: webFeedID) != nil
func hasFeed(with feedID: String) -> Bool {
return existingFeed(withFeedID: feedID) != nil
}
func hasWebFeed(withURL url: String) -> Bool {
func hasFeed(withURL url: String) -> Bool {
return existingFeed(withURL: url) != nil
}
func has(_ webFeed: Feed) -> Bool {
return flattenedFeeds().contains(webFeed)
func has(_ feed: Feed) -> Bool {
return flattenedFeeds().contains(feed)
}
func existingFeed(withFeedID webFeedID: String) -> Feed? {
func existingFeed(withFeedID feedID: String) -> Feed? {
for feed in flattenedFeeds() {
if feed.webFeedID == webFeedID {
if feed.webFeedID == feedID {
return feed
}
}
@@ -16,9 +16,9 @@ public extension Notification.Name {
public extension Feed {
static let WebFeedSettingUserInfoKey = "feedSetting"
static let SettingUserInfoKey = "feedSetting"
struct WebFeedSettingKey {
struct SettingKey {
public static let homePageURL = "homePageURL"
public static let iconURL = "iconURL"
public static let faviconURL = "faviconURL"
@@ -42,7 +42,7 @@ extension Feed {
}
func postFeedSettingDidChangeNotification(_ codingKey: FeedMetadata.CodingKeys) {
let userInfo = [Feed.WebFeedSettingUserInfoKey: codingKey.stringValue]
let userInfo = [Feed.SettingUserInfoKey: codingKey.stringValue]
NotificationCenter.default.post(name: .WebFeedSettingDidChange, object: self, userInfo: userInfo)
}
}
@@ -301,7 +301,7 @@ final class FeedbinAccountDelegate: AccountDelegate {
func renameFolder(for account: Account, with folder: Folder, to name: String, completion: @escaping (Result<Void, Error>) -> Void) {
guard folder.hasAtLeastOneWebFeed() else {
guard folder.hasAtLeastOneFeed() else {
folder.name = name
return
}
@@ -329,7 +329,7 @@ final class FeedbinAccountDelegate: AccountDelegate {
func removeFolder(for account: Account, with folder: Folder, completion: @escaping (Result<Void, Error>) -> Void) {
// Feedbin uses tags and if at least one feed isn't tagged, then the folder doesn't exist on their system
guard folder.hasAtLeastOneWebFeed() else {
guard folder.hasAtLeastOneFeed() else {
account.removeFolder(folder)
completion(.success(()))
return
@@ -481,7 +481,7 @@ final class FeedbinAccountDelegate: AccountDelegate {
case .success(let taggingID):
DispatchQueue.main.async {
self.saveFolderRelationship(for: feed, withFolderName: folder.name ?? "", id: String(taggingID))
account.removeWebFeed(feed)
account.removeFeed(feed)
folder.addFeed(feed)
completion(.success(()))
}
@@ -821,7 +821,7 @@ private extension FeedbinAccountDelegate {
for folder in folders {
for feed in folder.topLevelFeeds {
if !subFeedIds.contains(feed.webFeedID) {
folder.removeWebFeed(feed)
folder.removeFeed(feed)
}
}
}
@@ -829,7 +829,7 @@ private extension FeedbinAccountDelegate {
for feed in account.topLevelFeeds {
if !subFeedIds.contains(feed.webFeedID) {
account.removeWebFeed(feed)
account.removeFeed(feed)
}
}
@@ -891,7 +891,7 @@ private extension FeedbinAccountDelegate {
// Move any feeds not in the folder to the account
for feed in folder.topLevelFeeds {
if !taggingFeedIDs.contains(feed.webFeedID) {
folder.removeWebFeed(feed)
folder.removeFeed(feed)
clearFolderRelationship(for: feed, withFolderName: folder.name ?? "")
account.addFeed(feed)
}
@@ -918,7 +918,7 @@ private extension FeedbinAccountDelegate {
// Remove all feeds from the account container that have a tag
for feed in account.topLevelFeeds {
if taggedFeedIDs.contains(feed.webFeedID) {
account.removeWebFeed(feed)
account.removeFeed(feed)
}
}
}
@@ -1379,7 +1379,7 @@ private extension FeedbinAccountDelegate {
case .success:
DispatchQueue.main.async {
self.clearFolderRelationship(for: feed, withFolderName: folder.name ?? "")
folder.removeWebFeed(feed)
folder.removeFeed(feed)
account.addFeedIfNotInAnyFolder(feed)
completion(.success(()))
}
@@ -1392,7 +1392,7 @@ private extension FeedbinAccountDelegate {
}
} else {
if let account = container as? Account {
account.removeWebFeed(feed)
account.removeFeed(feed)
}
completion(.success(()))
}
@@ -1410,10 +1410,10 @@ private extension FeedbinAccountDelegate {
func complete() {
DispatchQueue.main.async {
account.clearFeedMetadata(feed)
account.removeWebFeed(feed)
account.removeFeed(feed)
if let folders = account.folders {
for folder in folders {
folder.removeWebFeed(feed)
folder.removeFeed(feed)
}
}
completion(.success(()))
@@ -426,7 +426,7 @@ final class FeedlyAccountDelegate: AccountDelegate {
}
}
folder.removeWebFeed(feed)
folder.removeFeed(feed)
}
func moveFeed(for account: Account, with feed: Feed, from: Container, to: Container, completion: @escaping (Result<Void, Error>) -> Void) {
@@ -451,14 +451,14 @@ final class FeedlyAccountDelegate: AccountDelegate {
}
case .failure(let error):
from.addFeed(feed)
to.removeWebFeed(feed)
to.removeFeed(feed)
completion(.failure(error))
}
}
// optimistically move the feed, undoing as appropriate to the failure
from.removeWebFeed(feed)
from.removeFeed(feed)
to.addFeed(feed)
}
+1 -1
View File
@@ -126,7 +126,7 @@ public final class Folder: SidebarItem, Renamable, Container, Hashable {
postChildrenDidChangeNotification()
}
public func removeWebFeed(_ feed: Feed) {
public func removeFeed(_ feed: Feed) {
topLevelFeeds.remove(feed)
postChildrenDidChangeNotification()
}
@@ -49,12 +49,12 @@ final class LocalAccountDelegate: AccountDelegate {
return
}
let webFeeds = account.flattenedFeeds()
let feeds = account.flattenedFeeds()
let group = DispatchGroup()
group.enter()
refresher.refreshFeeds(webFeeds) {
refresher.refreshFeeds(feeds) {
group.leave()
}
@@ -123,7 +123,7 @@ final class LocalAccountDelegate: AccountDelegate {
return
}
createRSSWebFeed(for: account, url: url, editedName: name, container: container, completion: completion)
createFeed(for: account, url: url, editedName: name, container: container, completion: completion)
}
func renameFeed(for account: Account, with feed: Feed, to name: String, completion: @escaping (Result<Void, Error>) -> Void) {
@@ -132,12 +132,12 @@ final class LocalAccountDelegate: AccountDelegate {
}
func removeFeed(for account: Account, with feed: Feed, from container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
container.removeWebFeed(feed)
container.removeFeed(feed)
completion(.success(()))
}
func moveFeed(for account: Account, with feed: Feed, from: Container, to: Container, completion: @escaping (Result<Void, Error>) -> Void) {
from.removeWebFeed(feed)
from.removeFeed(feed)
to.addFeed(feed)
completion(.success(()))
}
@@ -219,7 +219,7 @@ extension LocalAccountDelegate: LocalAccountRefresherDelegate {
private extension LocalAccountDelegate {
func createRSSWebFeed(for account: Account, url: URL, editedName: String?, container: Container, completion: @escaping (Result<Feed, Error>) -> Void) {
func createFeed(for account: Account, url: URL, editedName: String?, container: Container, completion: @escaping (Result<Feed, Error>) -> Void) {
// We need to use a batch update here because we need to assign add the feed to the
// container before the name has been downloaded. This will put it in the sidebar
@@ -236,7 +236,7 @@ private extension LocalAccountDelegate {
return
}
if account.hasWebFeed(withURL: bestFeedSpecifier.urlString) {
if account.hasFeed(withURL: bestFeedSpecifier.urlString) {
BatchUpdate.shared.end()
completion(.failure(AccountError.createErrorAlreadySubscribed))
return
@@ -86,7 +86,7 @@ extension NewsBlurAccountDelegate {
for folder in folders {
for feed in folder.topLevelFeeds {
if !newsBlurFeedIds.contains(feed.webFeedID) {
folder.removeWebFeed(feed)
folder.removeFeed(feed)
}
}
}
@@ -94,7 +94,7 @@ extension NewsBlurAccountDelegate {
for feed in account.topLevelFeeds {
if !newsBlurFeedIds.contains(feed.webFeedID) {
account.removeWebFeed(feed)
account.removeFeed(feed)
}
}
@@ -157,7 +157,7 @@ extension NewsBlurAccountDelegate {
// Move any feeds not in the folder to the account
for feed in folder.topLevelFeeds {
if !newsBlurFolderFeedIDs.contains(feed.webFeedID) {
folder.removeWebFeed(feed)
folder.removeFeed(feed)
clearFolderRelationship(for: feed, withFolderName: folder.name ?? "")
account.addFeed(feed)
}
@@ -184,12 +184,12 @@ extension NewsBlurAccountDelegate {
let newsBlurFolderFeedIDs = folderRelationships.map { String($0.feedID) }
for feed in account.topLevelFeeds {
if !newsBlurFolderFeedIDs.contains(feed.webFeedID) {
account.removeWebFeed(feed)
account.removeFeed(feed)
}
}
} else {
for feed in account.topLevelFeeds {
account.removeWebFeed(feed)
account.removeFeed(feed)
}
}
@@ -532,12 +532,12 @@ extension NewsBlurAccountDelegate {
let feedID = feed.webFeedID
if folderName == nil {
account.removeWebFeed(feed)
account.removeFeed(feed)
}
if let folders = account.folders {
for folder in folders where folderName != nil && folder.name == folderName {
folder.removeWebFeed(feed)
folder.removeFeed(feed)
}
}
@@ -511,7 +511,7 @@ final class NewsBlurAccountDelegate: AccountDelegate {
switch result {
case .success:
from.removeWebFeed(feed)
from.removeFeed(feed)
to.addFeed(feed)
completion(.success(()))
@@ -478,10 +478,10 @@ final class ReaderAPIAccountDelegate: AccountDelegate {
case .success:
DispatchQueue.main.async {
account.clearFeedMetadata(feed)
account.removeWebFeed(feed)
account.removeFeed(feed)
if let folders = account.folders {
for folder in folders {
folder.removeWebFeed(feed)
folder.removeFeed(feed)
}
}
completion(.success(()))
@@ -513,7 +513,7 @@ final class ReaderAPIAccountDelegate: AccountDelegate {
self.refreshProgress.completeTask()
switch result {
case .success:
from.removeWebFeed(feed)
from.removeFeed(feed)
to.addFeed(feed)
completion(.success(()))
case .failure(let error):
@@ -532,7 +532,7 @@ final class ReaderAPIAccountDelegate: AccountDelegate {
case .success:
DispatchQueue.main.async {
self.saveFolderRelationship(for: feed, folderExternalID: folder.externalID, feedExternalID: feedExternalID)
account.removeWebFeed(feed)
account.removeFeed(feed)
folder.addFeed(feed)
completion(.success(()))
}
@@ -757,7 +757,7 @@ private extension ReaderAPIAccountDelegate {
for folder in folders {
for feed in folder.topLevelFeeds {
if !subFeedIds.contains(feed.webFeedID) {
folder.removeWebFeed(feed)
folder.removeFeed(feed)
}
}
}
@@ -766,7 +766,7 @@ private extension ReaderAPIAccountDelegate {
for feed in account.topLevelFeeds {
if !subFeedIds.contains(feed.webFeedID) {
account.clearFeedMetadata(feed)
account.removeWebFeed(feed)
account.removeFeed(feed)
}
}
@@ -817,7 +817,7 @@ private extension ReaderAPIAccountDelegate {
// Move any feeds not in the folder to the account
for feed in folder.topLevelFeeds {
if !taggingFeedIDs.contains(feed.webFeedID) {
folder.removeWebFeed(feed)
folder.removeFeed(feed)
clearFolderRelationship(for: feed, folderExternalID: folder.externalID)
account.addFeed(feed)
}
@@ -844,7 +844,7 @@ private extension ReaderAPIAccountDelegate {
// Remove all feeds from the account container that have a tag
for feed in account.topLevelFeeds {
if taggedFeedIDs.contains(feed.webFeedID) {
account.removeWebFeed(feed)
account.removeFeed(feed)
}
}
}
@@ -48,20 +48,20 @@ final class ArticlesTable: DatabaseTable {
// MARK: - Fetching Articles for Feed
func fetchArticles(_ webFeedID: String) throws -> Set<Article> {
return try fetchArticles{ self.fetchArticlesForFeedID(webFeedID, $0) }
func fetchArticles(_ feedID: String) throws -> Set<Article> {
return try fetchArticles{ self.fetchArticlesForFeedID(feedID, $0) }
}
func fetchArticlesAsync(_ webFeedID: String, _ completion: @escaping ArticleSetResultBlock) {
fetchArticlesAsync({ self.fetchArticlesForFeedID(webFeedID, $0) }, completion)
func fetchArticlesAsync(_ feedID: String, _ completion: @escaping ArticleSetResultBlock) {
fetchArticlesAsync({ self.fetchArticlesForFeedID(feedID, $0) }, completion)
}
func fetchArticles(_ webFeedIDs: Set<String>) throws -> Set<Article> {
return try fetchArticles{ self.fetchArticles(webFeedIDs, $0) }
func fetchArticles(_ feedIDs: Set<String>) throws -> Set<Article> {
return try fetchArticles{ self.fetchArticles(feedIDs, $0) }
}
func fetchArticlesAsync(_ webFeedIDs: Set<String>, _ completion: @escaping ArticleSetResultBlock) {
fetchArticlesAsync({ self.fetchArticles(webFeedIDs, $0) }, completion)
func fetchArticlesAsync(_ feedIDs: Set<String>, _ completion: @escaping ArticleSetResultBlock) {
fetchArticlesAsync({ self.fetchArticles(feedIDs, $0) }, completion)
}
// MARK: - Fetching Articles by articleID
@@ -76,36 +76,36 @@ final class ArticlesTable: DatabaseTable {
// MARK: - Fetching Unread Articles
func fetchUnreadArticles(_ webFeedIDs: Set<String>, _ limit: Int?) throws -> Set<Article> {
return try fetchArticles{ self.fetchUnreadArticles(webFeedIDs, limit, $0) }
func fetchUnreadArticles(_ feedIDs: Set<String>, _ limit: Int?) throws -> Set<Article> {
return try fetchArticles{ self.fetchUnreadArticles(feedIDs, limit, $0) }
}
func fetchUnreadArticlesAsync(_ webFeedIDs: Set<String>, _ limit: Int?, _ completion: @escaping ArticleSetResultBlock) {
fetchArticlesAsync({ self.fetchUnreadArticles(webFeedIDs, limit, $0) }, completion)
func fetchUnreadArticlesAsync(_ feedIDs: Set<String>, _ limit: Int?, _ completion: @escaping ArticleSetResultBlock) {
fetchArticlesAsync({ self.fetchUnreadArticles(feedIDs, limit, $0) }, completion)
}
// MARK: - Fetching Today Articles
func fetchArticlesSince(_ webFeedIDs: Set<String>, _ cutoffDate: Date, _ limit: Int?) throws -> Set<Article> {
return try fetchArticles{ self.fetchArticlesSince(webFeedIDs, cutoffDate, limit, $0) }
func fetchArticlesSince(_ feedIDs: Set<String>, _ cutoffDate: Date, _ limit: Int?) throws -> Set<Article> {
return try fetchArticles{ self.fetchArticlesSince(feedIDs, cutoffDate, limit, $0) }
}
func fetchArticlesSinceAsync(_ webFeedIDs: Set<String>, _ cutoffDate: Date, _ limit: Int?, _ completion: @escaping ArticleSetResultBlock) {
fetchArticlesAsync({ self.fetchArticlesSince(webFeedIDs, cutoffDate, limit, $0) }, completion)
func fetchArticlesSinceAsync(_ feedIDs: Set<String>, _ cutoffDate: Date, _ limit: Int?, _ completion: @escaping ArticleSetResultBlock) {
fetchArticlesAsync({ self.fetchArticlesSince(feedIDs, cutoffDate, limit, $0) }, completion)
}
// MARK: - Fetching Starred Articles
func fetchStarredArticles(_ webFeedIDs: Set<String>, _ limit: Int?) throws -> Set<Article> {
return try fetchArticles{ self.fetchStarredArticles(webFeedIDs, limit, $0) }
func fetchStarredArticles(_ feedIDs: Set<String>, _ limit: Int?) throws -> Set<Article> {
return try fetchArticles{ self.fetchStarredArticles(feedIDs, limit, $0) }
}
func fetchStarredArticlesAsync(_ webFeedIDs: Set<String>, _ limit: Int?, _ completion: @escaping ArticleSetResultBlock) {
fetchArticlesAsync({ self.fetchStarredArticles(webFeedIDs, limit, $0) }, completion)
func fetchStarredArticlesAsync(_ feedIDs: Set<String>, _ limit: Int?, _ completion: @escaping ArticleSetResultBlock) {
fetchArticlesAsync({ self.fetchStarredArticles(feedIDs, limit, $0) }, completion)
}
func fetchStarredArticlesCount(_ webFeedIDs: Set<String>) throws -> Int {
return try fetchArticlesCount{ self.fetchStarredArticlesCount(webFeedIDs, $0) }
func fetchStarredArticlesCount(_ feedIDs: Set<String>) throws -> Int {
return try fetchArticlesCount{ self.fetchStarredArticlesCount(feedIDs, $0) }
}
// MARK: - Fetching Search Articles
@@ -129,9 +129,9 @@ final class ArticlesTable: DatabaseTable {
return articles
}
func fetchArticlesMatching(_ searchString: String, _ webFeedIDs: Set<String>) throws -> Set<Article> {
func fetchArticlesMatching(_ searchString: String, _ feedIDs: Set<String>) throws -> Set<Article> {
var articles = try fetchArticlesMatching(searchString)
articles = articles.filter{ webFeedIDs.contains($0.feedID) }
articles = articles.filter{ feedIDs.contains($0.feedID) }
return articles
}
@@ -141,8 +141,8 @@ final class ArticlesTable: DatabaseTable {
return articles
}
func fetchArticlesMatchingAsync(_ searchString: String, _ webFeedIDs: Set<String>, _ completion: @escaping ArticleSetResultBlock) {
fetchArticlesAsync({ self.fetchArticlesMatching(searchString, webFeedIDs, $0) }, completion)
func fetchArticlesMatchingAsync(_ searchString: String, _ feedIDs: Set<String>, _ completion: @escaping ArticleSetResultBlock) {
fetchArticlesAsync({ self.fetchArticlesMatching(searchString, feedIDs, $0) }, completion)
}
func fetchArticlesMatchingWithArticleIDsAsync(_ searchString: String, _ articleIDs: Set<String>, _ completion: @escaping ArticleSetResultBlock) {
@@ -195,7 +195,7 @@ final class ArticlesTable: DatabaseTable {
// MARK: - Updating and Deleting
func update(_ parsedItems: Set<ParsedItem>, _ webFeedID: String, _ deleteOlder: Bool, _ completion: @escaping UpdateArticlesCompletionBlock) {
func update(_ parsedItems: Set<ParsedItem>, _ feedID: String, _ deleteOlder: Bool, _ completion: @escaping UpdateArticlesCompletionBlock) {
precondition(retentionStyle == .feedBased)
if parsedItems.isEmpty {
callUpdateArticlesCompletionBlock(nil, nil, nil, completion)
@@ -220,13 +220,13 @@ final class ArticlesTable: DatabaseTable {
let (statusesDictionary, _) = self.statusesTable.ensureStatusesForArticleIDs(articleIDs, false, database) //1
assert(statusesDictionary.count == articleIDs.count)
let incomingArticles = Article.articlesWithParsedItems(parsedItems, webFeedID, self.accountID, statusesDictionary) //2
let incomingArticles = Article.articlesWithParsedItems(parsedItems, feedID, self.accountID, statusesDictionary) //2
if incomingArticles.isEmpty {
self.callUpdateArticlesCompletionBlock(nil, nil, nil, completion)
return
}
let fetchedArticles = self.fetchArticlesForFeedID(webFeedID, database) //4
let fetchedArticles = self.fetchArticlesForFeedID(feedID, database) //4
let fetchedArticlesDictionary = fetchedArticles.dictionary()
let newArticles = self.findAndSaveNewArticles(incomingArticles, fetchedArticlesDictionary, database) //5
@@ -275,9 +275,9 @@ final class ArticlesTable: DatabaseTable {
}
}
func update(_ webFeedIDsAndItems: [String: Set<ParsedItem>], _ read: Bool, _ completion: @escaping UpdateArticlesCompletionBlock) {
func update(_ feedIDsAndItems: [String: Set<ParsedItem>], _ read: Bool, _ completion: @escaping UpdateArticlesCompletionBlock) {
precondition(retentionStyle == .syncSystem)
if webFeedIDsAndItems.isEmpty {
if feedIDsAndItems.isEmpty {
callUpdateArticlesCompletionBlock(nil, nil, nil, completion)
return
}
@@ -295,14 +295,14 @@ final class ArticlesTable: DatabaseTable {
func makeDatabaseCalls(_ database: FMDatabase) {
var articleIDs = Set<String>()
for (_, parsedItems) in webFeedIDsAndItems {
for (_, parsedItems) in feedIDsAndItems {
articleIDs.formUnion(parsedItems.articleIDs())
}
let (statusesDictionary, _) = self.statusesTable.ensureStatusesForArticleIDs(articleIDs, read, database) //1
assert(statusesDictionary.count == articleIDs.count)
let allIncomingArticles = Article.articlesWithWebFeedIDsAndItems(webFeedIDsAndItems, self.accountID, statusesDictionary) //2
let allIncomingArticles = Article.articlesWithFeedIDsAndItems(feedIDsAndItems, self.accountID, statusesDictionary) //2
if allIncomingArticles.isEmpty {
self.callUpdateArticlesCompletionBlock(nil, nil, nil, completion)
return
@@ -371,9 +371,9 @@ final class ArticlesTable: DatabaseTable {
// MARK: - Unread Counts
func fetchUnreadCount(_ webFeedIDs: Set<String>, _ since: Date, _ completion: @escaping SingleUnreadCountCompletionBlock) {
func fetchUnreadCount(_ feedIDs: Set<String>, _ since: Date, _ completion: @escaping SingleUnreadCountCompletionBlock) {
// Get unread count for today, for instance.
if webFeedIDs.isEmpty {
if feedIDs.isEmpty {
completion(.success(0))
return
}
@@ -381,11 +381,11 @@ final class ArticlesTable: DatabaseTable {
queue.runInDatabase { databaseResult in
func makeDatabaseCalls(_ database: FMDatabase) {
let placeholders = NSString.rs_SQLValueList(withPlaceholders: UInt(webFeedIDs.count))!
let placeholders = NSString.rs_SQLValueList(withPlaceholders: UInt(feedIDs.count))!
let sql = "select count(*) from articles natural join statuses where feedID in \(placeholders) and (datePublished > ? or (datePublished is null and dateArrived > ?)) and read=0;"
var parameters = [Any]()
parameters += Array(webFeedIDs) as [Any]
parameters += Array(feedIDs) as [Any]
parameters += [since] as [Any]
parameters += [since] as [Any]
@@ -407,8 +407,8 @@ final class ArticlesTable: DatabaseTable {
}
}
func fetchStarredAndUnreadCount(_ webFeedIDs: Set<String>, _ completion: @escaping SingleUnreadCountCompletionBlock) {
if webFeedIDs.isEmpty {
func fetchStarredAndUnreadCount(_ feedIDs: Set<String>, _ completion: @escaping SingleUnreadCountCompletionBlock) {
if feedIDs.isEmpty {
completion(.success(0))
return
}
@@ -416,9 +416,9 @@ final class ArticlesTable: DatabaseTable {
queue.runInDatabase { databaseResult in
func makeDatabaseCalls(_ database: FMDatabase) {
let placeholders = NSString.rs_SQLValueList(withPlaceholders: UInt(webFeedIDs.count))!
let placeholders = NSString.rs_SQLValueList(withPlaceholders: UInt(feedIDs.count))!
let sql = "select count(*) from articles natural join statuses where feedID in \(placeholders) and read=0 and starred=1;"
let parameters = Array(webFeedIDs) as [Any]
let parameters = Array(feedIDs) as [Any]
let unreadCount = self.numberWithSQLAndParameters(sql, parameters, in: database)
@@ -609,16 +609,16 @@ final class ArticlesTable: DatabaseTable {
/// Delete articles from feeds that are no longer in the current set of subscribed-to feeds.
/// This deletes from the articles and articleStatuses tables,
/// and, via a trigger, it also deletes from the search index.
func deleteArticlesNotInSubscribedToFeedIDs(_ webFeedIDs: Set<String>) {
if webFeedIDs.isEmpty {
func deleteArticlesNotInSubscribedToFeedIDs(_ feedIDs: Set<String>) {
if feedIDs.isEmpty {
return
}
queue.runInDatabase { databaseResult in
func makeDatabaseCalls(_ database: FMDatabase) {
let placeholders = NSString.rs_SQLValueList(withPlaceholders: UInt(webFeedIDs.count))!
let placeholders = NSString.rs_SQLValueList(withPlaceholders: UInt(feedIDs.count))!
let sql = "select articleID from articles where feedID not in \(placeholders);"
let parameters = Array(webFeedIDs) as [Any]
let parameters = Array(feedIDs) as [Any]
guard let resultSet = database.executeQuery(sql, withArgumentsIn: parameters) else {
return
}
@@ -820,24 +820,24 @@ private extension ArticlesTable {
return articlesWithResultSet(resultSet, database)
}
func fetchArticles(_ webFeedIDs: Set<String>, _ database: FMDatabase) -> Set<Article> {
func fetchArticles(_ feedIDs: Set<String>, _ database: FMDatabase) -> Set<Article> {
// select * from articles natural join statuses where feedID in ('http://ranchero.com/xml/rss.xml') and read=0
if webFeedIDs.isEmpty {
if feedIDs.isEmpty {
return Set<Article>()
}
let parameters = webFeedIDs.map { $0 as AnyObject }
let placeholders = NSString.rs_SQLValueList(withPlaceholders: UInt(webFeedIDs.count))!
let parameters = feedIDs.map { $0 as AnyObject }
let placeholders = NSString.rs_SQLValueList(withPlaceholders: UInt(feedIDs.count))!
let whereClause = "feedID in \(placeholders)"
return fetchArticlesWithWhereClause(database, whereClause: whereClause, parameters: parameters)
}
func fetchUnreadArticles(_ webFeedIDs: Set<String>, _ limit: Int?, _ database: FMDatabase) -> Set<Article> {
func fetchUnreadArticles(_ feedIDs: Set<String>, _ limit: Int?, _ database: FMDatabase) -> Set<Article> {
// select * from articles natural join statuses where feedID in ('http://ranchero.com/xml/rss.xml') and read=0
if webFeedIDs.isEmpty {
if feedIDs.isEmpty {
return Set<Article>()
}
let parameters = webFeedIDs.map { $0 as AnyObject }
let placeholders = NSString.rs_SQLValueList(withPlaceholders: UInt(webFeedIDs.count))!
let parameters = feedIDs.map { $0 as AnyObject }
let placeholders = NSString.rs_SQLValueList(withPlaceholders: UInt(feedIDs.count))!
var whereClause = "feedID in \(placeholders) and read=0"
if let limit = limit {
whereClause.append(" order by coalesce(datePublished, dateModified, dateArrived) desc limit \(limit)")
@@ -845,8 +845,8 @@ private extension ArticlesTable {
return fetchArticlesWithWhereClause(database, whereClause: whereClause, parameters: parameters)
}
func fetchArticlesForFeedID(_ webFeedID: String, _ database: FMDatabase) -> Set<Article> {
return fetchArticlesWithWhereClause(database, whereClause: "articles.feedID = ?", parameters: [webFeedID as AnyObject])
func fetchArticlesForFeedID(_ feedID: String, _ database: FMDatabase) -> Set<Article> {
return fetchArticlesWithWhereClause(database, whereClause: "articles.feedID = ?", parameters: [feedID as AnyObject])
}
func fetchArticles(articleIDs: Set<String>, _ database: FMDatabase) -> Set<Article> {
@@ -859,15 +859,15 @@ private extension ArticlesTable {
return fetchArticlesWithWhereClause(database, whereClause: whereClause, parameters: parameters)
}
func fetchArticlesSince(_ webFeedIDs: Set<String>, _ cutoffDate: Date, _ limit: Int?, _ database: FMDatabase) -> Set<Article> {
func fetchArticlesSince(_ feedIDs: Set<String>, _ cutoffDate: Date, _ limit: Int?, _ database: FMDatabase) -> Set<Article> {
// select * from articles natural join statuses where feedID in ('http://ranchero.com/xml/rss.xml') and (datePublished > ? || (datePublished is null and dateArrived > ?)
//
// datePublished may be nil, so we fall back to dateArrived.
if webFeedIDs.isEmpty {
if feedIDs.isEmpty {
return Set<Article>()
}
let parameters = webFeedIDs.map { $0 as AnyObject } + [cutoffDate as AnyObject, cutoffDate as AnyObject]
let placeholders = NSString.rs_SQLValueList(withPlaceholders: UInt(webFeedIDs.count))!
let parameters = feedIDs.map { $0 as AnyObject } + [cutoffDate as AnyObject, cutoffDate as AnyObject]
let placeholders = NSString.rs_SQLValueList(withPlaceholders: UInt(feedIDs.count))!
var whereClause = "feedID in \(placeholders) and (datePublished > ? or (datePublished is null and dateArrived > ?))"
if let limit = limit {
whereClause.append(" order by coalesce(datePublished, dateModified, dateArrived) desc limit \(limit)")
@@ -875,13 +875,13 @@ private extension ArticlesTable {
return fetchArticlesWithWhereClause(database, whereClause: whereClause, parameters: parameters)
}
func fetchStarredArticles(_ webFeedIDs: Set<String>, _ limit: Int?, _ database: FMDatabase) -> Set<Article> {
func fetchStarredArticles(_ feedIDs: Set<String>, _ limit: Int?, _ database: FMDatabase) -> Set<Article> {
// select * from articles natural join statuses where feedID in ('http://ranchero.com/xml/rss.xml') and starred=1;
if webFeedIDs.isEmpty {
if feedIDs.isEmpty {
return Set<Article>()
}
let parameters = webFeedIDs.map { $0 as AnyObject }
let placeholders = NSString.rs_SQLValueList(withPlaceholders: UInt(webFeedIDs.count))!
let parameters = feedIDs.map { $0 as AnyObject }
let placeholders = NSString.rs_SQLValueList(withPlaceholders: UInt(feedIDs.count))!
var whereClause = "feedID in \(placeholders) and starred=1"
if let limit = limit {
whereClause.append(" order by coalesce(datePublished, dateModified, dateArrived) desc limit \(limit)")
@@ -889,21 +889,21 @@ private extension ArticlesTable {
return fetchArticlesWithWhereClause(database, whereClause: whereClause, parameters: parameters)
}
func fetchStarredArticlesCount(_ webFeedIDs: Set<String>, _ database: FMDatabase) -> Int {
func fetchStarredArticlesCount(_ feedIDs: Set<String>, _ database: FMDatabase) -> Int {
// select count from articles natural join statuses where feedID in ('http://ranchero.com/xml/rss.xml') and starred=1;
if webFeedIDs.isEmpty {
if feedIDs.isEmpty {
return 0
}
let parameters = webFeedIDs.map { $0 as AnyObject }
let placeholders = NSString.rs_SQLValueList(withPlaceholders: UInt(webFeedIDs.count))!
let parameters = feedIDs.map { $0 as AnyObject }
let placeholders = NSString.rs_SQLValueList(withPlaceholders: UInt(feedIDs.count))!
let whereClause = "feedID in \(placeholders) and starred=1"
return fetchArticleCountsWithWhereClause(database, whereClause: whereClause, parameters: parameters)
}
func fetchArticlesMatching(_ searchString: String, _ webFeedIDs: Set<String>, _ database: FMDatabase) -> Set<Article> {
func fetchArticlesMatching(_ searchString: String, _ feedIDs: Set<String>, _ database: FMDatabase) -> Set<Article> {
let articles = fetchArticlesMatching(searchString, database)
// TODO: include the feedIDs in the SQL rather than filtering here.
return articles.filter{ webFeedIDs.contains($0.feedID) }
return articles.filter{ feedIDs.contains($0.feedID) }
}
func fetchArticlesMatchingWithArticleIDs(_ searchString: String, _ articleIDs: Set<String>, _ database: FMDatabase) -> Set<Article> {
@@ -42,7 +42,7 @@ extension Article {
self.init(accountID: accountID, articleID: articleID, feedID: feedID, uniqueID: uniqueID, title: title, contentHTML: contentHTML, contentText: contentText, markdown: markdown, url: url, externalURL: externalURL, summary: summary, imageURL: imageURL, datePublished: datePublished, dateModified: dateModified, authors: nil, status: status)
}
convenience init(parsedItem: ParsedItem, maximumDateAllowed: Date, accountID: String, webFeedID: String, status: ArticleStatus) {
convenience init(parsedItem: ParsedItem, maximumDateAllowed: Date, accountID: String, feedID: String, status: ArticleStatus) {
let authors = Author.authorsWithParsedAuthors(parsedItem.authors)
// Deal with future datePublished and dateModified dates.
@@ -59,7 +59,7 @@ extension Article {
dateModified = nil
}
self.init(accountID: accountID, articleID: parsedItem.syncServiceID, feedID: webFeedID, uniqueID: parsedItem.uniqueID, title: parsedItem.title, contentHTML: parsedItem.contentHTML, contentText: parsedItem.contentText, markdown: parsedItem.markdown, url: parsedItem.url, externalURL: parsedItem.externalURL, summary: parsedItem.summary, imageURL: parsedItem.imageURL, datePublished: datePublished, dateModified: dateModified, authors: authors, status: status)
self.init(accountID: accountID, articleID: parsedItem.syncServiceID, feedID: feedID, uniqueID: parsedItem.uniqueID, title: parsedItem.title, contentHTML: parsedItem.contentHTML, contentText: parsedItem.contentText, markdown: parsedItem.markdown, url: parsedItem.url, externalURL: parsedItem.externalURL, summary: parsedItem.summary, imageURL: parsedItem.imageURL, datePublished: datePublished, dateModified: dateModified, authors: authors, status: status)
}
private func addPossibleStringChangeWithKeyPath(_ comparisonKeyPath: KeyPath<Article,String?>, _ otherArticle: Article, _ key: String, _ dictionary: inout DatabaseDictionary) {
@@ -118,13 +118,13 @@ extension Article {
return Date().addingTimeInterval(60 * 60 * 24) // Allow dates up to about 24 hours ahead of now
}
static func articlesWithWebFeedIDsAndItems(_ webFeedIDsAndItems: [String: Set<ParsedItem>], _ accountID: String, _ statusesDictionary: [String: ArticleStatus]) -> Set<Article> {
static func articlesWithFeedIDsAndItems(_ feedIDsAndItems: [String: Set<ParsedItem>], _ accountID: String, _ statusesDictionary: [String: ArticleStatus]) -> Set<Article> {
let maximumDateAllowed = _maximumDateAllowed()
var feedArticles = Set<Article>()
for (webFeedID, parsedItems) in webFeedIDsAndItems {
for (feedID, parsedItems) in feedIDsAndItems {
for parsedItem in parsedItems {
let status = statusesDictionary[parsedItem.articleID]!
let article = Article(parsedItem: parsedItem, maximumDateAllowed: maximumDateAllowed, accountID: accountID, webFeedID: webFeedID, status: status)
let article = Article(parsedItem: parsedItem, maximumDateAllowed: maximumDateAllowed, accountID: accountID, feedID: feedID, status: status)
feedArticles.insert(article)
}
}
@@ -133,7 +133,7 @@ extension Article {
static func articlesWithParsedItems(_ parsedItems: Set<ParsedItem>, _ webFeedID: String, _ accountID: String, _ statusesDictionary: [String: ArticleStatus]) -> Set<Article> {
let maximumDateAllowed = _maximumDateAllowed()
return Set(parsedItems.map{ Article(parsedItem: $0, maximumDateAllowed: maximumDateAllowed, accountID: accountID, webFeedID: webFeedID, status: statusesDictionary[$0.articleID]!) })
return Set(parsedItems.map{ Article(parsedItem: $0, maximumDateAllowed: maximumDateAllowed, accountID: accountID, feedID: webFeedID, status: statusesDictionary[$0.articleID]!) })
}
}
+1 -1
View File
@@ -92,7 +92,7 @@ final class AddFeedViewController: UITableViewController {
account = containerAccount
}
if account!.hasWebFeed(withURL: url.absoluteString) {
if account!.hasFeed(withURL: url.absoluteString) {
presentError(AccountError.createErrorAlreadySubscribed)
return
}
@@ -86,7 +86,7 @@ extension MainFeedCollectionViewController: UICollectionViewDropDelegate {
if destAccount.behaviors.contains(.disallowFeedInMultipleFolders),
let sourceNode = session.localDragSession?.items.first?.localObject as? Node,
let sourceWebFeed = sourceNode.representedObject as? Feed,
sourceWebFeed.account?.accountID != destAccount.accountID && destAccount.hasWebFeed(withURL: sourceWebFeed.url) {
sourceWebFeed.account?.accountID != destAccount.accountID && destAccount.hasFeed(withURL: sourceWebFeed.url) {
return UICollectionViewDropProposal(operation: .forbidden)
}
@@ -657,10 +657,10 @@ class MainFeedCollectionViewController: UICollectionViewController, UndoableComm
}
@objc func webFeedSettingDidChange(_ note: Notification) {
guard let webFeed = note.object as? Feed, let key = note.userInfo?[Feed.WebFeedSettingUserInfoKey] as? String else {
guard let webFeed = note.object as? Feed, let key = note.userInfo?[Feed.SettingUserInfoKey] as? String else {
return
}
if key == Feed.WebFeedSettingKey.homePageURL || key == Feed.WebFeedSettingKey.faviconURL {
if key == Feed.SettingKey.homePageURL || key == Feed.SettingKey.faviconURL {
configureCellsForRepresentedObject(webFeed)
}
}
+1 -1
View File
@@ -2127,7 +2127,7 @@ private extension SceneCoordinator {
}
} else if let folder = timelineFeed as? Folder {
for oneFeed in feeds {
if folder.hasWebFeed(with: oneFeed.webFeedID) || folder.hasWebFeed(withURL: oneFeed.url) {
if folder.hasFeed(with: oneFeed.webFeedID) || folder.hasFeed(withURL: oneFeed.url) {
return true
}
}