Last active
May 26, 2023 13:37
-
-
Save DHosseiny/c3737d933133db10845bb2bd82de6770 to your computer and use it in GitHub Desktop.
AggregatorWorkerFactory
This file contains 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
/** | |
* This class aggregates hilt and dagger worker providers. | |
* TODO: This class can get removed when fully migrated to hilt | |
*/ | |
class AggregatorWorkerFactory( | |
private val hiltWorkerFactory: HiltWorkerFactory, | |
private val daggerWorkerFactory: DaggerWorkerFactory | |
) : WorkerFactory() { | |
override fun createWorker( | |
appContext: Context, | |
workerClassName: String, | |
workerParameters: WorkerParameters | |
): ListenableWorker? { | |
return hiltWorkerFactory.createWorker(appContext, workerClassName, workerParameters) | |
?: daggerWorkerFactory.createWorker(appContext, workerClassName, workerParameters) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment