You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The call should resolve with the PermissionStatus object.
Code Reproduction
try {
const result = await Filesystem.requestPermissions()
} catch {
console.error("This message will never print.")
}
console.error("This message will never print if a prompt was displayed and the user touched 'allow'.")
Other Technical Details
When calling Filesystem.requestPermissions() directly (and not implicitly because of some other call), the proper permissions prompt is displayed (when state is "prompt" or "prompt-with-rationale" on Android 10 and earlier) and the permission is granted correctly but the javascript call never resolves. This is because the switch statement in permissionCallback just falls through, because there's no case for "requestPermissions":
case "requestPermissions":
JSObject permissionsResultJSON = new JSObject();
permissionsResultJSON.put(PUBLIC_STORAGE, "granted");
call.resolve(permissionsResultJSON);
break;
(Or by calling this.requestPermissions(call) though this is recursion, or by an equivalent refactoring.)
It looks like this bug applies to all 5.x and 6.x releases and main.
Additional Context
In our application it is very nice to prompt the user to allow filesystem permissions when they first touch "export", rather than after they have already filled out the subsequent dialog.
The text was updated successfully, but these errors were encountered:
Good call. We were on 5.2.0, upgrading to 5.2.1 fixes this.
The correct code path goes through the base class (I guess?), which I neglected to check.
Close as invalid or whichever status is customary. Sorry for the noise.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.
Bug Report
Plugin(s)
filesystem
Capacitor Version
Platform(s)
Android 10 and earlier
Current Behavior
A call to Filesystem.requestPermissions() which displays a prompt, that the user then accepts neither resolves nor rejects.
Expected Behavior
The call should resolve with the PermissionStatus object.
Code Reproduction
Other Technical Details
When calling Filesystem.requestPermissions() directly (and not implicitly because of some other call), the proper permissions prompt is displayed (when state is "prompt" or "prompt-with-rationale" on Android 10 and earlier) and the permission is granted correctly but the javascript call never resolves. This is because the switch statement in
permissionCallback
just falls through, because there's no case for"requestPermissions"
:capacitor-plugins/filesystem/android/src/main/java/com/capacitorjs/plugins/filesystem/FilesystemPlugin.java
Line 475 in 0ccb9c4
Fixable by adding:
(Or by calling
this.requestPermissions(call)
though this is recursion, or by an equivalent refactoring.)It looks like this bug applies to all 5.x and 6.x releases and
main
.Additional Context
In our application it is very nice to prompt the user to allow filesystem permissions when they first touch "export", rather than after they have already filled out the subsequent dialog.
The text was updated successfully, but these errors were encountered: