cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shazron Abdullah (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CB-8032) Add nativeURL external method support for CDVFileSystem->makeEntryForPath:isDirectory:
Date Thu, 11 Dec 2014 21:56:14 GMT

    [ https://issues.apache.org/jira/browse/CB-8032?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14220041#comment-14220041
] 

Shazron Abdullah edited comment on CB-8032 at 12/11/14 9:55 PM:
----------------------------------------------------------------

Submitting a PR for review with a revised approach soon, for discussion.

Also, from my research, there are additional core plugins that require URL transformations,
for a total of 6:

* cordova-plugin-camera
* -cordova-plugin-file-
* -cordova-plugin-file-transfer- (connection:didFinishLoading:, handled by CDVFile)
* cordova-plugin-media
* cordova-plugin-media-capture
* cordova-plugin-contacts

There are also potentially third-party plugins that require those URL transformations as well,
and we need to come up with a general purpose solution. There is no way the LocalWebServer
can know about all plugins so it can set a delegate on each. So the alternative is that for
each plugin that returns a file URL needs to call a delegate to transform their URLs. This
delegate has to be in a common location, either in CDVViewController or the commandDelegate.
I'm leaning towards the commandDelegate.

This approach however requires all plugins to be updated to support this new approach. It
can be non-intrusive -- the plugin will check for the selector being available, and if it
is call it to transform their URL (demonstrated in the closed PR above).

Ideally we could use NSURLProtocol to intercept any requests and transform them (as suggested
by Tony Homer), but NSURLProtocol does not work with WKWebView.



was (Author: shazron):
Submitting a PR for review with a revised approach soon, for discussion.

Also, from my research, there are additional core plugins that require URL transformations,
for a total of 6:

* cordova-plugin-camera
* cordova-plugin-file
* cordova-plugin-file-transfer
* cordova-plugin-media
* cordova-plugin-media-capture
* cordova-plugin-contacts

There are also potentially third-party plugins that require those URL transformations as well,
and we need to come up with a general purpose solution. There is no way the LocalWebServer
can know about all plugins so it can set a delegate on each. So the alternative is that for
each plugin that returns a file URL needs to call a delegate to transform their URLs. This
delegate has to be in a common location, either in CDVViewController or the commandDelegate.
I'm leaning towards the commandDelegate.

This approach however requires all plugins to be updated to support this new approach. It
can be non-intrusive -- the plugin will check for the selector being available, and if it
is call it to transform their URL (demonstrated in the closed PR above).

Ideally we could use NSURLProtocol to intercept any requests and transform them (as suggested
by Tony Homer), but NSURLProtocol does not work with WKWebView.


> Add nativeURL external method support for CDVFileSystem->makeEntryForPath:isDirectory:
> --------------------------------------------------------------------------------------
>
>                 Key: CB-8032
>                 URL: https://issues.apache.org/jira/browse/CB-8032
>             Project: Apache Cordova
>          Issue Type: Sub-task
>          Components: Plugin Camera, Plugin Contacts, Plugin File, Plugin File Transfer,
Plugin Media, Plugin Media Capture
>         Environment: iOS
>            Reporter: Shazron Abdullah
>
> Right now in CDVFileSystem->makeEntryForPath:isDirectory:, in the NSDictionary that
is returned, for the key "nativeURL" the format is fixed (file:// protocol for a local filesystem
reference, and assets-library:/ for a assets library filesystem reference.)
> When calculating the nativeURL, allow this to be specified externally, check for a selector
"nativeURL" and call that if available.
> This is for example declared in a Category in this plugin: https://github.com/apache/cordova-plugins/blob/5d8ef21dcbde1f99d60e1b52ae3a3800e4c185d9/local-webserver/src/ios/CDVLocalFileSystem%2BNativeURL.m
> ... which when linked will have the selector available for the File plugin to call.
> This code is part of the local webserver plugin - and it needs the File references to
be proxied through a local webserver.
> For example if the FileEntry is to:
>     
>     file://my/package/folder/Documents/foo.txt
> .. the nativeURL would be, with this new category method, and the local webserver listening
to http://localhost:8080:
>     http://localhost:8080/local-filesystem/my/package/folder/Documents/foo.txt



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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


Mime
View raw message