2018年10月28日 星期日

Shortcut (Workflow) Backup


Shortcut (Workflow) is an amazing app to automate a series of features of iOS or some iOS third-party apps. After Workflow had been acquired by Apple, it became free to download and the file syncing service was transferred to Apple's server.

On iOS 12, Workflow is renamed to be "Shortcut", and it is featured to integrate with customised Siri commands. Actually, the target of Siri is to understand human's words with the natural language technology, which seems a conflict with Siri Shortcut.... but it does compensate the customers for the demands for complicated and serial actions on Siri.

However, even though Shortcut gets official supports of iCloud sync, its original developers and Apple has never provided an official method to backup our workflows (shortcuts), just left some hint:

捷徑 (Workflow) 是一個提供 iOS 系統功能及第三方軟體功能自動化的強大軟體,在 Apple 收購原公司 Workflow 後,它改為免費下載,而且同步功能也被轉移到 Apple 的伺服器上。

在 iOS 12,Workflow 被改名為 "捷徑",而且主打與 Siri 自訂指令的整合。事實上 Siri 的目標是以自然語言去理解人的話,似乎在理念上與 Siri 捷徑有些衝突 .... 不過 Siri 捷徑確實彌補了 Siri 在執行複雜連續動作上的不足。

然而,即使捷徑得到 iCloud 同步功能的官方支援,它的原開發者及 Apple 始終沒有提供官方的備份方法,只是留了線索讓我們自己來:


Very obvious, right? So, today I'd like to share some backup shortcuts here.

非常明顯對吧?所以今天我想在這分享幾個關於備份的捷徑。



Shortcut Backup


This shortcut provides you full power to make and manage your shortcut backups:

這個捷徑提供製作及管理備份檔的能力:



1. Backup All Local Shortcuts


Choose the backup file name and the storage location, done.

選擇備份檔名及用以儲存的雲端服務,完。


2. Import Shortcuts from Backup (Warning! iOS 13 removes this feature currently)


From a backup file, choose some shortcuts to import them to your current shortcut library.

從一個備份檔中選擇數個捷徑匯入至你目前手機上的捷徑庫裡。


3. Delete Unnecessary Backups


Choose some backup files to delete. You can check the files in Files app, which path is /Shortcuts/ .

Please note that "Import" and "Delete" functions work for iCloud drive only. I didn't try Box.net, but I found that Dropbox doesn't support "Get File" action of Shortcut. This is a compatibility issue for iOS 12 (credit), it could be fixed in the future, maybe.

選擇數個備份檔以刪除。你可以在 "檔案" App 裡查看實際的檔案,路徑為 /Shortcuts/

請注意 "匯入" 及 "刪除" 功能只有 iCloud drive 支援。我沒有試過 Box.net,但我發現 Dropbox 並不支援捷徑的 "Get File" 動作模塊。這是一個與 iOS 12 系統相容性的問題 (相關連結),也許未來會修復吧,也許。


You can change the storage path by yourself, just follow my setting (e.g. I make a folder "Apps" in Dropbox for backup, as shown above).

你可以依照我的設定去改變儲存的路徑,如上圖 (例如上圖我在 Dropbox 中建立了一個資料夾 "Apps" 放置備份檔)。


20181030 v2.0 Update:
4. Remove Shortcuts in Backup


Add a new feature "Remove Shortcuts in Backup", which lets you remove some shortcuts you don't need in a backup file (by unchecking them).

加了一個新功能 "Remove Shortcuts in Backup",它可讓你將備份檔中不需要的捷徑刪除 (藉著取消勾選的方式)。


20181102 v2.1 Update:
Shortcut v2.1 fix the issue of "Get File" for Dropbox, so the full support of Dropbox is added.

捷徑 2.1 版已將 "Get File" 模塊中的 Dropbox 支援問題修復,所以此版加入 Dropbox 的完整支援。


20181222 v3.0 Update:


Add new functions "partially backup local shortcuts" and "add local shortcuts into backup file".

加入 "部分備份" 及 "添加本機捷徑至備份檔" 的功能。


20181230 v3.1 Update:


"Add/Remove Shortcuts in Backup" will update the modified time in the filename, and delete the old one, if the filename of the backup file you would like to modify doesn't include the timestamp, please disable the "Delete Files" action by yourself.

"Add/Remove Shortcuts in Backup" 功能將會在檔名上更新修改的時間,而且刪除舊檔,如果你要修改的備份檔檔名不包含時間,請自己移除 "Delete Files" 動作模塊。



