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

Refactor/restructure injection to match modularisation and allow multiple ViewModels #10

Merged
merged 2 commits into from
Sep 12, 2018

Conversation

anstaendig
Copy link
Contributor

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.

@@ -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
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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?

@hitherejoe
Copy link
Collaborator

Happy to merge this with the above changes :) Thanks @anstaendig 👍

@hitherejoe hitherejoe merged commit 09f7462 into bufferapp:master Sep 12, 2018
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.

3 participants