Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FOR DISCUSSION: Using coroutines for login #5695

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

psh
Copy link
Collaborator

@psh psh commented Apr 18, 2024

I split the NetworkingModule into 3 parts with the idea that as classes migrate to use coroutines they will move from one module to the other.

  1. NetworkingModule with common stuff that wont be changing (gson, cookie store, client classes, etc)
  2. RxJavaApiModule for API interfaces that still use RxJava
  3. ApiModule for API interfaces that run using coroutines

Since suspend functions need to be called from a coroutine (or another suspend function) and I cant just convert the LoginActivity from Java to Kotlin, I introduced a view model. The LoginViewModel gives us a neat viewmodelScope to run suspend functions from, and is easily created and called from Java code. (Google's view models will also survive config change too, so we should definitely look at adopting them to deal with the myriad of other related bugs)

All of that is the support ready for the real change of moving to coroutines. Check out the LoginClient and LoginInterface for making API calls.

@psh psh mentioned this pull request Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant