This commit is contained in:
Maurice Parker 2019-08-03 13:25:05 -05:00
commit 53e6af8bf3
1 changed files with 7 additions and 7 deletions

View File

@ -89,17 +89,17 @@ class ScriptableFeed: NSObject, UniqueIdScriptingObject, ScriptingObjectContaine
guard let url = self.urlForNewFeed(arguments:arguments) else {return nil} guard let url = self.urlForNewFeed(arguments:arguments) else {return nil}
if let existingFeed = account.existingFeed(withURL:url) { if let existingFeed = account.existingFeed(withURL:url) {
return self.scriptableFeed(existingFeed, account:account, folder:folder) return scriptableFeed(existingFeed, account:account, folder:folder).objectSpecifier
} }
let container: Container = folder != nil ? folder! : account let container: Container = folder != nil ? folder! : account
// at this point, we need to download the feed and parse it. // We need to download the feed and parse it.
// RS Parser does the callback for the download on the main thread (which it probably shouldn't?) // RSParser does the callback for the download on the main thread.
// because we can't wait here (on the main thread, maybe) for the callback, we have to return from this function // Because we can't wait here (on the main thread) for the callback, we have to return from this function.
// Generally, returning from an AppleEvent handler function means that handling the appleEvent is over, // Generally, returning from an AppleEvent handler function means that handling the Apple event is over,
// but we don't yet have the result of the event yet, so we prevent the AppleEvent from returning by calling // but we dont yet have the result of the event yet, so we prevent the Apple event from returning by calling
// suspendExecution(). When we get the callback, we can supply the event result and call resumeExecution() // suspendExecution(). When we get the callback, we supply the event result and call resumeExecution().
command.suspendExecution() command.suspendExecution()
account.createFeed(url: url, name: titleFromArgs, container: container) { result in account.createFeed(url: url, name: titleFromArgs, container: container) { result in