Rework: use @AssistedFactory and comment out the UserProfileModule.
This commit is contained in:
committed by
Benoit Marty
parent
2d16a4db6a
commit
9b9fef1aa8
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<UserProfileState> {
|
||||
@AssistedFactory
|
||||
interface Factory {
|
||||
fun create(userId: UserId): UserProfilePresenter
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user