Skip to content

Commit

Permalink
Merge pull request #8 from FunnyDevs/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
FunnyDevs authored Jan 18, 2023
2 parents a1169fe + 5d14745 commit 5ce6c9f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.funnydevs.hilt_conductor.demo

import com.bluelinelabs.conductor.Controller
import com.funnydevs.hilt_conductor.ControllerComponent
import com.funnydevs.hilt_conductor.annotations.ControllerScoped
import dagger.Module
Expand All @@ -19,5 +20,7 @@ object HiltModule {
@Provides
@ControllerScoped
@Named("second")
fun textTwo(): String = "Hello Moon"
fun textTwo(controller: Controller): String {
return "Hello Moon"
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ android.enableJetifier=false
kotlin.code.style=official

GROUP=io.github.funnydevs
VERSION=0.4.1
VERSION=0.5.0



Expand Down
1 change: 1 addition & 0 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies {

api project(":annotations")
implementation libraries.hilt_android
implementation libraries.conductor

annotationProcessor libraries.hilt_android_compiler

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import android.app.Activity;

import com.bluelinelabs.conductor.Controller;

import javax.inject.Inject;
import javax.inject.Singleton;

Expand All @@ -21,9 +23,10 @@ public ConductorComponentLifecycleHandler(ControllerComponent.Factory factory) {
this.factory = factory;
}

public void inject(Activity activity) {
public void inject(Activity activity, Controller controller) {
controllerComponent = factory
.activity(activity)
.controller(controller)
.create();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.Activity;

import com.bluelinelabs.conductor.Controller;
import com.funnydevs.hilt_conductor.annotations.ControllerScoped;

import dagger.BindsInstance;
Expand All @@ -17,7 +18,8 @@ public interface ControllerComponent {

@DefineComponent.Builder
public interface Factory {
public Factory activity(@BindsInstance Activity activity);
Factory activity(@BindsInstance Activity activity);
Factory controller(@BindsInstance Controller controller);
public ControllerComponent create();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class HiltConductorTransformer(private val project: Project) : Transform() {
"dagger.hilt.EntryPoints.get(getActivity()," +
"com.funnydevs.hilt_conductor.ConductorInterface.class);\n" +
"this.handler = conductorInterface.Conductor_LifeCycleHandler();\n" +
"handler.inject(getActivity());\n"+
"handler.inject(getActivity(),this);\n"+
"$hiltInterface hiltInterface = dagger.hilt.EntryPoints.get(handler,${hiltInterface}.class);\n"
+injectableFields)
}
Expand Down

0 comments on commit 5ce6c9f

Please sign in to comment.