Make DefaultMdmService a singleton and use Binds instead of Provides.

This commit is contained in:
Benoit Marty 2023-12-04 17:54:48 +01:00
parent 882020fdba
commit 6452b5c2b4
2 changed files with 5 additions and 5 deletions

View File

@ -111,6 +111,9 @@ import javax.inject.Singleton
@Binds @Binds
abstract fun bindEmojiSpanify(emojiCompatWrapper: EmojiCompatWrapper): EmojiSpanify abstract fun bindEmojiSpanify(emojiCompatWrapper: EmojiCompatWrapper): EmojiSpanify
@Binds
abstract fun bindMdmService(service: DefaultMdmService): MdmService
@Binds @Binds
abstract fun bindFontScale(fontScale: FontScalePreferencesImpl): FontScalePreferences abstract fun bindFontScale(fontScale: FontScalePreferencesImpl): FontScalePreferences
@ -173,11 +176,6 @@ import javax.inject.Singleton
return Matrix(context, configuration) return Matrix(context, configuration)
} }
@Provides
fun providesMdmService(context: Context): MdmService {
return DefaultMdmService(context)
}
@Provides @Provides
fun providesCurrentSession(activeSessionHolder: ActiveSessionHolder): Session { fun providesCurrentSession(activeSessionHolder: ActiveSessionHolder): Session {
// TODO handle session injection better // TODO handle session injection better

View File

@ -25,7 +25,9 @@ import androidx.core.content.getSystemService
import dagger.hilt.android.qualifiers.ApplicationContext import dagger.hilt.android.qualifiers.ApplicationContext
import timber.log.Timber import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class DefaultMdmService @Inject constructor( class DefaultMdmService @Inject constructor(
@ApplicationContext applicationContext: Context @ApplicationContext applicationContext: Context
) : MdmService { ) : MdmService {