A couple of days ago, Greg Pierce released a new update to Drafts. The 3.5.4 update has a quick fix for text encoding bug found in the previous update. What makes the previous 3.5.3 update a noteworthy one is the new
allowEmpty=[YES/NO] parameter for executing incoming URLs.
Incoming URL is a way for Drafts and other apps to create a new draft, execute a named action, or import a new custom action in Drafts. I've been using it to perform recursive invocations on custom URL actions. My earliest example was adding multiple events in Fantastical, which dated back in April.
Unfortunately, the September's 3.5 update included a feature that conflicts with the recursive hacks I've been using. The new feature allows you to run actions on an empty draft, regardless whether it's manually triggered or triggered by an incoming URL. This forced me to come up with a workaround that removed the
x-cancel parameter as the only way to stop the infinite loop when the other app doesn't prompt you whether you want to continue or not.
I've also come up with another workaround that uses a runtime value, instead of a predefined value, for the
action parameter. This allows recursive actions that only involve Drafts to stop when it encounters a blank action name. It's great for triggering multiple built-in Drafts actions with a single draft, or for importing a batch of URL actions recursively.
allowEmpty=[YES/NO] parameter solves this recursive problem. Because most recursive invocations are incoming URLs, we can set the
allowEmpty parameter to
NO. This stops the recursive invocation whenever it encounters an empty draft. It also frees us to use
x-cancel parameter the way we want to, whether we want to cancel and return, or cancel and continue.
The perfect example for this update is the first example that started this recursive hack in the first place: adding multiple events in Fantastical. It was Fantastical's 1.1.1 update with x-callback-url that started it all. And with the new Fantastical 2 released yesterday, it's only appropriate if I update it with the new
fantastical2:// URL Scheme.