Firestore is currently storing the LevelDB files under the Documents/ directory on iOS. The Documents/ directory is visible to the end user (i.e in the Files app) and this could cause issues if an user inadvertently delete or rename a file belonging to Firestore/LevelDB.
I propose we change the location for the LevelDB directory from Documents/ to Library/Application support. This location is more inline with the guidelines defined by Apple here
Relevant bits:
- Put user data in
Documents/. User data generally includes any files you might want to expose to the user鈥攁nything you might want the user to create, import, delete or edit. For a drawing app, user data includes any graphic files the user might create. For a text editor, it includes the text files. Video and audio apps may even include files that the user has downloaded to watch or listen to later.- Put app-created support files in the
Library/Application support/directory. In general, this directory includes files that the app uses to run but that should remain hidden from the user. This directory can also include data files, configuration files, templates and modified versions of resources loaded from the app bundle.- Remember that files in
Documents/andApplication Support/are backed up by default. You can exclude files from the backup by calling -[NSURL setResourceValue:forKey:error:] using the NSURLIsExcludedFromBackupKey key. Any file that can be re-created or downloaded must be excluded from the backup. This is particularly important for large media files. If your application downloads video or audio files, make sure they are not included in the backup.
This location is essentially based on where we did it in the RTDB and that location was chosen somewhat arbitrarily. This is user data, but agreed that it's not user data that's useful as individual files. Regardless of our philosophical position on it the end-user experience with LSSupportsOpeningDocumentsInPlace and UIFileSharingEnabled enabled is something we should fix.
We provide custom directory browsing within our app. Until the fix is rolled out, I will have to manually hide this directory to the user.
+1
@mathieugarcia can you share how you are hiding the directory? We tried setting NSURLIsHiddenKey but it鈥檚 still showing in Files app.
It would be great if this issue could be addressed. Our users make use of the Files app to transfer a lot of files in/out of the device/app. This folder causes confusion to some people and is at risk of being deleted by the user.
Definitely agree here. User's shouldn't be able to access this in the Documents directory which is meant for User generated files.
@wilhuff is on the roadmap?
For sure, though the fix is tricky when accounting for migrating existing data because we're not structured to handle that (yet).
@mathieugarcia how can I hide Firebase directory please?
This will go out with the next release!
Most helpful comment
This will go out with the next release!