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

View File

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