Using 1Writer and Launch Center Pro to Create the Missing Dropbox Sync Feature in Drafts

I love writing in Drafts on my iPhone, even for longer posts. Writing in Drafts is a part of my daily workflow. Sometimes I start writing a new post in it, but oftentimes I'd start a new post on iA Writer on the Mac and continue writing in Drafts on my iPhone.

Writing on the iPhone allows me to work almost anywhere and anytime. The problems with writing on the iPhone are the internet connection and battery limitations. Turning off 3G allows me to save the battery - which in turn allows me to write for a longer period. On the other hand, it disables me from getting a real-time Dropbox syncing that apps like iA Writer and Byword offer. Even when I turn on the internet connection, most apps would try to sync the entire folder before letting me load the single file that I want to edit.

That's why I loved it when Drafts 3.5 introduced Import from Dropbox feature. It allows me to pick a file that I want to edit, load it in Drafts, and continue writing - without having to sync the entire folder nor keeping the internet connection alive at all times. With the release of Launch Center Pro 2.0, I created an action that allows me to pick the file and load its contents to Drafts without even switching to the Dropbox app.

The other problem with writing in Drafts is the lack of Dropbox sync support. Drafts has the feature to create a new file and prepend/append to an existing file; but not to replace the content of a file in your Dropbox. After a short research, I found at least three apps that support Dropbox's replace file content feature in their URL Schemes: Byword, Textastic, and 1Writer.

I have tried using Byword's URL Scheme, but I can't seem to make it replace the old file. Instead, it creates a new file each time I trigger its /replace URL. I haven't tried Textastic's URL Scheme, so I don't know whether it's going to work or not. But, I have tried 1Writer's /replace URL and it worked as I expected it to be.

1Writer uses a shorter name, instead of the full path name, of mapped Dropbox folders.

1Writer's /replace URL

I ended up creating a 1Writer URL that allows me to replace the content of a file in a Dropbox folder with the content of the current [[draft]]. The action is relatively straightforward, with two minor things that you need to do. First, you need to define the Dropbox folders that you will be referring to in 1Writer. Once a folder mapped in 1Writer, it may have a name that you can refer to - which can be different from the full path of that folder. For example, 1Writer may use "Meeting Notes" instead of the full "Apps/Meeting Notes" path.

Second, you need to provide that 1Writer's mapped folder name and the file name as parameters to 1Writer - before it can properly replace/sync the correct file. To make it easier, I use Launch Center Pro's [prompt-text:label] and its ability to launch URLs from external apps. Here's the custom URL Action in Drafts which I named Dropbox Sync:

Open this link if you want it installed on your iOS device automatically.

With this action, I can now load any text file from my Dropbox folder which has been mapped to 1Writer, make some changes, and sync those changes using Launch Center Pro's [prompt] and 1Writer's `/replace' URL, and continue writing in Drafts - all with a single tap. I hope Greg Pierce, the developer of Drafts, would add the replace function to the Dropbox Actions to make it easy for everyone to sync their changes to Dropbox.

You should follow me on Twitter here.