Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Storage Permission Handling #14229

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

alperozturk96
Copy link
Collaborator

@alperozturk96 alperozturk96 commented Dec 23, 2024

  • Tests written, or not not needed

  • Remove the internal boolean flag used to determine whether the app needs to request storage permission. The app should always request the necessary permission if it has not been granted.

  • Simplify the StoragePermissionDialog logic by removing the external listener. The dialog’s sole responsibility should be to either open the app settings to request “Manage All Files” permission or request read-only media access. Decoupling this functionality from external listeners improves code readability and reduces complexity

  • Use precise and descriptive function names to improve code clarity and maintainability

  • Remove redundant checks in the requestStoragePermissionIfNeeded() function. This function already internally verifies whether storage permission is required, making additional checks unnecessary

  • Remove the readOnly parameter as its logic is implicitly tied to Android 11 and above (API level 30+). The current implementation redundantly checks the same condition (readOnly && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) multiple times, which is unnecessary and can lead to confusion

  • Add READ_MEDIA_VISUAL_USER_SELECTED permission (Documentation)

Android 7 GPlayImage 1 Android 11 GenericImage 2 Android 11 GPlayImage 3 Android 15 GenericImage 4 Android 15 GPlayImage 5

Copy link

Codacy

Lint

TypemasterPR
Warnings5957
Errors33

SpotBugs

CategoryBaseNew
Bad practice6565
Correctness5858
Dodgy code298298
Experimental11
Internationalization77
Malicious code vulnerability11
Multithreaded correctness77
Performance5353
Security1818
Total508508

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant