zsperske
11/15/2021, 2:05 AMNick Allen
11/15/2021, 2:42 AMNick Allen
11/15/2021, 2:46 AMzsperske
11/15/2021, 3:32 AMNick Allen
11/15/2021, 3:45 AMLefko
11/15/2021, 5:37 AM@Retention(AnnotationRetention.RUNTIME)
@Qualifier
annotation class ApplicationScope
@InstallIn(SingletonComponent::class)
@Module
object CoroutinesScopesModule {
@Singleton
@ApplicationScope
@Provides
fun providesCoroutineScope(
@DefaultDispatcher defaultDispatcher: CoroutineDispatcher
): CoroutineScope = CoroutineScope(SupervisorJob() + defaultDispatcher)
}
Then just @Inject @ApplicationScope lateinit var appScope: CoroutineScope
into application class