Last active
September 17, 2023 16:13
-
-
Save khahani/db7c6559d86c900c0fb124a4000aeae2 to your computer and use it in GitHub Desktop.
DispatcherModules.kt
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
| import [your_app_package].common.network.AppDispatchers.Default | |
| import [your_app_package].common.network.AppDispatchers.IO | |
| import [your_app_package].common.network.Dispatcher | |
| import dagger.Module | |
| import dagger.Provides | |
| import dagger.hilt.InstallIn | |
| import dagger.hilt.components.SingletonComponent | |
| import kotlinx.coroutines.CoroutineDispatcher | |
| import kotlinx.coroutines.Dispatchers | |
| @Module | |
| @InstallIn(SingletonComponent::class) | |
| object DispatchersModule { | |
| @Provides | |
| @Dispatcher(IO) // our enum AppDispatchers.IO | |
| fun providesIODispatcher(): CoroutineDispatcher = Dispatchers.IO // The couroutine IO one | |
| @Provides | |
| @Dispatcher(Default) // our enum AppDispatchers.Default | |
| fun providesDefaultDispatcher(): CoroutineDispatcher = Dispatchers.Default // The couroutine Default one | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment