Open SamYStudiO opened 2 years ago
Thank you so much! would you mind sending a PR?
maybe dont need removeObservers?
PermissionsRequesterImpl
ViewModelProvider(activity).get(PermissionRequestViewModel::class.java).observe
owner is not good
Fragment.constructPermissionsRequest
owner is Fragment better use not actiity and i hope PermissionsRequester add function clear(inner call removeObservers)
Currently, if you implement call with multiple Fragments, it may refer to a Fragment that has already been destroyed, resulting in a crash.
Hello,
I have 2 constructPermissionsRequest (one for location and one for external storage) from the same fragment (i don't make them using the same construct because i want to call them in the right context and so they need to be call at different time).
Problem is the second one will never gets its callbacks called once the first one has been accepted. this is because when you call PermissionsRequesterImpl.launch ALL observers are removed. https://github.com/permissions-dispatcher/PermissionsDispatcher/blob/d7ac8bf6215edeea5c307e4bb0f71524aa3babc6/ktx/src/main/java/permissions/dispatcher/ktx/PermissionsRequesterImpl.kt#L38
Here is a user case >
Solution would be to have a unique observer for each PermissionsRequesterImpl
Environment