mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-10-31 16:22:49 +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:
-20
@@ -8,12 +8,7 @@
|
||||
|
||||
package io.element.android.features.lockscreen.impl
|
||||
|
||||
import dev.zacsweers.metro.AppScope
|
||||
import dev.zacsweers.metro.BindingContainer
|
||||
import dev.zacsweers.metro.ContributesTo
|
||||
import dev.zacsweers.metro.Provides
|
||||
import kotlin.time.Duration
|
||||
import io.element.android.appconfig.LockScreenConfig as AppConfigLockScreenConfig
|
||||
|
||||
data class LockScreenConfig(
|
||||
val isPinMandatory: Boolean,
|
||||
@@ -24,18 +19,3 @@ data class LockScreenConfig(
|
||||
val isStrongBiometricsEnabled: Boolean,
|
||||
val isWeakBiometricsEnabled: Boolean,
|
||||
)
|
||||
|
||||
@ContributesTo(AppScope::class)
|
||||
@BindingContainer
|
||||
object LockScreenConfigBindingContainer {
|
||||
@Provides
|
||||
fun providesLockScreenConfig(): LockScreenConfig = LockScreenConfig(
|
||||
isPinMandatory = AppConfigLockScreenConfig.IS_PIN_MANDATORY,
|
||||
forbiddenPinCodes = AppConfigLockScreenConfig.FORBIDDEN_PIN_CODES,
|
||||
pinSize = AppConfigLockScreenConfig.PIN_SIZE,
|
||||
maxPinCodeAttemptsBeforeLogout = AppConfigLockScreenConfig.MAX_PIN_CODE_ATTEMPTS_BEFORE_LOGOUT,
|
||||
gracePeriod = AppConfigLockScreenConfig.GRACE_PERIOD,
|
||||
isStrongBiometricsEnabled = AppConfigLockScreenConfig.IS_STRONG_BIOMETRICS_ENABLED,
|
||||
isWeakBiometricsEnabled = AppConfigLockScreenConfig.IS_WEAK_BIOMETRICS_ENABLED,
|
||||
)
|
||||
}
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2026 Element Creations Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.features.lockscreen.impl.di
|
||||
|
||||
import dev.zacsweers.metro.AppScope
|
||||
import dev.zacsweers.metro.BindingContainer
|
||||
import dev.zacsweers.metro.ContributesTo
|
||||
import dev.zacsweers.metro.Provides
|
||||
import io.element.android.features.lockscreen.impl.LockScreenConfig
|
||||
|
||||
@ContributesTo(AppScope::class)
|
||||
@BindingContainer
|
||||
object LockScreenConfigBindingContainer {
|
||||
@Provides
|
||||
fun providesLockScreenConfig(): LockScreenConfig = LockScreenConfig(
|
||||
isPinMandatory = io.element.android.appconfig.LockScreenConfig.IS_PIN_MANDATORY,
|
||||
forbiddenPinCodes = io.element.android.appconfig.LockScreenConfig.FORBIDDEN_PIN_CODES,
|
||||
pinSize = io.element.android.appconfig.LockScreenConfig.PIN_SIZE,
|
||||
maxPinCodeAttemptsBeforeLogout = io.element.android.appconfig.LockScreenConfig.MAX_PIN_CODE_ATTEMPTS_BEFORE_LOGOUT,
|
||||
gracePeriod = io.element.android.appconfig.LockScreenConfig.GRACE_PERIOD,
|
||||
isStrongBiometricsEnabled = io.element.android.appconfig.LockScreenConfig.IS_STRONG_BIOMETRICS_ENABLED,
|
||||
isWeakBiometricsEnabled = io.element.android.appconfig.LockScreenConfig.IS_WEAK_BIOMETRICS_ENABLED,
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user