cordova-plugin-file
cordova-plugin-file copied to clipboard
Do not require file storage permissions at start in Chrome on browser platform
Chrome with browser platform is asking for user permission at cordova start, for example :
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.
I don't want to store any file with cordova-plugin-file on browser platform ...
What do you want to do with it?
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.
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.
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 :) .
@janpio Is it fixed ?
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.
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?
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.
Can this be the solution: https://github.com/marcusdiy/cordova-plugin-file/blob/master/www/browser/Preparing.js
@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