parse-community / Parse-SDK-Android

The Android SDK for Parse Platform
https://parseplatform.org/
Other
1.89k stars 735 forks source link

Organizing directories #679

Open natario1 opened 7 years ago

natario1 commented 7 years ago

I’d like to address #98 , but before doing that, I’d like to discuss file/cache storage as it currently is. Most of all I would like to get rid of the deprecated Parse.getParseDir() which is still used here and there. There are:

Here’s where we use them:

So we should move all getParseDir() (deprecated) to either getParseCacheDir() or getParseFilesDir(). But looking at this, I see no pattern. What should go to cacheDir, and what to filesDir?

I know the implementation won't be easy to avoid breaking current caches, so we will have to support legacy dirs for a while etc. But here I would just like to understand the intended usage of cacheDir and filesDir. We actually store no files, these are all just caches of something. Even ParseFile are stored in cacheDir/files...

In short We need a new home for LocalId, CommandCache, currentUser, currentConfig, currentInstallation and installationId. Should it be cacheDir or filesDir ? And actually, couldn't we use cacheDir for everything?

natario1 commented 7 years ago

Suggestions:

and leave the others where they are. If I got this correctly this means that when the user clears app cache, currentUser, currentInstallation, installationId, currentConfig and applicationId are kept. The rest is cleared. What do you think?

The final structure would be as follows:

filesDir

  1. currentUser, currentInstallation, currentConfig (changed)
  2. installationId (changed)
  3. applicationId (changed)

cacheDir (clearable by android and by end user)

  1. CommandCache, that is, saveEventually operations waiting for network connection (changed)
  2. ParseFile cache (unchanged)
  3. Push history by PushRouter (changed)
  4. GCMRegistrar stuff, whatever that is (unchanged)
  5. LocalIdManager stuff (changed)
zeekhuge commented 7 years ago

Hi, do not intend to hijack this thread. But I think my question is very much related. I want to keep files locally, for a long duration of time. Also, I wish to keep a lot of other object in the local data store using *.pinInBackground() or similar.

So my question is : where will all the 'pinned' objects get saved ? and can I change something in config so that parse saves the downloaded Files (using ParseFile.getFile()) in a different dir ? also, is 'pinning' good for heavy data lifting ?

PS : please do tell if you think this should actually be a different thread.