Created
September 19, 2019 15:06
-
-
Save neonankiti/3768f7a2df03edcce1c35e151c34b855 to your computer and use it in GitHub Desktop.
DI settings for WorkManager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component(modules = [AppAssistedInjectModule::class, WorkerBindingModule::class]) | |
interface BisonAppComponent { | |
fun factory(): AppWorkerFactory | |
} | |
@Module(includes = [AssistedInject_AppAssistedInjectModule::class]) | |
@AssistedModule | |
abstract class AppAssistedInjectModule {} | |
@MapKey | |
@Target(AnnotationTarget.FUNCTION) | |
@Retention(AnnotationRetention.RUNTIME) | |
annotation class WorkerKey(val value: KClass<out ListenableWorker>) | |
@Module | |
interface WorkerBindingModule { | |
@Binds | |
@IntoMap | |
@WorkerKey(BisonWorker::class) | |
fun bindBisonWorker(factory: BisonWorker.Factory): ChildWorkerFactory | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment