quran / quran-ios

QuranEngine is the engine powering the Quran.com iOS app.
Apache License 2.0
462 stars 160 forks source link

Exclude downloaded audio from iCloud Backup #675

Open suhailskhan opened 4 weeks ago

suhailskhan commented 4 weeks ago

When iCloud Backup is enabled on a device, the backup it creates will include recitation/translation audio downloaded by the application, causing the device’s backup size to be significantly higher than it would have been without the audio data. Currently, the only way to mitigate this is to turn off backup of the app’s data entirely, in iCloud Backup’s Details screen, as pictured below.

Since this data is reproducible (i.e. by tapping the “download” button), this does not need to be part of a device’s backup. While we can simply apply the workaround described earlier, which is to turn off backup of the app’s data, ideally the app itself should prevent audio from being part of backups. Users that want to back their device up to iCloud but are mindful of iCloud storage consumption should not have to manually exclude the app from their device’s backup. Preventing audio from being backed up will also greatly reduce redundant network traffic as significantly less data will be uploaded by the system by default. (It is also worth noting that iCloud Backup is enabled by default on devices signed into iCloud.) Also, doing this will reduce the time it takes for a new device to finish restoring from iCloud on slower internet connections.

Foundation provides a way to mark certain files or directories created by our application as excludable from iCloud Backup, so that all data, except for that which is marked as excluded, will be included in device backups (see article “Optimizing Your App’s Data for iCloud Backup” at developer.apple.com). Quran recitation/translation audio most closely fits the article’s description of “non-purgeable” data. To prevent backing up non-purgeable data, it advises applying the isExcludedFromBackup resource value to the URL of a given file or directory. Assuming this is applicable to this application and the way it stores audio files, this may be a solution to the problem.

Screenshot of iCloud Backup details of an iPhone, highlighting the large size of the app’s backup data

wedkemail commented 3 days ago

I'll look into this! Thanks for the information

suhailskhan commented 3 days ago

Do keep me updated. I would have liked to look into this myself, but have refrained due to shortage of time at this moment.