Use correct account method for adding folders
This commit is contained in:
parent
3464fbfc7f
commit
6536dbf2a5
|
@ -426,7 +426,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
|||
}
|
||||
|
||||
@discardableResult
|
||||
public func ensureFolder(with name: String) -> Folder? {
|
||||
func ensureFolder(with name: String) -> Folder? {
|
||||
// TODO: support subfolders, maybe, some day
|
||||
|
||||
if name.isEmpty {
|
||||
|
|
|
@ -72,7 +72,15 @@ class AddFolderWindowController : NSWindowController {
|
|||
return
|
||||
}
|
||||
|
||||
account.ensureFolder(with: folderName)
|
||||
account.addFolder(folderName) { result in
|
||||
switch result {
|
||||
case .success:
|
||||
break
|
||||
case .failure(let error):
|
||||
NSApplication.shared.presentError(error)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: Actions
|
||||
|
|
|
@ -76,11 +76,20 @@ class ScriptableFolder: NSObject, UniqueIdScriptingObject, ScriptingObjectContai
|
|||
print("support for folders within folders is NYI");
|
||||
return nil
|
||||
}
|
||||
let scriptableAccount = ScriptableAccount(account)
|
||||
if let newFolder = account.ensureFolder(with:name) {
|
||||
let scriptableFolder = ScriptableFolder(newFolder, container:scriptableAccount)
|
||||
return(scriptableFolder.objectSpecifier)
|
||||
}
|
||||
|
||||
command.suspendExecution()
|
||||
|
||||
account.addFolder(name) { result in
|
||||
switch result {
|
||||
case .success(let folder):
|
||||
let scriptableAccount = ScriptableAccount(account)
|
||||
let scriptableFolder = ScriptableFolder(folder, container:scriptableAccount)
|
||||
command.resumeExecution(withResult:scriptableFolder.objectSpecifier)
|
||||
case .failure:
|
||||
command.resumeExecution(withResult:nil)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,16 @@
|
|||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "849C64701ED37A5D003D8FC0"
|
||||
BuildableName = "NetNewsWireTests.xctest"
|
||||
BlueprintName = "NetNewsWireTests"
|
||||
ReferencedContainer = "container:NetNewsWire.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
|
|
Loading…
Reference in New Issue