onfido-android-sdk
onfido-android-sdk copied to clipboard
Provide better API for TokenExpirationHandler
Issue
Since TokenExpirationHandler
needs to be Serializable
, it limits what kind of dependencies you can have. Dependency injection is not possible because of it, which makes it hard to avoid non-testable code or code duplication.
Suggestion
Please provide better API, so we can do dependency injection.
Maybe you could at least provide us with context
reference, so we can obtain specific object instance by using entry points? For example:
class OnfidoExpirationHandler() : TokenExpirationHandler {
override fun refreshToken(injectNewToken: (Context, String?) -> Unit) {
injectNewToken( context, _ ->
val api = EntryPoints.get(context, ApiEntryPoint.class).getApi()
api.getOnfidoSdkToken()
}
}
}
Version
onfido-capture-sdk
version: 11.3.0