Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added download path #532

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

added download path #532

wants to merge 1 commit into from

Conversation

teja8352
Copy link

Platforms affected

Android

Motivation and Context

From Android 10 onwards it was very difficult to download due to permissions. The downloads folder has permission to access.

Description

added download path

Testing

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

Copy link
Contributor

@breautek breautek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your PR. I left some remarks and wonder what your thoughts will be.

Several JS files had some formatting changes which is breaking our lint rules. I suggest reverting these formatting changes. You can run npm test which should run the linter locally to confirm that lint passes.

For the README file, you've made a lot of drastic changes to the formatting, but I do like these changes. However, should we need to revert this PR in the future for whatever reason, it will cause the revert to your README improvements. I'd suggest considering pulling out the reformat and readability improvements as a separate PR, and keep the README changes here focused on the documentation additions for the downloadsDirectory. I don't consider this a blocker though.

|    `files` | dataDirectory | files | r/w | Yes | No | Yes |
|       `Documents` | | documents | r/w | Yes | No | Yes |
| `<sdcard>/` | externalRootDirectory | sdcard | r/w\*\*\* | Yes | No | No |
| `<sdcard>/` | downloadDirectory | sdcard | r/w\*\*\* | Yes | No | No |
Copy link
Contributor

@breautek breautek Aug 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `<sdcard>/` | downloadDirectory | sdcard | r/w\*\*\* | Yes | No | No |
| `<sdcard>/Downloads` | downloadDirectory | sdcard | r/w | Yes | No | No |

I think the download directory is generally located at <sdcard>/Download but I think this should be confirmed. Additionally, the triple star indicator is for a note on API 30 changes where the external root directory is no longer a writable path, which I don't think applies to the Downloads folder.

Suggestion is to show changes, but it will likely screw up the textual formatting of the table, so these changes might be better to be applied manually rather then accepting the suggestion commit as is.

@@ -1025,6 +1025,7 @@ private JSONObject requestAllPaths() throws JSONException {
ret.put("externalDataDirectory", toDirUrl(context.getExternalFilesDir(null)));
ret.put("externalCacheDirectory", toDirUrl(context.getExternalCacheDir()));
ret.put("externalRootDirectory", toDirUrl(Environment.getExternalStorageDirectory()));
ret.put("downloadDirectory", toDirUrl(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getExternalStoragePublicDirectory is deprecated as of API 29.

It appears Context.getExternalFilesDir is the replacement. I believe the Environment.DIRECTORY_DOWNLOADS can be still used with getExternalFilesDir but it would need to be confirmed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants