apache / cordova-plugin-file

Apache Cordova File Plugin
https://cordova.apache.org/
Apache License 2.0
741 stars 756 forks source link

Do not require file storage permissions at start in Chrome on browser platform #253

Open nicolashenry opened 5 years ago

nicolashenry commented 5 years ago

Chrome with browser platform is asking for user permission at cordova start, for example :

image

I don't want to store any file with cordova-plugin-file on browser platform so it should not asking for it (I think it should be asked only when needed).

It seems that the permission request come from this file : https://github.com/apache/cordova-plugin-file/blob/master/www/browser/Preparing.js I could do a PR but I don't fully understand what is done here and why.

janpio commented 5 years ago

I don't want to store any file with cordova-plugin-file on browser platform ...

What do you want to do with it?

nicolashenry commented 5 years ago

What do you want to do with it?

Nothing on browser platform, I use it only on Android and iOS platform but I still need some other cordova plugins with the same code base.

janpio commented 5 years ago

One possible quick fix if you are in a hurry: Fork the plugin in your own Github account, remove the www/browser folder and references to it. Install that plugin.

nicolashenry commented 5 years ago

Our current build system forbid the use of github or local cordova plugins for now but I am not really in a hurry, none of our users have complained so far :) .

nicolashenry commented 4 years ago

@janpio Is it fixed ?

janpio commented 4 years ago

This was an accidental close, sorry.

But: There is not really anything to fix. Using the file plugin requires permission to do so on Chrome. It is unfortunate that this happens in Preparing.js, but that's how this plugin was implemented for browser.

auflint commented 4 years ago

Is there a modification for this yet? I'm not as concerned with completely shutting down the permission window, but it's off putting when the first thing you're met with, as a user, is a dialog asking storage permission before they even log in.

Is there a work around to delay the dialog at least until we can notify the user why we're going to ask permission?

breautek commented 4 years ago

I would support a PR that changes this so the developer must call an API to initialise the file system rather than the plugin assuming that the app wants the file system immediately on launch.

I think that solution would address both @auflint where she wants the permission dialog to appear within context and @nicolashenry issue where they don't use the filesystem plugin at all for the browser, but the plugin is still available because its used in other platforms within the same project.

A PR like this though is a significant change so it would only make sense for the PR be a part of a major update. It's also important to note a PR like this will make some existing things weird, such as the filePluginIsReady event, which will become obsolete if the developer initialises calls on an API filesystem themselves and able to use a callback.

marcusdiy commented 2 years ago

Can this be the solution: https://github.com/marcusdiy/cordova-plugin-file/blob/master/www/browser/Preparing.js

hugo-levet commented 2 years ago

@marcusdiy Your solution don't work for me, but I have delete first and last line and it work, thanks for your help. Alose thanks to @janpio for his solution