Tuesday, 15 March 2022

Android Working with Interceptors and Coroutines

I need to implement the following mechanism and need guidance on the best approach to achieve it:

I have an Android application that uses retrofit with coroutines, and MVVM style.

I want to add an interceptor to achieve the following logic:

If I receive a specific error code -> ask user for some info -> re-send the request with user info appended -> resume the flow...

I could achieve the following by launching a dialog or a bottom sheet with a callback within the interceptor, but this will require adding callbacks everywhere...

I need something more generic:

Whenever I receive this specific error code on my application (on any request) -> ask the user for some info -> repeat the request with user info appended -> resume activity/fragment logic.



from Android Working with Interceptors and Coroutines

No comments:

Post a Comment