breautek opened a new pull request, #642:
URL: https://github.com/apache/cordova-plugin-file/pull/642

   
   
   <!--
   Please make sure the checklist boxes are all checked before submitting the 
PR. The checklist is intended as a quick reference, for complete details please 
see our Contributor Guidelines:
   
   http://cordova.apache.org/contribute/contribute_guidelines.html
   
   Thanks!
   -->
   
   ### Platforms affected
   
   iOS
   
   ### Motivation and Context
   <!-- Why is this change required? What problem does it solve? -->
   <!-- If it fixes an open issue, please link to the issue here. -->
   
   Entry's `toURL()` method is intended to produce a DOM-usable URIs.
   This works as intended on Android.
   
   On iOS however, it only worked if the app was configured to be in a 
`file://` hosted webview. If the webview was configured to use schemes, it 
would still produce a `file://` uri which is not usable in the DOM.
   
   I believe this can be considered a patch, for `file://` hosted users, this 
should behave the same as before. For scheme-hosted users, the `.toURL()` will 
return a different URI, but the original format didn't work as intended. If the 
user were using `.toURL()` for another purpose, then this could be considered a 
breaking change?
   
   ### Description
   <!-- Describe your changes in detail -->
   
   Mimick how Android solves this issue, by creating an ios specific `Entry.js` 
file which contains a `toURL` method override with iOS specific logic.
   
   ### Testing
   <!-- Please describe in detail how you tested your changes. -->
   
   Manually tested with and without the `scheme` preference to observe 
`toURL()` producing `file://` urls while in `file://` hosted mode, or `app://` 
uris if the app is using `scheme` preference.
   
   Also tested completely custom schemes using:
   
   ```xml
   <preference name="scheme" value="myapp" />
   <preference name="hostname" value="appname" />
   ```
   
   and observing URIs such as 
`myapp://appname/_app_file_/var/mobile/Containers/Data/Application/84D10AA8-302C-4295-8690-54F4C4EA9BB2/tmp/cdv_photo_1730252303.jpg`.
   
   Confirmed that in both cases, the produced URIs are usable in the DOM to 
properly load image assets, for example.
   
   ### Checklist
   
   - [x] I've run the tests to see all new and existing tests pass
   - [x] I added automated test coverage as appropriate for this change
   - [x] Commit is prefixed with `(platform)` if this change only applies to 
one platform (e.g. `(android)`)
   - [x] 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](https://help.github.com/articles/closing-issues-using-keywords/))
   - [x] I've updated the documentation if necessary
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to