mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-02-03 12:27:32 +01:00
Implement ensureFolder — it actually creates and adds a folder and makes sure account is saved to disk.
This commit is contained in:
parent
31947854c0
commit
2383ecd480
@ -68,7 +68,7 @@ class AddFolderWindowController : NSWindowController {
|
||||
return
|
||||
}
|
||||
|
||||
let _ = account.ensureFolder(with: folderName)
|
||||
account.ensureFolder(with: folderName)
|
||||
}
|
||||
|
||||
// MARK: Actions
|
||||
|
@ -175,9 +175,24 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
||||
noteStatusesForArticlesDidChange(updatedArticles)
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
public func ensureFolder(with name: String) -> Folder? {
|
||||
|
||||
return nil //TODO
|
||||
// TODO: support subfolders, maybe, some day
|
||||
|
||||
if name.isEmpty {
|
||||
return nil
|
||||
}
|
||||
|
||||
if let folder = existingFolder(with: name) {
|
||||
return folder
|
||||
}
|
||||
|
||||
let folder = Folder(account: self, name: name)
|
||||
children += [folder]
|
||||
dirty = true
|
||||
|
||||
return folder
|
||||
}
|
||||
|
||||
public func canAddFeed(_ feed: Feed, to folder: Folder?) -> Bool {
|
||||
|
Loading…
x
Reference in New Issue
Block a user