cordova-plugin-file icon indicating copy to clipboard operation
cordova-plugin-file copied to clipboard

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

Open nicolashenry opened this issue 6 years ago • 10 comments

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.

nicolashenry avatar Sep 20 '18 15:09 nicolashenry

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

What do you want to do with it?

janpio avatar Sep 20 '18 15:09 janpio

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.

nicolashenry avatar Sep 20 '18 16:09 nicolashenry

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.

janpio avatar Sep 20 '18 16:09 janpio

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 avatar Sep 20 '18 16:09 nicolashenry

@janpio Is it fixed ?

nicolashenry avatar Jun 07 '19 13:06 nicolashenry

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.

janpio avatar Jun 07 '19 14:06 janpio

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?

auflint avatar Dec 04 '19 20:12 auflint

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.

breautek avatar Dec 04 '19 21:12 breautek

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

marcusdiy avatar Nov 22 '21 20:11 marcusdiy

@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

hugo-levet avatar Dec 15 '21 16:12 hugo-levet