Rename deleteFeed to removeFeed to be more consistent with other API's
This commit is contained in:
parent
527e677934
commit
51284b5aa4
@ -377,11 +377,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func addFeed(_ feed: Feed, to container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
|
public func addFeed(_ feed: Feed, to container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
|
||||||
delegate.addFeed(for: self, to: container, with: feed, completion: completion)
|
delegate.addFeed(for: self, with: feed, to: container, completion: completion)
|
||||||
}
|
|
||||||
|
|
||||||
public func removeFeed(_ feed: Feed, from container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
|
|
||||||
delegate.removeFeed(for: self, from: container, with: feed, completion: completion)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public func createFeed(url: String, name: String?, container: Container, completion: @escaping (Result<Feed, Error>) -> Void) {
|
public func createFeed(url: String, name: String?, container: Container, completion: @escaping (Result<Feed, Error>) -> Void) {
|
||||||
@ -399,9 +395,9 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public func deleteFeed(_ feed: Feed, from container: Container?, completion: @escaping (Result<Void, Error>) -> Void) {
|
public func removeFeed(_ feed: Feed, from container: Container?, completion: @escaping (Result<Void, Error>) -> Void) {
|
||||||
feedMetadata[feed.url] = nil
|
feedMetadata[feed.url] = nil
|
||||||
delegate.deleteFeed(for: self, with: feed, from: container, completion: completion)
|
delegate.removeFeed(for: self, with: feed, from: container, completion: completion)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func renameFeed(_ feed: Feed, to name: String, completion: @escaping (Result<Void, Error>) -> Void) {
|
public func renameFeed(_ feed: Feed, to name: String, completion: @escaping (Result<Void, Error>) -> Void) {
|
||||||
|
@ -34,10 +34,9 @@ protocol AccountDelegate {
|
|||||||
|
|
||||||
func createFeed(for account: Account, url: String, name: String?, container: Container, completion: @escaping (Result<Feed, Error>) -> Void)
|
func createFeed(for account: Account, url: String, name: String?, container: Container, completion: @escaping (Result<Feed, Error>) -> Void)
|
||||||
func renameFeed(for account: Account, with feed: Feed, to name: String, completion: @escaping (Result<Void, Error>) -> Void)
|
func renameFeed(for account: Account, with feed: Feed, to name: String, completion: @escaping (Result<Void, Error>) -> Void)
|
||||||
func deleteFeed(for account: Account, with feed: Feed, from container: Container?, completion: @escaping (Result<Void, Error>) -> Void)
|
func addFeed(for account: Account, with: Feed, to container: Container, completion: @escaping (Result<Void, Error>) -> Void)
|
||||||
|
func removeFeed(for account: Account, with feed: Feed, from container: Container?, completion: @escaping (Result<Void, Error>) -> Void)
|
||||||
|
|
||||||
func addFeed(for account: Account, to container: Container, with: Feed, completion: @escaping (Result<Void, Error>) -> Void)
|
|
||||||
func removeFeed(for account: Account, from container: Container, with: Feed, completion: @escaping (Result<Void, Error>) -> Void)
|
|
||||||
|
|
||||||
func restoreFeed(for account: Account, feed: Feed, container: Container, completion: @escaping (Result<Void, Error>) -> Void)
|
func restoreFeed(for account: Account, feed: Feed, container: Container, completion: @escaping (Result<Void, Error>) -> Void)
|
||||||
func restoreFolder(for account: Account, folder: Folder, completion: @escaping (Result<Void, Error>) -> Void)
|
func restoreFolder(for account: Account, folder: Folder, completion: @escaping (Result<Void, Error>) -> Void)
|
||||||
|
@ -340,7 +340,7 @@ final class FeedbinAccountDelegate: AccountDelegate {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func deleteFeed(for account: Account, with feed: Feed, from container: Container?, completion: @escaping (Result<Void, Error>) -> Void) {
|
func removeFeed(for account: Account, with feed: Feed, from container: Container?, completion: @escaping (Result<Void, Error>) -> Void) {
|
||||||
|
|
||||||
// This error should never happen
|
// This error should never happen
|
||||||
guard let subscriptionID = feed.subscriptionID else {
|
guard let subscriptionID = feed.subscriptionID else {
|
||||||
@ -370,7 +370,7 @@ final class FeedbinAccountDelegate: AccountDelegate {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func addFeed(for account: Account, to container: Container, with feed: Feed, completion: @escaping (Result<Void, Error>) -> Void) {
|
func addFeed(for account: Account, with feed: Feed, to container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
|
||||||
|
|
||||||
if let folder = container as? Folder, let feedID = Int(feed.feedID) {
|
if let folder = container as? Folder, let feedID = Int(feed.feedID) {
|
||||||
caller.createTagging(feedID: feedID, name: folder.name ?? "") { result in
|
caller.createTagging(feedID: feedID, name: folder.name ?? "") { result in
|
||||||
@ -448,7 +448,7 @@ final class FeedbinAccountDelegate: AccountDelegate {
|
|||||||
for feed in folder.topLevelFeeds {
|
for feed in folder.topLevelFeeds {
|
||||||
|
|
||||||
group.enter()
|
group.enter()
|
||||||
addFeed(for: account, to: folder, with: feed) { result in
|
addFeed(for: account, with: feed, to: folder) { result in
|
||||||
if account.topLevelFeeds.contains(feed) {
|
if account.topLevelFeeds.contains(feed) {
|
||||||
account.removeFeed(feed)
|
account.removeFeed(feed)
|
||||||
}
|
}
|
||||||
|
@ -122,21 +122,16 @@ final class LocalAccountDelegate: AccountDelegate {
|
|||||||
completion(.success(()))
|
completion(.success(()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func deleteFeed(for account: Account, with feed: Feed, from container: Container?, completion: @escaping (Result<Void, Error>) -> Void) {
|
func removeFeed(for account: Account, with feed: Feed, from container: Container?, completion: @escaping (Result<Void, Error>) -> Void) {
|
||||||
container?.removeFeed(feed)
|
container?.removeFeed(feed)
|
||||||
completion(.success(()))
|
completion(.success(()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func addFeed(for account: Account, to container: Container, with feed: Feed, completion: @escaping (Result<Void, Error>) -> Void) {
|
func addFeed(for account: Account, with feed: Feed, to container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
|
||||||
container.addFeed(feed)
|
container.addFeed(feed)
|
||||||
completion(.success(()))
|
completion(.success(()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeFeed(for account: Account, from container: Container, with feed: Feed, completion: @escaping (Result<Void, Error>) -> Void) {
|
|
||||||
container.removeFeed(feed)
|
|
||||||
completion(.success(()))
|
|
||||||
}
|
|
||||||
|
|
||||||
func restoreFeed(for account: Account, feed: Feed, container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
|
func restoreFeed(for account: Account, feed: Feed, container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
|
||||||
if let folder = container as? Folder {
|
if let folder = container as? Folder {
|
||||||
folder.addFeed(feed)
|
folder.addFeed(feed)
|
||||||
|
@ -368,7 +368,7 @@ private extension SidebarOutlineDataSource {
|
|||||||
destinationAccount.addFeed(existingFeed, to: destinationContainer) { result in
|
destinationAccount.addFeed(existingFeed, to: destinationContainer) { result in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
sourceAccount.deleteFeed(feed, from: sourceContainer) { result in
|
sourceAccount.removeFeed(feed, from: sourceContainer) { result in
|
||||||
BatchUpdate.shared.end()
|
BatchUpdate.shared.end()
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
@ -388,7 +388,7 @@ private extension SidebarOutlineDataSource {
|
|||||||
destinationAccount.createFeed(url: feed.url, name: feed.editedName, container: destinationContainer) { result in
|
destinationAccount.createFeed(url: feed.url, name: feed.editedName, container: destinationContainer) { result in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
sourceAccount.deleteFeed(feed, from: sourceContainer) { result in
|
sourceAccount.removeFeed(feed, from: sourceContainer) { result in
|
||||||
BatchUpdate.shared.end()
|
BatchUpdate.shared.end()
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
|
@ -59,7 +59,7 @@ class ScriptableAccount: NSObject, UniqueIdScriptingObject, ScriptingObjectConta
|
|||||||
if let scriptableFolder = scriptableFeed.container as? ScriptableFolder {
|
if let scriptableFolder = scriptableFeed.container as? ScriptableFolder {
|
||||||
container = scriptableFolder.folder
|
container = scriptableFolder.folder
|
||||||
}
|
}
|
||||||
account.deleteFeed(scriptableFeed.feed, from: container) { result in
|
account.removeFeed(scriptableFeed.feed, from: container) { result in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ class ScriptableFolder: NSObject, UniqueIdScriptingObject, ScriptingObjectContai
|
|||||||
func deleteElement(_ element:ScriptingObject) {
|
func deleteElement(_ element:ScriptingObject) {
|
||||||
if let scriptableFeed = element as? ScriptableFeed {
|
if let scriptableFeed = element as? ScriptableFeed {
|
||||||
BatchUpdate.shared.perform {
|
BatchUpdate.shared.perform {
|
||||||
folder.account?.deleteFeed(scriptableFeed.feed, from: folder) { result in }
|
folder.account?.removeFeed(scriptableFeed.feed, from: folder) { result in }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ private struct SidebarItemSpecifier {
|
|||||||
|
|
||||||
if let feed = feed {
|
if let feed = feed {
|
||||||
BatchUpdate.shared.start()
|
BatchUpdate.shared.start()
|
||||||
account?.deleteFeed(feed, from: path.resolveContainer()) { result in
|
account?.removeFeed(feed, from: path.resolveContainer()) { result in
|
||||||
BatchUpdate.shared.end()
|
BatchUpdate.shared.end()
|
||||||
self.checkResult(result)
|
self.checkResult(result)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user