Hi,
This is more of a question. I'm trying to understand the process of providing a different instance of OkHttpClient without interfering with library's functionality.
Furthermore, if we provide our own instance of OkHttpClient, no TMDbInterceptor is attached to it, unless we add it to OkHttpClient ourselves and also set the TMDb.tmdbInterceptor, as it seems that it only gets instantiated in defaultOkHttpClient() function, and several functionalities of the library depend on TMDb.tmdbInterceptor not being null.
I'm not sure about all these and it would be great if you could shed some light on this matter.
If I'm right though, it seems that if the defaultOkHttpClient() get called anyway, regardless of user providing OkHttpClient or not, could be the solution. Of course it needs to instantiate a new OkHttpClient if user has not provided one, and then modify it (add Interceptor) and also instantiate the TMDb.tmdbInterceptor.
Hi, This is more of a question. I'm trying to understand the process of providing a different instance of
OkHttpClient
without interfering with library's functionality.As stated in documentation, it is possible to add certain modifications to
TMDbInterceptor
and then assign the new Interceptor toTMDb.tmdbInterceptor
before callinginit
. However it seems thatTMDb.tmdbInterceptor
is immediately overwritten indefaultOkHttpClient()
function: https://github.com/vkay94/TMDb-Kotlin/blob/5feaa37702d65a84ac9d58e88187e49b88a6e353/src/main/java/de/vkay/api/tmdb/TMDb.kt#L159-L162Furthermore, if we provide our own instance of
OkHttpClient
, noTMDbInterceptor
is attached to it, unless we add it toOkHttpClient
ourselves and also set theTMDb.tmdbInterceptor
, as it seems that it only gets instantiated indefaultOkHttpClient()
function, and several functionalities of the library depend onTMDb.tmdbInterceptor
not being null.I'm not sure about all these and it would be great if you could shed some light on this matter.
If I'm right though, it seems that if the
defaultOkHttpClient()
get called anyway, regardless of user providing OkHttpClient or not, could be the solution. Of course it needs to instantiate a newOkHttpClient
if user has not provided one, and then modify it (add Interceptor) and also instantiate theTMDb.tmdbInterceptor
.