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

fix(android): allow file access for existing behavior #1111

Merged
merged 1 commit into from
Nov 4, 2020

Conversation

erisu
Copy link
Member

@erisu erisu commented Oct 27, 2020

Motivation, Context & Description

Fixes SDK 30 related issues

Loading file:// resources is failing in SDK API 30 because the setAllowFileAccess is now defaulted to false.

To keep existing behavior, we should set this to true, but in future releases we should default it to false and have the files loaded not though file.

Testing

With the camera plugin, took a photo and loaded the FILE_URI in <img> tag.

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

@codecov-io
Copy link

codecov-io commented Oct 27, 2020

Codecov Report

Merging #1111 into master will decrease coverage by 0.05%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1111      +/-   ##
==========================================
- Coverage   70.06%   70.01%   -0.06%     
==========================================
  Files          20       20              
  Lines        1784     1784              
==========================================
- Hits         1250     1249       -1     
- Misses        534      535       +1     
Impacted Files Coverage Δ
bin/templates/cordova/lib/check_reqs.js 58.49% <0.00%> (-0.48%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aada3e8...93b0cd6. Read the comment docs.

@ath0mas
Copy link
Contributor

ath0mas commented Oct 29, 2020

As described in the upper Motivation, here is the Android point on setAllowFileAccess since SDK 30:

The default value is true for apps targeting Build.VERSION_CODES.Q and below, and false when targeting Build.VERSION_CODES.R and above.

This explicit call should be added next to the settings.setAllowUniversalAccessFromFileURLs(true); line?
as both are since API 30 related to deprecated file:// URLs, and suggested use of androidx.webkit.WebViewAssetLoader
(and maybe move this "group" a bit from the use of unrelated setMediaPlaybackRequiresUserGesture)

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.

4 participants