Skip to content

Conversation

@FireFistisDead
Copy link
Contributor

Fixes #127

Closes #127

Description

This pull request introduces a comprehensive update to how storage permissions are handled in the app, ensuring compatibility and security across different Android versions and iOS. The main changes include refactoring permission logic to use the react-native-permissions library, updating Android manifest permissions, and centralizing permission checks to improve maintainability and user experience.

Permissions Handling Improvements:

  • Refactored all storage permission logic to use the new PermissionsHelper class, which leverages the react-native-permissions library for consistent permission handling across Android and iOS. This includes both requesting and checking permissions, and providing user-friendly dialogs for permission explanations and denials. (src/utils/permissions.ts, src/utils/exportSchedule.ts, [1] [2] [3] [4]
  • Added a centralized utility requestStoragePermission for easy permission requests throughout the app. (src/utils/storage-permissions.ts, src/utils/storage-permissions.tsR1-R6)

Android Manifest and File Provider Updates:

  • Updated AndroidManifest.xml to declare all necessary storage permissions for different Android versions, including READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE, and MANAGE_EXTERNAL_STORAGE, and added a FileProvider for secure file sharing and CSV export/import. (android/app/src/main/AndroidManifest.xml, [1] [2]
  • Added a new file_paths.xml resource to support the FileProvider configuration for external file access. (android/app/src/main/res/xml/file_paths.xml, android/app/src/main/res/xml/file_paths.xmlR1-R4)

App Initialization and Permission Requests:

  • On app startup, the app now automatically requests the appropriate storage permissions based on the Android version, improving user onboarding and reducing permission-related errors. (App.tsx, [1] [2]

Dependency Management:

  • Added the react-native-permissions library to package.json to support the new permission handling approach. (package.json, package.jsonR38)

These changes collectively modernize and streamline the app’s storage permission workflow, improving reliability and user experience across platforms.

Files Changed

Screenshots/Videos

WhatsApp Image 2025-08-16 at 23 56 26_ad350f2f
WhatsApp Image 2025-08-16 at 23 56 37_43f70957

GSSoC Contributor

  • Yes, I am a GSSoC contributor

Testing Device

  • Physical Android Device

@FireFistisDead
Copy link
Contributor Author

@Irtesaam is this fine

@Irtesaam
Copy link
Collaborator

@FireFistisDead No permissions requested issue persists.
In your previous pr #133 (till commit d6150e3), permissions were requested correctly—the only issue was accessing storage even after denied. Your latest changes conflict with that. Take your time to review the history between that commit and your latest to identify the problem.

@FireFistisDead
Copy link
Contributor Author

@Irtesaam can you tell me your android version?

@Irtesaam
Copy link
Collaborator

@FireFistisDead 13

@FireFistisDead
Copy link
Contributor Author

FireFistisDead commented Aug 16, 2025

@Irtesaam if possible can you once check with versions less than 13 so that i could figure out what exactly the problem is

@FireFistisDead
Copy link
Contributor Author

because i have android version 8 and 11 available for now

@Irtesaam
Copy link
Collaborator

because i have android version 8 and 11 available for now

You can use emulator for that. When creating a new virtual device, you’ll get options to choose different Android versions—just pick 11 & 13 and test on both of them.

@Irtesaam
Copy link
Collaborator

@FireFistisDead Also refer to your commit d6150e3 as it was working fine for Android 13 in that.

@FireFistisDead
Copy link
Contributor Author

@FireFistisDead Also refer to your commit d6150e3 as it was working fine for Android 13 in that.

yeah i was refering to that only now ig i got the problem

@FireFistisDead
Copy link
Contributor Author

because i have android version 8 and 11 available for now

You can use emulator for that. When creating a new virtual device, you’ll get options to choose different Android versions—just pick 11 & 13 and test on both of them.

the problem is i dont have a high specs pc so i do in physical device

@FireFistisDead
Copy link
Contributor Author

FireFistisDead commented Aug 16, 2025

@Irtesaam d6150e3 was this asking for photos and audio permissions?
because i got the issue for android versions < 13 it asks for the file permissions but for android version >= 13 it asks for the audio and photo permission

@FireFistisDead
Copy link
Contributor Author

FireFistisDead commented Aug 16, 2025

@Irtesaam https://stackoverflow.com/questions/72948052/android-13-read-external-storage-permission-still-usable
according to this there is no other function to read the external storage directly

@Irtesaam
Copy link
Collaborator

@Irtesaam d6150e3 was this asking for photos and audio permissions? because i got the issue for android versions < 13 it asks for the file permissions but for android version >= 13 it asks for the audio and photo permission

@FireFistisDead Yah it was asking for both. So for android 13, it would require both permissions to work ?
If so, you just need to fix the storage access behaviour when denied and keep all rest of the changes same as your commit d6150e3. Will that fix it ?

@FireFistisDead
Copy link
Contributor Author

@Irtesaam no it wont fix it according to the blogs and documentaton there is no direct function to ask for the file permission in the android versions >=13 we have to verify it from google play there is a process for that

@FireFistisDead
Copy link
Contributor Author

for now i am thinking what we can do for quick action

@FireFistisDead
Copy link
Contributor Author

@Irtesaam d6150e3 was this asking for photos and audio permissions? because i got the issue for android versions < 13 it asks for the file permissions but for android version >= 13 it asks for the audio and photo permission

@FireFistisDead Yah it was asking for both. So for android 13, it would require both permissions to work ? If so, you just need to fix the storage access behaviour when denied and keep all rest of the changes same as your commit d6150e3. Will that fix it ?

yeah i have already fixed it in my recent changes

Copy link
Collaborator

@Irtesaam Irtesaam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot From 2025-08-17 17-37-15 Screenshot From 2025-08-17 17-38-15

@FireFistisDead You're right. I just tested it, and it seems the current code is only working for Android <13. For Android 13+, the storage permission is causing issue.

I'm merging the changes for now and will look into updating the permission logic to support the newer Android versions (if possible).

@Irtesaam Irtesaam merged commit c71ceab into Loop-Hive:main Aug 17, 2025
6 checks passed
@FireFistisDead
Copy link
Contributor Author

FireFistisDead commented Aug 17, 2025

@Irtesaam i just read some documentation and surfed online i have come up with an idea like this issue is because of the android version so i am thinking that rather than taking permission from the user to store data we can directly prompt the user that where the user wants to store the data just like when we are importing schedule from the csv in that user selects from where he wants to import the data just like that we will ask the user where he wants to store the data
this will solve two issues

  • It will store the data in android versions above 13
  • This will also add the feature for user to choose where to store the data

@Irtesaam
Copy link
Collaborator

@FireFistisDead This seems like a good idea but will it work without any permission given in the first place? If it can, then code it up and raise a PR. I will look into it.
Make sure that it works consistently across saving schedule and sharing it as well. Also in your PR, reference this issue #135

@FireFistisDead
Copy link
Contributor Author

@Irtesaam yeah i will try it if it works or not

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.

Fix storage permission denied error

2 participants