From 9b9fef1aa8071da95208f29b8b16ab928d0b2552 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 17 Oct 2024 12:21:15 +0200 Subject: [PATCH] Rework: use @AssistedFactory and comment out the UserProfileModule. --- .../userprofile/impl/di/UserProfileModule.kt | 33 ------------------- .../impl/root/UserProfilePresenter.kt | 2 ++ 2 files changed, 2 insertions(+), 33 deletions(-) delete mode 100644 features/userprofile/impl/src/main/kotlin/io/element/android/features/userprofile/impl/di/UserProfileModule.kt diff --git a/features/userprofile/impl/src/main/kotlin/io/element/android/features/userprofile/impl/di/UserProfileModule.kt b/features/userprofile/impl/src/main/kotlin/io/element/android/features/userprofile/impl/di/UserProfileModule.kt deleted file mode 100644 index ae30b10175..0000000000 --- a/features/userprofile/impl/src/main/kotlin/io/element/android/features/userprofile/impl/di/UserProfileModule.kt +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2024 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only - * Please see LICENSE in the repository root for full details. - */ - -package io.element.android.features.userprofile.impl.di - -import com.squareup.anvil.annotations.ContributesTo -import dagger.Module -import dagger.Provides -import io.element.android.features.createroom.api.StartDMAction -import io.element.android.features.userprofile.impl.root.UserProfilePresenter -import io.element.android.libraries.di.SessionScope -import io.element.android.libraries.matrix.api.MatrixClient -import io.element.android.libraries.matrix.api.core.UserId - -@Module -@ContributesTo(SessionScope::class) -object UserProfileModule { - @Provides - fun provideUserProfilePresenterFactory( - matrixClient: MatrixClient, - startDMAction: StartDMAction, - ): UserProfilePresenter.Factory { - return object : UserProfilePresenter.Factory { - override fun create(userId: UserId): UserProfilePresenter { - return UserProfilePresenter(userId, matrixClient, startDMAction) - } - } - } -} diff --git a/features/userprofile/impl/src/main/kotlin/io/element/android/features/userprofile/impl/root/UserProfilePresenter.kt b/features/userprofile/impl/src/main/kotlin/io/element/android/features/userprofile/impl/root/UserProfilePresenter.kt index 136ffcb206..fb696c3257 100644 --- a/features/userprofile/impl/src/main/kotlin/io/element/android/features/userprofile/impl/root/UserProfilePresenter.kt +++ b/features/userprofile/impl/src/main/kotlin/io/element/android/features/userprofile/impl/root/UserProfilePresenter.kt @@ -16,6 +16,7 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import dagger.assisted.Assisted +import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject import io.element.android.features.createroom.api.StartDMAction import io.element.android.features.userprofile.shared.UserProfileEvents @@ -41,6 +42,7 @@ class UserProfilePresenter @AssistedInject constructor( private val client: MatrixClient, private val startDMAction: StartDMAction, ) : Presenter { + @AssistedFactory interface Factory { fun create(userId: UserId): UserProfilePresenter }