Skip to content

Commit

Permalink
Change Injector's Jvm declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
keyboardsurfer committed Oct 30, 2018
1 parent 18548ed commit 0cb7b76
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions app/src/main/java/io/plaidapp/dagger/Injector.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@file:JvmName("Injector")

package io.plaidapp.dagger

import io.plaidapp.core.dagger.DataManagerModule
Expand All @@ -27,26 +30,20 @@ import io.plaidapp.ui.PlaidApplication

/**
* Injector for HomeActivity.
*
* TODO: Convert to extension function once [HomeActivity] is converted to Kotlin.
*/
object Injector {

@JvmStatic
fun inject(
activity: HomeActivity,
dataLoadedCallback: BaseDataManager.OnDataLoadedCallback<List<PlaidItem>>
) {
DaggerHomeComponent.builder()
.coreComponent(PlaidApplication.coreComponent(activity))
.dataManagerModule(DataManagerModule(activity))
.dataLoadedModule(OnDataLoadedModule(dataLoadedCallback))
.filterAdapterModule(FilterAdapterModule(activity))
.homeModule(HomeModule(activity))
.sharedPreferencesModule(
SharedPreferencesModule(activity, LoginLocalDataSource.DESIGNER_NEWS_PREF)
)
.build()
.inject(activity)
}
fun inject(
activity: HomeActivity,
dataLoadedCallback: BaseDataManager.OnDataLoadedCallback<List<PlaidItem>>
) {
DaggerHomeComponent.builder()
.coreComponent(PlaidApplication.coreComponent(activity))
.dataManagerModule(DataManagerModule(activity))
.dataLoadedModule(OnDataLoadedModule(dataLoadedCallback))
.filterAdapterModule(FilterAdapterModule(activity))
.homeModule(HomeModule(activity))
.sharedPreferencesModule(
SharedPreferencesModule(activity, LoginLocalDataSource.DESIGNER_NEWS_PREF)
)
.build()
.inject(activity)
}

0 comments on commit 0cb7b76

Please sign in to comment.