mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Move all binding containers to a di package and normalize their method names
Every @BindingContainer now lives in a di subpackage, in a file named after it. Containers that were declared inside a shared file (SimplePlayer.kt, LockScreenConfig.kt, VoiceMessagePresenter.kt, TimelineItemPresenterFactories.kt, MediaItemPresenterFactories.kt) are extracted into their own file. Method names are made consistent too: - @Binds functions are named bind<ConcreteParameterType>, fixing three that named something else (notably RoomAliasResolverBindingContainer, whose provider was still called providesJoinRoomPresenterFactory). - @Provides functions are named after what they provide, and all use the provides prefix rather than a mix of provide and provides. ANDROID_KEYSTORE moves back to the cryptography impl package, next to KeyStoreSecretKeyRepository which uses it; it is not DI specific and would otherwise be unreachable from there. No behaviour change: Metro discovers containers via @ContributesTo and does not care about method names, so the only call site to follow was in DefaultVoiceRecorderTest. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -17,5 +17,5 @@ import io.element.android.libraries.di.identifiers.SentrySdkDsn
|
||||
@ContributesTo(AppScope::class)
|
||||
object NoopAnalyticsBindingContainer {
|
||||
@Provides
|
||||
fun provideSentrySdkDsn(): SentrySdkDsn? = null
|
||||
fun providesSentrySdkDsn(): SentrySdkDsn? = null
|
||||
}
|
||||
|
||||
+2
-2
@@ -19,8 +19,8 @@ import io.element.android.services.analyticsproviders.sentry.SentryConfig
|
||||
@ContributesTo(AppScope::class)
|
||||
object SentryBindingContainer {
|
||||
@Provides
|
||||
fun provideSentryDsn(): SentryDsn? = SentryConfig.DSN.takeIf { it.isNotBlank() }?.let(::SentryDsn)
|
||||
fun providesSentryDsn(): SentryDsn? = SentryConfig.DSN.takeIf { it.isNotBlank() }?.let(::SentryDsn)
|
||||
|
||||
@Provides
|
||||
fun provideSentrySdkDsn(): SentrySdkDsn? = SentryConfig.SDK_DSN.takeIf { it.isNotBlank() }?.let(::SentrySdkDsn)
|
||||
fun providesSentrySdkDsn(): SentrySdkDsn? = SentryConfig.SDK_DSN.takeIf { it.isNotBlank() }?.let(::SentrySdkDsn)
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import io.element.android.services.appnavstate.impl.initializer.AppForegroundSta
|
||||
@ContributesTo(AppScope::class)
|
||||
object AppNavStateBindingContainer {
|
||||
@Provides
|
||||
fun provideAppForegroundStateService(
|
||||
fun providesAppForegroundStateService(
|
||||
@ApplicationContext context: Context
|
||||
): AppForegroundStateService =
|
||||
AppInitializer.getInstance(context).initializeComponent(AppForegroundStateServiceInitializer::class.java)
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.services.toolbox.impl.systemclock
|
||||
package io.element.android.services.toolbox.impl.systemclock.di
|
||||
|
||||
import dev.zacsweers.metro.AppScope
|
||||
import dev.zacsweers.metro.BindingContainer
|
||||
@@ -18,7 +18,7 @@ import kotlin.time.TimeSource
|
||||
@ContributesTo(AppScope::class)
|
||||
object TimeBindingContainer {
|
||||
@Provides
|
||||
fun timeSource(): TimeSource {
|
||||
fun providesTimeSource(): TimeSource {
|
||||
return TimeSource.Monotonic
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user