Skip to content

fix(android) Issue #329 - Allow plugins to "exec" when on a cdvfile:// url - #356

Open
Lindsay-Needs-Sleep wants to merge 2 commits into
apache:masterfrom
miloproductionsinc:issue#329-Android4.4_cdvfile_exec
Open

fix(android) Issue #329 - Allow plugins to "exec" when on a cdvfile:// url#356
Lindsay-Needs-Sleep wants to merge 2 commits into
apache:masterfrom
miloproductionsinc:issue#329-Android4.4_cdvfile_exec

Conversation

@Lindsay-Needs-Sleep

Copy link
Copy Markdown

Allow plugins to exec when on a cdvfile:// url in Android 4.4 (Already works properly in at least Android 6.0+)

Platforms affected

Android
(Specifically for Android OS 4.4, maybe Android OS 5.0)

Motivation and Context

This fixes #329
(Also accidentally caused my previous pull request (PR #332) to accidentally close.)

Description

Due to different/incorrect native code in Android 4.4, the received origin onJsPrompt is "" when on a "cdvfile://" url.
So in the case that cordova-plugin-file is asked if a url should(be)Allow(ed)BridgeAccess, it will manually retrieve the url from the webView in the case that it has received the broken "" and check if it is a "cdvfile://" url.

Testing

Added the plugin as a local file to my project.
Debugged the new Android code. Walked through it.
Observed that desired result of cordova-plugin-file being able to "exec". (Other plugins were also then able to do their exec commands and fire their ready channels as well.)
And deviceready was finally fired.

Ran the manual tests, they all passed.
The automatic tests had the same failures before and after my change.

Added a new manual test which basically redirects to the same page but is a cdvfile url.
This allows you to run tests from the cdvfile url. When you open this page with an Android OS 4.4 device (before my changes), it is completely blank. After the changes, all the tests run again successfully on the cdvfile url (except those that were broken before changes).

Passed npm run eslint

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

@Lindsay-Needs-Sleep
Lindsay-Needs-Sleep force-pushed the issue#329-Android4.4_cdvfile_exec branch from 08460fa to ed23d19 Compare November 7, 2019 11:47
@Lindsay-Needs-Sleep Lindsay-Needs-Sleep changed the title (android) Issue #329 - Allow plugins to "exec" when on a cdvfile:// url fix(android) Issue #329 - Allow plugins to "exec" when on a cdvfile:// url Dec 7, 2019
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.

cdvfile:// Channel not fired: onFileSystemPathsReady on Android OS 4.4

1 participant