zoontek / zoontek/react-native-permissions

add a getter for permissions that require enabling from a settings menu (outside current app)

Open
#762 0 comments 0 reactions 1 assignee View on GitHub

@zoontek is already working on this.

Since Mar 27, 2023.

feature request
Dominant language
Objective-C++
Stars
4.4k
Forks
844
Avg merge
11d 18h
Merged PRs (30d)
1

Description

Why it is needed?

For android, any app that has to manage files or storage will need this permission check in order to verify that the permission is enabled.

These changes should include:

  • A check for MANAGE_EXTERNAL_STORAGE, the permission should not be provided in the AndroidManifest. This should only be enabled in the app integrating this library.
  • Possibly a method to navigate to the permission screen (via the openSettings) command. There is a PR for this in react-native-send-intent. I also have an open discussion here regarding extending Linking.sendIntent regarding opening the the MANAGE_EXTERNAL_STORAGE permission via intent for the integrated app.
  • Any other intent identified with a similar flow. IE the app is not where it can be enabled but it can still be permission checked.
Possible implementation

We can do this by adding a check using

We probably can add a method called isExternalStorageManager() and return the permissions state. Not sure if the RESULTS enum will match all states returned from isExternalStorageManager()

Code sample
  @RequiresApi(Build.VERSION_CODES.R)
  @ReactMethod
  override fun isExternalStorageManager(promise: Promise) {
    val isExternalStorageManager = isExternalStorageManager().toString()
    promise.resolve(isExternalStorageManager)
  }

This would return the string of "true" or "false". We can do something with that response on the react-native side such as match it with a specific RESULTS type.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.