Skip to content

Commit 6452b5c

Browse files
committed
Make DefaultMdmService a singleton and use Binds instead of Provides.
1 parent 882020f commit 6452b5c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

vector-app/src/main/java/im/vector/app/core/di/SingletonModule.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ import javax.inject.Singleton
111111
@Binds
112112
abstract fun bindEmojiSpanify(emojiCompatWrapper: EmojiCompatWrapper): EmojiSpanify
113113

114+
@Binds
115+
abstract fun bindMdmService(service: DefaultMdmService): MdmService
116+
114117
@Binds
115118
abstract fun bindFontScale(fontScale: FontScalePreferencesImpl): FontScalePreferences
116119

@@ -173,11 +176,6 @@ import javax.inject.Singleton
173176
return Matrix(context, configuration)
174177
}
175178

176-
@Provides
177-
fun providesMdmService(context: Context): MdmService {
178-
return DefaultMdmService(context)
179-
}
180-
181179
@Provides
182180
fun providesCurrentSession(activeSessionHolder: ActiveSessionHolder): Session {
183181
// TODO handle session injection better

vector/src/main/java/im/vector/app/features/mdm/DefaultMdmService.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ import androidx.core.content.getSystemService
2525
import dagger.hilt.android.qualifiers.ApplicationContext
2626
import timber.log.Timber
2727
import javax.inject.Inject
28+
import javax.inject.Singleton
2829

30+
@Singleton
2931
class DefaultMdmService @Inject constructor(
3032
@ApplicationContext applicationContext: Context
3133
) : MdmService {

0 commit comments

Comments
 (0)