weta-vn / advance_image_picker

Flutter plugin for selecting multiple images from the Android and iOS image library, taking new pictures with the camera, and edit them before using such as rotating, cropping, adding sticker/filters.
BSD 3-Clause "New" or "Revised" License
110 stars 49 forks source link

Issue : Denying the authorisation leads to a black screen forever #37

Closed VuillaumeGautier closed 2 years ago

VuillaumeGautier commented 3 years ago

Hi !

Some of our users have been reporting an unclear situation : when they deny the camera or the gallery picker, they're faced against a black screen content, making the information unclear. Either asking again for the authorization or display the information clearly would fix this, no idea if this is planned or possible through a way.

Thanks !

weta-vn commented 3 years ago

Dear @VuillaumeGautier We confirmed that denying the authorization leads to a black screen. We catch authorization exception, then show request permission to allow user do it again (except when user force to don't show permission dialog again, in this case, user must grant permission in OS setting or reinstall app). We released modified code in v0.1.5+5. Thank you.

rydmike commented 3 years ago

@VuillaumeGautier another general way to deal with permissions is to use a permissions handler, for example the excellent and commonly used https://pub.dev/packages/permission_handler and check in your app that the app has required permission and if not request them, before entering into paths in your app where special permissions are required, and thus not even allow entering into paths or screens were those permission are needed. In this case that would be opening the camera package.

This way you can avoid any potential issues a package out of your control might have when it comes to handling and reacting to the permissions response. I had actually not noticed this issue, since that is what I do in an app using this package.

VuillaumeGautier commented 3 years ago

Sure it's possible to manage those things out of the screens, but it's always best to stay consistent within the package. By the way, we tested the correction and it has an issue : the "request permission" button could not open the settings on the test phone. It might be an issue with the request permission package used though, I just let you know. Also, the storage picker still displays the button to sort the pictures when the authorization is denied, which leads to another black screen.

As always, the package is great and thanks for all the hard work !

rydmike commented 3 years ago

I totally agree that the package should handle permissions and changes to them gracefully as well, it is after all possible for a user to go into OS settings and deny previously granted permissions, while having the camera open in the app. A solid package (and apps as well), need to be able to handle this smoothly as well. Many apps and packages may fail if you do this, but they really should not.

I just like to always add the permissions check and request into apps before I attempt any ops that require permissions, then you at least reduce the risk of issues if you just check every time before entering into that path. Still possible for the user to turn off/deny the permissions while in that path, not so likely to happen, but possible, so the package does indeed need to handle it properly as well.