RocketChat / Rocket.Chat.ReactNative

Rocket.Chat mobile clients
https://rocket.chat
MIT License
2.01k stars 1.17k forks source link

iOS Permission Bug Photos / unable to download images / re-install needed #5285

Open wasnertobias opened 1 year ago

wasnertobias commented 1 year ago

Description:

Permission to download images handled incorrectly.

Environment Information:

Steps to reproduce:

  1. Install the app brand new, login.
  2. Click on a image in a chat.
  3. Click DOWNLOAD icon
  4. It should now ask wether you want to switch gallery permissions to all photos / selected photos or stay with the permissions "only add photos" - select "only add photos"
  5. Now you get "Error while downloading" - does not ask for any permissions again

Expected behavior:

1.) Download should work without read access to pictures. 2.) When required permissions are missing for an action the app should ask again for those permissions instead of throwing an error.

Actual behavior:

"Error while downloading"

Additional context:

In the iOS settings app if you search for Rocket.Chat you are unable to select any different photo permission then "None" or the already selected one "Only add photos" => Reinstall needed

reinaldonetof commented 1 year ago

Thanks for your report! We will verify it.

Also, we are open to the community’s PR!

atulsingh98 commented 10 months ago

hey , i could reproduce the issue and understand the problem. Can i work on it?

atulsingh98 commented 10 months ago

hey @reinaldonetof @GleidsonDaniel , the only approach i could think of is installing a library like react-native-permissions to explicitly check for the persmission? how to proceed?

dnlsilva commented 10 months ago

@atulsingh98 As far as I know, on iOS it is not possible to request permissions again. So the library would only work to check the user's permission. However, as long as it works, I don't see a problem adding this library, just check if it is really necessary to add this library.

wasnertobias commented 10 months ago

@GleidsonDaniel "As far as I know, on iOS it is not possible to request permissions again."

You are right about that! So let me re-phrase the expected behavior: Provide the user with an understandable error and guide them on how to enable permissions in iOS settings without having to re-install the app (other apps do that as well).

atulsingh98 commented 10 months ago

okay so what we can do is display a modal which links to the settings where we can change app permission. would this be a good flow to implement ?Also without using library we would have to use native swift code @GleidsonDaniel

dnlsilva commented 10 months ago

I don't think it needs to be something like that, just a warning that the photo was not downloaded due to permission issues and the link to the setting. On Android, just ask again.

atulsingh98 commented 10 months ago

https://github.com/RocketChat/Rocket.Chat.ReactNative/assets/47176488/4f0306a5-dbdc-4d09-9400-90ff8e10b1e3

i implemented something like this. is this ok?

atulsingh98 commented 10 months ago

Also we need to give full access and not just the "Add photos only" option because we save our media in a custom album https://github.com/react-native-cameraroll/react-native-cameraroll?tab=readme-ov-file#ios-1 as pointed out here . @reinaldonetof would love your inputs on how to proceed and then open a pr for this

reinaldonetof commented 10 months ago

Hey @atulsingh98, I liked your solution. But we need to evaluate properly with the design and product team to understand what is the expected behavior.

atulsingh98 commented 10 months ago

Alright , let me know as well if i can work on it.

reinaldonetof commented 10 months ago

Alright , let me know as well if i can work on it.

IMHO, open your PR to it. Any changes we can handle there, but you are on the right path.

atulsingh98 commented 10 months ago

done :-)