-
Notifications
You must be signed in to change notification settings - Fork 173
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
Refactor/restructure injection to match modularisation and allow multiple ViewModels #10
Conversation
@@ -3,6 +3,7 @@ package org.buffer.android.boilerplate.ui.injection.module | |||
import android.app.Application | |||
import android.content.Context | |||
import com.nhaarman.mockito_kotlin.mock | |||
import dagger.Binds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are a lot of unused imports here that could be removed :)
@@ -4,6 +4,7 @@ import android.app.Application | |||
import android.arch.lifecycle.ViewModelProvider | |||
import android.arch.persistence.room.Room | |||
import android.content.Context | |||
import dagger.Binds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused imports here also!
abstract class DataModule { | ||
|
||
@Binds | ||
abstract fun bindBufferooRepository(bufferooDataRepository: BufferooDataRepository): BufferooRepository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line is too long, maybe break it before BufferooRepository?
Happy to merge this with the above changes :) Thanks @anstaendig 👍 |
This pull request was started to support multiple ViewModels via a Provider as stated in #4. After reading https://medium.com/square-corner-blog/keeping-the-daggers-sharp-%EF%B8%8F-230b3191c3f I did some restructuring and refactoring regarding the dependency injection in general. If one would believe the aforementioned article then this approach should be more performant. I also had the idea to split up the modules to match the modularisation. That means that all dependencies from inside the data module are provided/bound by
DataModule
and so on. Let me know what you think.