-
Notifications
You must be signed in to change notification settings - Fork 671
Screen rotation while showing Rationale dialog invalidates PermissionListener #276
Comments
|
@nsk90 what do you mean by invalidated? Could you describe the issue from the user point of view? |
I mean it is replaced with default one, and so it is not triggered.
from the user point of view is depends on what my app is doing in here are some cases:
I wrote that in my opinion ViewModel for DexterActivity should help, now I can add that there is a simpler option "headless fragment". |
I don't know right now what's the best fix for this issue. I need to review it in detail before changing anything. I'm also checking how to reproduce the issue manually and the sample app we provide seems to work properly. If you open the sample app, tap on the audio permission and waits for the dialog to be shown you can rotate the screen and the library works as expected. Maybe I'm missing something...could you try it out? If you can reproduce the error in our sample project it could be great if you create a branch reproducing the error. As a workaround, you could use configure your activity configChanges to avoid restoring the activity when the device screen rotates. |
Audio button in sample app does not use Rationale dialog. Use CAMERA button. Steps to reproduce on Sample app.
Take a look at The problem is just hidden by default listener which is calling |
I'm afraid this is not easy to fix at all. When the device is rotated the OS recreates the activity and this means we lose every reference to the original listener. As far as I've reviewing there is no way we can get a reference of any listener pointing at the new activity. I'm all ears in case any of you are able to find a fix for this, right now I can't any possible solution but blocking screen orientation which is not a solution at all. |
Storing a reference to the listener in a Fragment with |
That would help if you are using Dexter but that wouldn't fix the issue and it would not be valid for anybody using activities. |
Looks like I explained not correctly. I meant, to use such a fragment (with I expect this will extend lifetime of references stored in |
@nsk90 I think that's not going to work because the listener would hold a reference to a destroyed activity. Even if we save the listener in a static property the activity of the developer who uses dexter will be recreated and the listener we saved would point at a dead activity :( |
This is a serious bug. At least make some kind of broadcast so we can check that rights were granted or means to cancel this dialog after rotation. |
Indeed! It's a serious bug @deinlandel. Keep in mind, I'm the only developer actively working on this project for years and I have to maintain the other company repositories. https://github.com/Karumi/KotlinSnapshot and https://github.com/Karumi/Shot are just two examples. I'm afraid I only have 12 days per year to work on our open-source projects and two hands. If you think this is a serious bug and it is blocking you I'd really appreciate it if you can have the time to help us and collaborate. If you don't have the time, I guess you can use only portrait rotation whenever you are requesting this permission. There are also other libraries you can use if you need it. |
@pedrovgs That's okay, life often leaves us without time for our side projects. Although please at least write in library's readme that it's unmantained because you don't have time to maintain it. So new users would know that they should not expect any updates and bug fixes. |
Expected behaviour
PermissionListener passed to withListener() function is triggered after permission request.
Actual behaviour
PermissionListener is invalidated on screen rotation and its callbacks are not triggered.
Steps to reproduce
Rotate screen while showing dialog from onPermissionRationaleShouldBeShown callback.
Version of the library
6.2.2
I suppose that using ViewModel for DexterActivity should fix the problem, but it requires jetpack dependency.
The text was updated successfully, but these errors were encountered: