Closed RuiMiguel closed 4 years ago
Hi @RuiMiguel,
Thanks for reporting! I know there was a reason we were asking for an Activity
instead of the Application
context before but, reviewing the code as it is right now, I don't see why we couldn't ask for a Context instead. In the end, we are only using it in PermissionChecker.checkSelfPermission(context, permission)
and the ghost activity we create when we really need to ask the user for permissions.
I feel reluctant to accept Context
instances again (I remember some issues with the activity stack) but we can review a PR if you feel like implementing it yourself.
Expected behaviour
Provide public API on
Dexter
object to init with Application Context, not just with Activity to check permissions with no Activity (launchingDexterActivity
to do it)Actual behaviour
I've seen that on
DexterInstanceTest
Application Context is used to setup it and check permissions test run ok. When callsDexterInstanceTest->startTransparentActivityIfNeeded
checks if context is instanceof Application. ButDexterInstance
is not a public class so, couldn't use it outside librarySteps to reproduce
run tests on
DexterInstanceTest
, setup mock Context with ApplicationVersion of the library
4.1.1