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

Dagger and Coroutine improvements. #27

Open
nikhilbansal97 opened this issue Dec 8, 2019 · 4 comments
Open

Dagger and Coroutine improvements. #27

nikhilbansal97 opened this issue Dec 8, 2019 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@nikhilbansal97
Copy link

Dagger:

  1. In the AppComponent, there is Builder which can be replaced with the interface Factory : AndroidInjector.Factory<MyApplication> as Builder is deprecated in the latest version of Dagger.
  2. The fun inject(instance: MyApplication) can be removed as DaggerApplication class handles the field injections in the Application class.
  3. The @BindsInstance function can be removed as the Factory generates this code for us.

Coroutines:

  1. We can use withContext() function to switch threads in a coroutine instead of launching a new coroutine in separate thread each time.
  2. Every function should handle the thread switching for proper execution of its body instead of relying on the caller of the function.
  3. There is no thread switching needed for the database operations if the function in Dao is marked as suspend. Room uses a custom dispatcher optimised for the database operations.
@mnayef95 mnayef95 added the help wanted Extra attention is needed label Dec 8, 2019
@mnayef95
Copy link
Owner

mnayef95 commented Dec 8, 2019

@nikhilbansal97 Thank you, could you contribute to this?

@nikhilbansal97
Copy link
Author

Sure! Already working on it! 😀

@mnayef95
Copy link
Owner

@nikhilbansal97 Thank you :D

@mnayef95
Copy link
Owner

Hi @nikhilbansal97 Sorry for bothering you, but I want to ask if there is any update from your side, or should I work on it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants