TangleWorker
Adds the annotated ListenableWorker to Dagger's graph via Tangle. The corresponding Worker can then be created using TangleWorkerFactory.
Since
0.12.0
Samples
import android.content.Context
import androidx.work.ListenableWorker
import androidx.work.WorkerParameters
import com.google.common.util.concurrent.ListenableFuture
import dagger.assisted.Assisted
import dagger.assisted.AssistedInject
import tangle.inject.test.utils.MyRepository
import tangle.inject.test.utils.Sample
import tangle.work.TangleWorker
fun main() {
//sampleStart
@TangleWorker
class MyWorker @AssistedInject constructor(
@Assisted context: Context,
@Assisted params: WorkerParameters,
val repository: MyRepository
) : ListenableWorker(context, params) {
override fun startWork(): ListenableFuture<Result> {
TODO()
}
}
//sampleEnd
}