mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-10-31 08:15:02 +00:00
Rename all @BindingContainer types with a BindingContainer suffix
Metro's @BindingContainer replaced Dagger's @Module, but the declarations kept the old Module suffix. Rename them (and their dedicated files) so the type name matches the annotation, matching UserStatusBindingContainer which already followed this convention. No behaviour change: Metro discovers containers via @ContributesTo, so there were only two call sites to update, both in tests. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,7 @@ import kotlin.reflect.KClass
|
||||
*
|
||||
* @BindingContainer
|
||||
* @ContributesTo(Scope::class)
|
||||
* abstract class YourNodeModule {
|
||||
* abstract class YourNodeBindingContainer {
|
||||
|
||||
* @Binds
|
||||
* @IntoMap
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ import java.io.File
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(AppScope::class)
|
||||
object AppModule {
|
||||
object AppBindingContainer {
|
||||
@Provides
|
||||
@BaseDirectory
|
||||
fun providesBaseDirectory(@ApplicationContext context: Context): File {
|
||||
+1
-1
@@ -18,7 +18,7 @@ import io.element.android.libraries.architecture.Presenter
|
||||
|
||||
@ContributesTo(AppScope::class)
|
||||
@BindingContainer
|
||||
interface AnalyticsModule {
|
||||
interface AnalyticsBindingContainer {
|
||||
@Binds
|
||||
fun bindAnalyticsPreferencesPresenter(presenter: AnalyticsPreferencesPresenter): Presenter<AnalyticsPreferencesState>
|
||||
}
|
||||
+1
-1
@@ -21,7 +21,7 @@ import kotlinx.coroutines.CoroutineScope
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(RoomScope::class)
|
||||
object ContentScannerModule {
|
||||
object ContentScannerBindingContainer {
|
||||
@Provides
|
||||
@SingleIn(RoomScope::class)
|
||||
fun providesContentScannerService(
|
||||
+5
-5
@@ -15,16 +15,16 @@ import io.element.android.tests.testutils.testCoroutineDispatchers
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.Test
|
||||
|
||||
class ContentScannerModuleTest {
|
||||
class ContentScannerBindingContainerTest {
|
||||
@Test
|
||||
fun `ContentScannerModule provides NoopContentScannerService when ContentScanner is null`() = runTest {
|
||||
fun `ContentScannerBindingContainer provides NoopContentScannerService when ContentScanner is null`() = runTest {
|
||||
// Given
|
||||
val contentScanner: ContentScanner? = null
|
||||
val sessionCoroutineScope = backgroundScope
|
||||
val coroutineDispatchers = testCoroutineDispatchers()
|
||||
|
||||
// When
|
||||
val contentScannerService = ContentScannerModule.providesContentScannerService(
|
||||
val contentScannerService = ContentScannerBindingContainer.providesContentScannerService(
|
||||
contentScanner = contentScanner,
|
||||
coroutineScope = sessionCoroutineScope,
|
||||
coroutineDispatchers = coroutineDispatchers,
|
||||
@@ -35,14 +35,14 @@ class ContentScannerModuleTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `ContentScannerModule provides DefaultContentScannerService when ContentScanner is not null`() = runTest {
|
||||
fun `ContentScannerBindingContainer provides DefaultContentScannerService when ContentScanner is not null`() = runTest {
|
||||
// Given
|
||||
val contentScanner: ContentScanner? = FakeContentScanner()
|
||||
val sessionCoroutineScope = backgroundScope
|
||||
val coroutineDispatchers = testCoroutineDispatchers()
|
||||
|
||||
// When
|
||||
val contentScannerService = ContentScannerModule.providesContentScannerService(
|
||||
val contentScannerService = ContentScannerBindingContainer.providesContentScannerService(
|
||||
contentScanner = contentScanner,
|
||||
coroutineScope = sessionCoroutineScope,
|
||||
coroutineDispatchers = coroutineDispatchers,
|
||||
+1
-1
@@ -18,7 +18,7 @@ import io.element.android.libraries.di.SessionScope
|
||||
|
||||
@ContributesTo(SessionScope::class)
|
||||
@BindingContainer
|
||||
interface FtueModule {
|
||||
interface FtueBindingContainer {
|
||||
@Binds
|
||||
fun bindChooseSelfVerificationMethodPresenter(presenter: ChooseSelfVerificationModePresenter): Presenter<ChooseSelfVerificationModeState>
|
||||
}
|
||||
+1
-1
@@ -18,7 +18,7 @@ import io.element.android.libraries.di.SessionScope
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(SessionScope::class)
|
||||
interface HomeSpacesModule {
|
||||
interface HomeSpacesBindingContainer {
|
||||
@Binds
|
||||
fun bindHomeSpacesPresenter(presenter: HomeSpacesPresenter): Presenter<HomeSpacesState>
|
||||
}
|
||||
+1
-1
@@ -26,7 +26,7 @@ import io.element.android.libraries.di.SessionScope
|
||||
|
||||
@ContributesTo(SessionScope::class)
|
||||
@BindingContainer
|
||||
interface RoomListModule {
|
||||
interface RoomListBindingContainer {
|
||||
@Binds
|
||||
fun bindRoomListPresenter(presenter: RoomListPresenter): Presenter<RoomListState>
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import io.element.android.libraries.matrix.api.MatrixClient
|
||||
|
||||
@ContributesTo(SessionScope::class)
|
||||
@BindingContainer
|
||||
interface InviteModule {
|
||||
interface InviteBindingContainer {
|
||||
@Binds
|
||||
fun bindAcceptDeclinePresenter(presenter: AcceptDeclineInvitePresenter): Presenter<AcceptDeclineInviteState>
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import java.util.Optional
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(SessionScope::class)
|
||||
object JoinRoomModule {
|
||||
object JoinRoomBindingContainer {
|
||||
@Provides
|
||||
fun providesJoinRoomPresenterFactory(
|
||||
client: MatrixClient,
|
||||
+1
-1
@@ -20,7 +20,7 @@ import io.element.android.libraries.matrix.api.room.powerlevels.permissionsFlow
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(RoomScope::class)
|
||||
object KnockRequestsModule {
|
||||
object KnockRequestsBindingContainer {
|
||||
@Provides
|
||||
@SingleIn(RoomScope::class)
|
||||
fun knockRequestsService(room: JoinedRoom): KnockRequestsService {
|
||||
+1
-1
@@ -18,7 +18,7 @@ import io.element.android.libraries.di.SessionScope
|
||||
|
||||
@ContributesTo(SessionScope::class)
|
||||
@BindingContainer
|
||||
interface LeaveRoomModule {
|
||||
interface LeaveRoomBindingContainer {
|
||||
@Binds
|
||||
fun bindLeaveRoomPresenter(presenter: LeaveRoomPresenter): Presenter<LeaveRoomState>
|
||||
}
|
||||
+1
-1
@@ -27,7 +27,7 @@ data class LockScreenConfig(
|
||||
|
||||
@ContributesTo(AppScope::class)
|
||||
@BindingContainer
|
||||
object LockScreenConfigModule {
|
||||
object LockScreenConfigBindingContainer {
|
||||
@Provides
|
||||
fun providesLockScreenConfig(): LockScreenConfig = LockScreenConfig(
|
||||
isPinMandatory = AppConfigLockScreenConfig.IS_PIN_MANDATORY,
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ import io.element.android.libraries.architecture.Presenter
|
||||
|
||||
@ContributesTo(AppScope::class)
|
||||
@BindingContainer
|
||||
interface LoginModule {
|
||||
interface LoginBindingContainer {
|
||||
@Binds
|
||||
fun bindChangeServerPresenter(presenter: ChangeServerPresenter): Presenter<ChangeServerState>
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import io.element.android.libraries.di.SessionScope
|
||||
|
||||
@ContributesTo(SessionScope::class)
|
||||
@BindingContainer
|
||||
interface LogoutModule {
|
||||
interface LogoutBindingContainer {
|
||||
@Binds
|
||||
fun bindDirectLogoutPresenter(presenter: DirectLogoutPresenter): Presenter<DirectLogoutState>
|
||||
}
|
||||
+1
-1
@@ -34,7 +34,7 @@ import io.element.android.libraries.di.RoomScope
|
||||
|
||||
@ContributesTo(RoomScope::class)
|
||||
@BindingContainer
|
||||
interface MessagesBindsModule {
|
||||
interface MessagesBindingContainer {
|
||||
@Binds
|
||||
fun bindPinnedMessagesBannerPresenter(presenter: PinnedMessagesBannerPresenter): Presenter<PinnedMessagesBannerState>
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import io.element.android.libraries.matrix.api.timeline.Timeline
|
||||
|
||||
@ContributesTo(RoomScope::class)
|
||||
@BindingContainer
|
||||
object MessagesProvidesModule {
|
||||
object MessagesProvidesBindingContainer {
|
||||
@Provides
|
||||
@LiveTimeline
|
||||
fun provideLiveTimeline(joinedRoom: JoinedRoom): Timeline = joinedRoom.liveTimeline
|
||||
+1
-1
@@ -27,7 +27,7 @@ import kotlin.reflect.KClass
|
||||
*/
|
||||
@BindingContainer
|
||||
@ContributesTo(RoomScope::class)
|
||||
interface TimelineItemPresenterFactoriesModule {
|
||||
interface TimelineItemPresenterFactoriesBindingContainer {
|
||||
@Multibinds
|
||||
fun multiBindTimelineItemPresenterFactories(): @JvmSuppressWildcards Map<KClass<out TimelineItemEventContent>, TimelineItemPresenterFactory<*, *>>
|
||||
}
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import io.element.android.libraries.voiceplayer.api.VoiceMessageState
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(RoomScope::class)
|
||||
interface VoiceMessagePresenterModule {
|
||||
interface VoiceMessagePresenterBindingContainer {
|
||||
@Binds
|
||||
@IntoMap
|
||||
@TimelineItemEventContentKey(TimelineItemVoiceContent::class)
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import io.element.android.libraries.architecture.Presenter
|
||||
|
||||
@ContributesTo(AppScope::class)
|
||||
@BindingContainer
|
||||
interface DeveloperSettingsModule {
|
||||
interface DeveloperSettingsBindingContainer {
|
||||
@Binds
|
||||
fun bindAppDeveloperSettingsPresenter(presenter: AppDeveloperSettingsPresenter): Presenter<AppDeveloperSettingsState>
|
||||
}
|
||||
+1
-1
@@ -22,7 +22,7 @@ import io.element.android.libraries.architecture.Presenter
|
||||
|
||||
@ContributesTo(AppScope::class)
|
||||
@BindingContainer
|
||||
interface RageshakeModule {
|
||||
interface RageshakeBindingContainer {
|
||||
@Binds
|
||||
fun bindRageshakePreferencesPresenter(presenter: RageshakePreferencesPresenter): Presenter<RageshakePreferencesState>
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import io.element.android.libraries.matrix.api.core.RoomAlias
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(SessionScope::class)
|
||||
object RoomAliasResolverModule {
|
||||
object RoomAliasResolverBindingContainer {
|
||||
@Provides
|
||||
fun providesJoinRoomPresenterFactory(
|
||||
client: MatrixClient,
|
||||
+1
-1
@@ -18,7 +18,7 @@ import io.element.android.libraries.di.RoomScope
|
||||
|
||||
@ContributesTo(RoomScope::class)
|
||||
@BindingContainer
|
||||
interface RoomCallModule {
|
||||
interface RoomCallBindingContainer {
|
||||
@Binds
|
||||
fun bindRoomCallStatePresenter(presenter: RoomCallStatePresenter): Presenter<RoomCallState>
|
||||
}
|
||||
+1
-1
@@ -21,7 +21,7 @@ import io.element.android.libraries.matrix.api.room.JoinedRoom
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(RoomScope::class)
|
||||
object RoomMemberModule {
|
||||
object RoomMemberBindingContainer {
|
||||
@Provides
|
||||
fun provideRoomMemberDetailsPresenterFactory(
|
||||
room: JoinedRoom,
|
||||
+1
-1
@@ -18,7 +18,7 @@ import io.element.android.libraries.di.RoomScope
|
||||
|
||||
@ContributesTo(RoomScope::class)
|
||||
@BindingContainer
|
||||
interface RoomMemberModerationModule {
|
||||
interface RoomMemberModerationBindingContainer {
|
||||
@Binds
|
||||
fun bindRoomMemberModerationPresenter(presenter: RoomMemberModerationPresenter): Presenter<RoomMemberModerationState>
|
||||
}
|
||||
+1
-1
@@ -22,7 +22,7 @@ import timber.log.Timber
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(AppScope::class)
|
||||
object CacheStoreModule {
|
||||
object CacheStoreBindingContainer {
|
||||
@Provides
|
||||
@SingleIn(AppScope::class)
|
||||
fun provideCacheDatabase(
|
||||
+1
-1
@@ -18,7 +18,7 @@ internal const val ANDROID_KEYSTORE = "AndroidKeyStore"
|
||||
|
||||
@ContributesTo(AppScope::class)
|
||||
@BindingContainer
|
||||
object CryptographyModule {
|
||||
object CryptographyBindingContainer {
|
||||
@Provides
|
||||
fun providesAndroidKeyStore(): KeyStore {
|
||||
return KeyStore.getInstance(ANDROID_KEYSTORE).apply {
|
||||
+1
-1
@@ -19,7 +19,7 @@ import kotlin.time.Clock
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(AppScope::class)
|
||||
object DateFormatterModule {
|
||||
object DateFormatterBindingContainer {
|
||||
@Provides
|
||||
fun providesClock(): Clock = Clock.System
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import io.element.android.libraries.featureflag.impl.PreferencesFeatureFlagProvi
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(AppScope::class)
|
||||
object FeatureFlagModule {
|
||||
object FeatureFlagBindingContainer {
|
||||
@JvmStatic
|
||||
@Provides
|
||||
@ElementsIntoSet
|
||||
+1
-1
@@ -18,7 +18,7 @@ import io.element.android.libraries.fullscreenintent.impl.FullScreenIntentPermis
|
||||
|
||||
@ContributesTo(AppScope::class)
|
||||
@BindingContainer
|
||||
interface FullScreenIntentModule {
|
||||
interface FullScreenIntentBindingContainer {
|
||||
@Binds
|
||||
fun bindFullScreenIntentPermissionsPresenter(presenter: FullScreenIntentPermissionsPresenter): Presenter<FullScreenIntentPermissionsState>
|
||||
}
|
||||
+1
-1
@@ -18,7 +18,7 @@ import kotlinx.coroutines.CoroutineScope
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(RoomScope::class)
|
||||
object RoomModule {
|
||||
object RoomBindingContainer {
|
||||
@RoomCoroutineScope
|
||||
@Provides
|
||||
fun providesSessionCoroutineScope(room: BaseRoom): CoroutineScope {
|
||||
+1
-1
@@ -34,7 +34,7 @@ import kotlinx.coroutines.CoroutineScope
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(SessionScope::class)
|
||||
object SessionMatrixModule {
|
||||
object SessionMatrixBindingContainer {
|
||||
@Provides
|
||||
fun providesSessionId(matrixClient: MatrixClient): SessionId {
|
||||
return matrixClient.sessionId
|
||||
+1
-1
@@ -46,7 +46,7 @@ interface SimplePlayer {
|
||||
|
||||
@ContributesTo(RoomScope::class)
|
||||
@BindingContainer
|
||||
object SimplePlayerModule {
|
||||
object SimplePlayerBindingContainer {
|
||||
@Provides
|
||||
fun simplePlayerProvider(
|
||||
@ApplicationContext context: Context,
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import kotlin.reflect.KClass
|
||||
*/
|
||||
@BindingContainer
|
||||
@ContributesTo(RoomScope::class)
|
||||
interface MediaItemPresenterFactoriesModule {
|
||||
interface MediaItemPresenterFactoriesBindingContainer {
|
||||
@Multibinds
|
||||
fun multiBindMediaItemPresenterFactories(): @JvmSuppressWildcards Map<KClass<out MediaItem.Event>, MediaItemPresenterFactory<*, *>>
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import kotlin.time.Duration
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(RoomScope::class)
|
||||
interface VoiceMessagePresenterModule {
|
||||
interface VoiceMessagePresenterBindingContainer {
|
||||
@Binds
|
||||
@IntoMap
|
||||
@MediaItemEventContentKey(MediaItem.Voice::class)
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ import java.util.concurrent.TimeUnit
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(AppScope::class)
|
||||
object NetworkModule {
|
||||
object NetworkBindingContainer {
|
||||
@Provides
|
||||
@SingleIn(AppScope::class)
|
||||
fun providesOkHttpClient(
|
||||
+1
-1
@@ -19,7 +19,7 @@ import kotlinx.coroutines.CoroutineScope
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(SessionScope::class)
|
||||
object SessionPreferencesModule {
|
||||
object SessionPreferencesBindingContainer {
|
||||
@Provides
|
||||
fun providesSessionPreferencesStore(
|
||||
defaultSessionPreferencesStoreFactory: DefaultSessionPreferencesStoreFactory,
|
||||
+1
-1
@@ -22,7 +22,7 @@ import io.element.android.libraries.push.impl.battery.BatteryOptimizationPresent
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(AppScope::class)
|
||||
interface PushModule {
|
||||
interface PushBindingContainer {
|
||||
companion object {
|
||||
@Provides
|
||||
fun provideNotificationCompatManager(@ApplicationContext context: Context): NotificationManagerCompat {
|
||||
+1
-1
@@ -23,7 +23,7 @@ import timber.log.Timber
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(AppScope::class)
|
||||
object PushHistoryModule {
|
||||
object PushHistoryBindingContainer {
|
||||
@Provides
|
||||
@SingleIn(AppScope::class)
|
||||
fun providePushDatabase(
|
||||
+1
-1
@@ -23,7 +23,7 @@ import timber.log.Timber
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(AppScope::class)
|
||||
object SessionStorageModule {
|
||||
object SessionStorageBindingContainer {
|
||||
@Provides
|
||||
@SingleIn(AppScope::class)
|
||||
fun provideMatrixDatabase(
|
||||
+1
-1
@@ -22,7 +22,7 @@ import io.element.android.opusencoder.OggOpusEncoder
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(RoomScope::class)
|
||||
object VoiceRecorderModule {
|
||||
object VoiceRecorderBindingContainer {
|
||||
@Provides
|
||||
fun provideAudioConfig(): AudioConfig {
|
||||
val sampleRate = SampleRate
|
||||
+2
-2
@@ -18,7 +18,7 @@ import io.element.android.libraries.voicerecorder.api.VoiceRecorderState
|
||||
import io.element.android.libraries.voicerecorder.impl.audio.Audio
|
||||
import io.element.android.libraries.voicerecorder.impl.audio.AudioConfig
|
||||
import io.element.android.libraries.voicerecorder.impl.audio.SampleRate
|
||||
import io.element.android.libraries.voicerecorder.impl.di.VoiceRecorderModule
|
||||
import io.element.android.libraries.voicerecorder.impl.di.VoiceRecorderBindingContainer
|
||||
import io.element.android.libraries.voicerecorder.test.FakeAudioLevelCalculator
|
||||
import io.element.android.libraries.voicerecorder.test.FakeAudioReaderFactory
|
||||
import io.element.android.libraries.voicerecorder.test.FakeEncoder
|
||||
@@ -151,7 +151,7 @@ class DefaultVoiceRecorderTest {
|
||||
}
|
||||
|
||||
private fun TestScope.createDefaultVoiceRecorder(): DefaultVoiceRecorder {
|
||||
val fileConfig = VoiceRecorderModule.provideVoiceFileConfig()
|
||||
val fileConfig = VoiceRecorderBindingContainer.provideVoiceFileConfig()
|
||||
return DefaultVoiceRecorder(
|
||||
dispatchers = testCoroutineDispatchers(),
|
||||
timeSource = timeSource,
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import io.element.android.libraries.di.annotations.ApplicationContext
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(AppScope::class)
|
||||
object WorkManagerModule {
|
||||
object WorkManagerBindingContainer {
|
||||
@Provides
|
||||
@SingleIn(AppScope::class)
|
||||
fun providesWorkManager(
|
||||
+1
-1
@@ -15,7 +15,7 @@ import io.element.android.libraries.di.identifiers.SentrySdkDsn
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(AppScope::class)
|
||||
object NoopAnalyticsModule {
|
||||
object NoopAnalyticsBindingContainer {
|
||||
@Provides
|
||||
fun provideSentrySdkDsn(): SentrySdkDsn? = null
|
||||
}
|
||||
+1
-1
@@ -17,7 +17,7 @@ import io.element.android.services.analyticsproviders.sentry.SentryConfig
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(AppScope::class)
|
||||
object SentryModule {
|
||||
object SentryBindingContainer {
|
||||
@Provides
|
||||
fun provideSentryDsn(): SentryDsn? = SentryConfig.DSN.takeIf { it.isNotBlank() }?.let(::SentryDsn)
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ import io.element.android.services.appnavstate.impl.initializer.AppForegroundSta
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(AppScope::class)
|
||||
object AppNavStateModule {
|
||||
object AppNavStateBindingContainer {
|
||||
@Provides
|
||||
fun provideAppForegroundStateService(
|
||||
@ApplicationContext context: Context
|
||||
+1
-1
@@ -16,7 +16,7 @@ import kotlin.time.TimeSource
|
||||
|
||||
@BindingContainer
|
||||
@ContributesTo(AppScope::class)
|
||||
object TimeModule {
|
||||
object TimeBindingContainer {
|
||||
@Provides
|
||||
fun timeSource(): TimeSource {
|
||||
return TimeSource.Monotonic
|
||||
Reference in New Issue
Block a user