Кэш чатов
This commit is contained in:
37
client-mobile/core/di/WorkManagerModule.kt
Normal file
37
client-mobile/core/di/WorkManagerModule.kt
Normal file
@@ -0,0 +1,37 @@
|
||||
package core.di
|
||||
|
||||
import android.content.Context
|
||||
import androidx.work.Configuration
|
||||
import androidx.work.WorkManager
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import javax.inject.Singleton
|
||||
|
||||
/**
|
||||
* DI модуль для WorkManager
|
||||
*/
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
object WorkManagerModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideWorkManager(
|
||||
@ApplicationContext context: Context,
|
||||
configuration: Configuration
|
||||
): WorkManager {
|
||||
WorkManager.initialize(context, configuration)
|
||||
return WorkManager.getInstance(context)
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideWorkManagerConfiguration(): Configuration {
|
||||
return Configuration.Builder()
|
||||
.setMinimumLoggingLevel(android.util.Log.INFO)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user