mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Fix lint issues.
This commit is contained in:
@@ -10,43 +10,43 @@ import Foundation
|
||||
import Account
|
||||
|
||||
extension NSScriptCommand {
|
||||
func property(forKey key:String) -> Any? {
|
||||
if let evaluatedArguments = self.evaluatedArguments {
|
||||
func property(forKey key: String) -> Any? {
|
||||
if let evaluatedArguments = self.evaluatedArguments {
|
||||
if let props = evaluatedArguments["KeyDictionary"] as? [String: Any] {
|
||||
return props[key]
|
||||
return props[key]
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func isCreateCommand(forClass whatClass:String) -> Bool {
|
||||
|
||||
func isCreateCommand(forClass whatClass: String) -> Bool {
|
||||
guard let arguments = self.arguments else {return false}
|
||||
guard let newObjectClass = arguments["ObjectClass"] as? Int else {return false}
|
||||
guard (newObjectClass.fourCharCode == whatClass.fourCharCode) else {return false}
|
||||
guard newObjectClass.fourCharCode == whatClass.fourCharCode else {return false}
|
||||
return true
|
||||
}
|
||||
|
||||
func accountAndFolderForNewChild() -> (Account, Folder?) {
|
||||
let appleEvent = self.appleEvent
|
||||
var account = AccountManager.shared.defaultAccount
|
||||
var folder:Folder? = nil
|
||||
var folder: Folder?
|
||||
if let appleEvent = appleEvent {
|
||||
var descriptorToConsider:NSAppleEventDescriptor?
|
||||
if let insertionLocationDescriptor = appleEvent.paramDescriptor(forKeyword:keyAEInsertHere) {
|
||||
var descriptorToConsider: NSAppleEventDescriptor?
|
||||
if let insertionLocationDescriptor = appleEvent.paramDescriptor(forKeyword: keyAEInsertHere) {
|
||||
print("insertionLocation : \(insertionLocationDescriptor)")
|
||||
// insertion location can be a typeObjectSpecifier, e.g. 'in account "Acct"'
|
||||
// or a typeInsertionLocation, e.g. 'at end of folder "
|
||||
if (insertionLocationDescriptor.descriptorType == "insl".fourCharCode) {
|
||||
if insertionLocationDescriptor.descriptorType == "insl".fourCharCode {
|
||||
descriptorToConsider = insertionLocationDescriptor.forKeyword("kobj".fourCharCode)
|
||||
} else if ( insertionLocationDescriptor.descriptorType == "obj ".fourCharCode) {
|
||||
} else if insertionLocationDescriptor.descriptorType == "obj ".fourCharCode {
|
||||
descriptorToConsider = insertionLocationDescriptor
|
||||
}
|
||||
} else if let subjectDescriptor = appleEvent.attributeDescriptor(forKeyword:"subj".fourCharCode) {
|
||||
} else if let subjectDescriptor = appleEvent.attributeDescriptor(forKeyword: "subj".fourCharCode) {
|
||||
descriptorToConsider = subjectDescriptor
|
||||
}
|
||||
|
||||
|
||||
if let descriptorToConsider = descriptorToConsider {
|
||||
guard let newContainerSpecifier = NSScriptObjectSpecifier(descriptor:descriptorToConsider) else {return (account, folder)}
|
||||
guard let newContainerSpecifier = NSScriptObjectSpecifier(descriptor: descriptorToConsider) else {return (account, folder)}
|
||||
let newContainer = newContainerSpecifier.objectsByEvaluatingSpecifier
|
||||
if let scriptableAccount = newContainer as? ScriptableAccount {
|
||||
account = scriptableAccount.account
|
||||
|
||||
Reference in New Issue
Block a user