Rename deleteFolder to removeFolder to make the API more consistent

This commit is contained in:
Maurice Parker 2019-05-29 20:53:00 -05:00
parent f4bc17c8f1
commit 527e677934
6 changed files with 12 additions and 12 deletions

View File

@ -412,8 +412,8 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
delegate.restoreFeed(for: self, feed: feed, container: container, completion: completion) delegate.restoreFeed(for: self, feed: feed, container: container, completion: completion)
} }
public func deleteFolder(_ folder: Folder, completion: @escaping (Result<Void, Error>) -> Void) { public func removeFolder(_ folder: Folder, completion: @escaping (Result<Void, Error>) -> Void) {
delegate.deleteFolder(for: self, with: folder, completion: completion) delegate.removeFolder(for: self, with: folder, completion: completion)
} }
public func renameFolder(_ folder: Folder, to name: String, completion: @escaping (Result<Void, Error>) -> Void) { public func renameFolder(_ folder: Folder, to name: String, completion: @escaping (Result<Void, Error>) -> Void) {
@ -680,7 +680,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
} }
} }
func deleteFolder(_ folder: Folder) { func removeFolder(_ folder: Folder) {
folders?.remove(folder) folders?.remove(folder)
structureDidChange() structureDidChange()
postChildrenDidChangeNotification() postChildrenDidChangeNotification()

View File

@ -30,7 +30,7 @@ protocol AccountDelegate {
func importOPML(for account:Account, opmlFile: URL, completion: @escaping (Result<Void, Error>) -> Void) func importOPML(for account:Account, opmlFile: URL, completion: @escaping (Result<Void, Error>) -> Void)
func renameFolder(for account: Account, with folder: Folder, to name: String, completion: @escaping (Result<Void, Error>) -> Void) func renameFolder(for account: Account, with folder: Folder, to name: String, completion: @escaping (Result<Void, Error>) -> Void)
func deleteFolder(for account: Account, with folder: Folder, completion: @escaping (Result<Void, Error>) -> Void) func removeFolder(for account: Account, with folder: Folder, completion: @escaping (Result<Void, Error>) -> Void)
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)

View File

@ -250,11 +250,11 @@ final class FeedbinAccountDelegate: AccountDelegate {
} }
func deleteFolder(for account: Account, with folder: Folder, completion: @escaping (Result<Void, Error>) -> Void) { 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 // Feedbin uses tags and if at least one feed isn't tagged, then the folder doesn't exist on their system
guard folder.hasAtLeastOneFeed() else { guard folder.hasAtLeastOneFeed() else {
account.deleteFolder(folder) account.removeFolder(folder)
return return
} }
@ -270,7 +270,7 @@ final class FeedbinAccountDelegate: AccountDelegate {
account.addFeed(feed) account.addFeed(feed)
self.clearFolderRelationship(for: feed, withFolderName: folder.name ?? "") self.clearFolderRelationship(for: feed, withFolderName: folder.name ?? "")
} }
account.deleteFolder(folder) account.removeFolder(folder)
} }
completion(.success(())) completion(.success(()))
} }
@ -570,7 +570,7 @@ private extension FeedbinAccountDelegate {
account.addFeed(feed) account.addFeed(feed)
clearFolderRelationship(for: feed, withFolderName: folder.name ?? "") clearFolderRelationship(for: feed, withFolderName: folder.name ?? "")
} }
account.deleteFolder(folder) account.removeFolder(folder)
} }
} }
} }

View File

@ -97,8 +97,8 @@ final class LocalAccountDelegate: AccountDelegate {
completion(.success(())) completion(.success(()))
} }
func deleteFolder(for account: Account, with folder: Folder, completion: @escaping (Result<Void, Error>) -> Void) { func removeFolder(for account: Account, with folder: Folder, completion: @escaping (Result<Void, Error>) -> Void) {
account.deleteFolder(folder) account.removeFolder(folder)
completion(.success(())) completion(.success(()))
} }

View File

@ -50,7 +50,7 @@ class ScriptableAccount: NSObject, UniqueIdScriptingObject, ScriptingObjectConta
func deleteElement(_ element:ScriptingObject) { func deleteElement(_ element:ScriptingObject) {
if let scriptableFolder = element as? ScriptableFolder { if let scriptableFolder = element as? ScriptableFolder {
BatchUpdate.shared.perform { BatchUpdate.shared.perform {
account.deleteFolder(scriptableFolder.folder) { result in account.removeFolder(scriptableFolder.folder) { result in
} }
} }
} else if let scriptableFeed = element as? ScriptableFeed { } else if let scriptableFeed = element as? ScriptableFeed {

View File

@ -142,7 +142,7 @@ private struct SidebarItemSpecifier {
} }
} else if let folder = folder { } else if let folder = folder {
BatchUpdate.shared.start() BatchUpdate.shared.start()
account?.deleteFolder(folder) { result in account?.removeFolder(folder) { result in
BatchUpdate.shared.end() BatchUpdate.shared.end()
self.checkResult(result) self.checkResult(result)
} }