Update metro to v0.11.0 (#6245)

* Update metro to v0.11.0

* Fix `@AssistedInject` usages

Now the injected variables in the factories must match the names in the constructors

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jorge Martín <jorgem@element.io>
This commit is contained in:
renovate[bot] 2026-02-25 16:19:47 +01:00 committed by GitHub
parent fe4554703c
commit 89a6f5a7bf
11 changed files with 23 additions and 23 deletions

View file

@ -76,7 +76,7 @@ class ConfigureRoomPresenter(
) : Presenter<ConfigureRoomState> { ) : Presenter<ConfigureRoomState> {
@AssistedFactory @AssistedFactory
interface Factory { interface Factory {
fun create(isSpace: Boolean, parentSpaceId: RoomId?): ConfigureRoomPresenter fun create(isSpace: Boolean, initialParentSpaceId: RoomId?): ConfigureRoomPresenter
} }
private val cameraPermissionPresenter: PermissionsPresenter = permissionsPresenterFactory.create(android.Manifest.permission.CAMERA) private val cameraPermissionPresenter: PermissionsPresenter = permissionsPresenterFactory.create(android.Manifest.permission.CAMERA)

View file

@ -41,7 +41,7 @@ class CreatePollNode(
private var isNavigatingUp = AtomicBoolean(false) private var isNavigatingUp = AtomicBoolean(false)
private val presenter = presenterFactory.create( private val presenter = presenterFactory.create(
backNavigator = { navigateUp = {
if (isNavigatingUp.compareAndSet(false, true)) { if (isNavigatingUp.compareAndSet(false, true)) {
navigateUp() navigateUp()
} }

View file

@ -50,7 +50,7 @@ class CreatePollPresenter(
fun interface Factory { fun interface Factory {
fun create( fun create(
timelineMode: Timeline.Mode, timelineMode: Timeline.Mode,
backNavigator: () -> Unit, navigateUp: () -> Unit,
mode: CreatePollMode mode: CreatePollMode
): CreatePollPresenter ): CreatePollPresenter
} }

View file

@ -47,7 +47,7 @@ class EditDefaultNotificationSettingPresenter(
) : Presenter<EditDefaultNotificationSettingState> { ) : Presenter<EditDefaultNotificationSettingState> {
@AssistedFactory @AssistedFactory
interface Factory { interface Factory {
fun create(oneToOne: Boolean): EditDefaultNotificationSettingPresenter fun create(isOneToOne: Boolean): EditDefaultNotificationSettingPresenter
} }
private val collator = Collator.getInstance().apply { private val collator = Collator.getInstance().apply {

View file

@ -25,8 +25,8 @@ import kotlinx.coroutines.launch
@AssistedInject @AssistedInject
class ViewFilePresenter( class ViewFilePresenter(
@Assisted("path") val path: String, @Assisted val path: String,
@Assisted("name") val name: String, @Assisted val name: String,
private val fileContentReader: FileContentReader, private val fileContentReader: FileContentReader,
private val fileShare: FileShare, private val fileShare: FileShare,
private val fileSave: FileSave, private val fileSave: FileSave,
@ -34,8 +34,8 @@ class ViewFilePresenter(
@AssistedFactory @AssistedFactory
interface Factory { interface Factory {
fun create( fun create(
@Assisted("path") path: String, path: String,
@Assisted("name") name: String, name: String,
): ViewFilePresenter ): ViewFilePresenter
} }

View file

@ -54,7 +54,7 @@ haze = "1.7.2"
dependencyAnalysis = "3.5.1" dependencyAnalysis = "3.5.1"
# DI # DI
metro = "0.10.4" metro = "0.11.0"
# Auto service # Auto service
autoservice = "1.1.1" autoservice = "1.1.1"

View file

@ -27,11 +27,11 @@ import timber.log.Timber
@AssistedInject @AssistedInject
class VacuumDatabaseWorker( class VacuumDatabaseWorker(
@Assisted workerParams: WorkerParameters, @Assisted params: WorkerParameters,
@ApplicationContext private val context: Context, @ApplicationContext private val context: Context,
private val matrixClientProvider: MatrixClientProvider, private val matrixClientProvider: MatrixClientProvider,
private val analyticsService: AnalyticsService, private val analyticsService: AnalyticsService,
) : CoroutineWorker(context, workerParams) { ) : CoroutineWorker(context, params) {
companion object { companion object {
const val SESSION_ID_PARAM = "session_id" const val SESSION_ID_PARAM = "session_id"
} }

View file

@ -37,7 +37,7 @@ interface VoiceMessagePresenterModule {
@AssistedInject @AssistedInject
class VoiceMessagePresenter( class VoiceMessagePresenter(
voiceMessagePresenterFactory: VoiceMessagePresenterFactory, voiceMessagePresenterFactory: VoiceMessagePresenterFactory,
@Assisted private val item: MediaItem.Voice, @Assisted private val content: MediaItem.Voice,
) : Presenter<VoiceMessageState> { ) : Presenter<VoiceMessageState> {
@AssistedFactory @AssistedFactory
fun interface Factory : MediaItemPresenterFactory<MediaItem.Voice, VoiceMessageState> { fun interface Factory : MediaItemPresenterFactory<MediaItem.Voice, VoiceMessageState> {
@ -45,10 +45,10 @@ class VoiceMessagePresenter(
} }
private val presenter = voiceMessagePresenterFactory.createVoiceMessagePresenter( private val presenter = voiceMessagePresenterFactory.createVoiceMessagePresenter(
eventId = item.eventId, eventId = content.eventId,
mediaSource = item.mediaSource, mediaSource = content.mediaSource,
mimeType = item.mediaInfo.mimeType, mimeType = content.mediaInfo.mimeType,
filename = item.mediaInfo.filename, filename = content.mediaInfo.filename,
// TODO Get the duration for the fallback? // TODO Get the duration for the fallback?
duration = Duration.ZERO, duration = Duration.ZERO,
) )

View file

@ -44,7 +44,7 @@ import kotlin.time.Duration.Companion.seconds
@AssistedInject @AssistedInject
class FetchNotificationsWorker( class FetchNotificationsWorker(
@Assisted workerParams: WorkerParameters, @Assisted params: WorkerParameters,
@ApplicationContext private val context: Context, @ApplicationContext private val context: Context,
private val networkMonitor: NetworkMonitor, private val networkMonitor: NetworkMonitor,
private val eventResolver: NotifiableEventResolver, private val eventResolver: NotifiableEventResolver,
@ -54,7 +54,7 @@ class FetchNotificationsWorker(
private val workerDataConverter: SyncNotificationsWorkerDataConverter, private val workerDataConverter: SyncNotificationsWorkerDataConverter,
private val buildVersionSdkIntProvider: BuildVersionSdkIntProvider, private val buildVersionSdkIntProvider: BuildVersionSdkIntProvider,
private val analyticsService: AnalyticsService, private val analyticsService: AnalyticsService,
) : CoroutineWorker(context, workerParams) { ) : CoroutineWorker(context, params) {
override suspend fun doWork(): Result { override suspend fun doWork(): Result {
Timber.d("FetchNotificationsWorker started") Timber.d("FetchNotificationsWorker started")
val requests = workerDataConverter.deserialize(inputData) ?: return Result.failure() val requests = workerDataConverter.deserialize(inputData) ?: return Result.failure()

View file

@ -170,7 +170,7 @@ class FetchNotificationWorkerTest {
syncOnNotifiableEvent: SyncOnNotifiableEvent = SyncOnNotifiableEvent {}, syncOnNotifiableEvent: SyncOnNotifiableEvent = SyncOnNotifiableEvent {},
analyticsService: FakeAnalyticsService = FakeAnalyticsService(), analyticsService: FakeAnalyticsService = FakeAnalyticsService(),
) = FetchNotificationsWorker( ) = FetchNotificationsWorker(
workerParams = createWorkerParams(workDataOf("requests" to input)), params = createWorkerParams(workDataOf("requests" to input)),
context = InstrumentationRegistry.getInstrumentation().context, context = InstrumentationRegistry.getInstrumentation().context,
networkMonitor = networkMonitor, networkMonitor = networkMonitor,
eventResolver = eventResolver, eventResolver = eventResolver,

View file

@ -63,16 +63,16 @@ class DefaultVoiceMessageMediaRepo(
mxcTools: MxcTools, mxcTools: MxcTools,
private val matrixMediaLoader: MatrixMediaLoader, private val matrixMediaLoader: MatrixMediaLoader,
@Assisted private val mediaSource: MediaSource, @Assisted private val mediaSource: MediaSource,
@Assisted("mimeType") private val mimeType: String?, @Assisted private val mimeType: String?,
@Assisted("filename") private val filename: String?, @Assisted private val filename: String?,
) : VoiceMessageMediaRepo { ) : VoiceMessageMediaRepo {
@ContributesBinding(RoomScope::class) @ContributesBinding(RoomScope::class)
@AssistedFactory @AssistedFactory
fun interface Factory : VoiceMessageMediaRepo.Factory { fun interface Factory : VoiceMessageMediaRepo.Factory {
override fun create( override fun create(
mediaSource: MediaSource, mediaSource: MediaSource,
@Assisted("mimeType") mimeType: String?, @Assisted mimeType: String?,
@Assisted("filename") filename: String?, @Assisted filename: String?,
): DefaultVoiceMessageMediaRepo ): DefaultVoiceMessageMediaRepo
} }