Incremental Backup from File


Because Shortcut officially offers syncing services only, many people store tons of shortcuts in their phones. With the time passing, it becomes harder and harder to find the Shortcut we really need at that moment. But the fact is that, usually we don't use so many shortcuts in our daily life, some shortcuts are stored for some personal reasons. For example, I store some shortcuts, made by other developers, to learn something from their codes, but I never run them. The above "Shortcut Backup" provides a solution: delete and import when we need. However, after we delete some shortcuts, we would sometimes modify our original shortcuts or make / download other new shortcuts, so it is not a good thing if we want to keep "all" shortcuts (non-modified, new and deleted) in a backup file, which makes a version management problem if you just backup all local shortcuts again.

So, I develop a shortcut for the incremental backup:

由於捷徑只提供官方的同步服務,所以很多人在他們的手機中堆積了一大堆捷徑,隨著時間經過,會變得越來越難去找到當下實際需要的捷徑。但事實是我們在日常生活中根本不會用到那麼多捷徑,甚至有些捷徑是因為某些私人的理由才一直存著。例如,我會儲存一些其他人做的捷徑,進而學習他們的寫法,可是我從來不使用這些捷徑。上面的 "Shortcut Backup" 提供了一個解法:刪除,有需要時再匯入。然而在我們刪除一些捷徑之後,我們還是有可能會修改原有的捷徑,或是製作 / 下載其他新的捷徑,所以如果我們想在一個備份檔中保留 "全部" 的捷徑 (沒被修改過的、新的及已被刪除的),這可不是件容易的事。如果你只是再次備份全部的捷徑,它將造成版本管理的問題。

所以,我開發了一個提供增量備份的捷徑:


First, choose a old backup file, and then it compares the shortcuts in the old backup with the current shortcuts; second, it appends the shortcuts which doesn't exist in current shortcut library to the current shortcut list; third, it package all shortcuts as an achieve and store it into the Cloud drive; finally, it deletes the old backup file. So, the old shortcuts would be updated to the latest version and the old deleted shortcuts are still kept in the backup files. I name the file "Shortcut library-XXX..." by default, because I think it looks more like a whole library, rather than a normal backup.

Because this shortcut is more complicated, I didn't integrate it into "Shortcut Backup" shortcut, you can use "Run Shortcut" action to do that (as below).

首先,選擇一個舊備份檔,然後它儲存的舊捷徑會被拿來與現有捷徑庫的捷徑作比對;第二步,在現有捷徑庫上不存在的老捷徑會被加到現有捷徑庫的捷徑名單中;第三步,打包所有捷徑成一壓縮檔並儲存在 iCloud drive;最後,刪除舊的備份檔。所以,同名老捷徑會被更新到最新版本,且以前被刪除過的捷徑依然會被保存在備份檔裡。我預設將其檔名取為 "Shortcut library-XXX...",是因為我認為它更像一個 "資料庫",而不是一般的 "備份"。

因為這個捷徑比較複雜,所以我沒有將其整合在 "Shortcut Backup" 中,你們可以用 "Run Shortcut" 動作模塊去達成這個目標 (例子如下)。


20181102 v1.1 Update:
Shortcut v2.1 fix the issue of "Get File" for Dropbox, so the full support of Dropbox is added.

捷徑 2.1 版已將 "Get File" 模塊中的 Dropbox 支援問題修復,所以此版加入 Dropbox 的完整支援。



Others


This shortcut is not related to backup stuffs. I build it because I can't put up with so many shortcuts shown in my Today Widget.

這個捷徑跟備份沒關係,我寫了它只因為我不能忍受那麼多捷徑堆在我的 "Today Widget" 介面裡。


So I make a shortcut called "Others" to link with other shortcuts not so frequently used. The code is very simple, just repeat the setting as the below picture:

所以我做了一個捷徑 "Others" 去與其他並不是太常用的捷徑連結,原始碼很簡單,只要重複我下圖中的設定即可:


In my opinion, 6 shortcuts are the maximum amounts shown in Today Widget. Don't forget that there are also other App's widgets in that interface, so keeping it simple is a good idea.

依我的想法,六個捷徑就是在 Today Widget 介面中的最大值了,別忘了該介面還有很多其他 App 的 widget,所以保持簡單是個好主意。


Ok, if you have any question or suggestion, please let your comments below, thanks!

如果有問題或建議請在下方留言,感謝~

沒有留言:

張貼留言