Browse Source

Renaming.

pull/3700/head
Benoit Marty 2 weeks ago
parent
commit
c5b0581bca
  1. 10
      features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/di/RoomMemberModule.kt
  2. 8
      features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/details/RoomMemberDetailsPresenter.kt
  3. 2
      features/roomdetails/impl/src/test/kotlin/io/element/android/features/roomdetails/RoomDetailsPresenterTest.kt
  4. 8
      features/roomdetails/impl/src/test/kotlin/io/element/android/features/roomdetails/members/details/RoomMemberDetailsPresenterTest.kt
  5. 2
      features/userprofile/api/src/main/kotlin/io/element/android/features/userprofile/api/UserProfilePresenterFactory.kt
  6. 6
      features/userprofile/impl/src/main/kotlin/io/element/android/features/userprofile/impl/DefaultUserProfilePresenterFactory.kt

10
features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/di/RoomMemberModule.kt

@ -11,7 +11,7 @@ import com.squareup.anvil.annotations.ContributesTo @@ -11,7 +11,7 @@ import com.squareup.anvil.annotations.ContributesTo
import dagger.Module
import dagger.Provides
import io.element.android.features.roomdetails.impl.members.details.RoomMemberDetailsPresenter
import io.element.android.features.userprofile.api.UserProfileStatePresenterFactory
import io.element.android.features.userprofile.api.UserProfilePresenterFactory
import io.element.android.libraries.di.RoomScope
import io.element.android.libraries.matrix.api.core.UserId
import io.element.android.libraries.matrix.api.room.MatrixRoom
@ -22,11 +22,15 @@ object RoomMemberModule { @@ -22,11 +22,15 @@ object RoomMemberModule {
@Provides
fun provideRoomMemberDetailsPresenterFactory(
room: MatrixRoom,
userProfileStatePresenterFactory: UserProfileStatePresenterFactory,
userProfilePresenterFactory: UserProfilePresenterFactory,
): RoomMemberDetailsPresenter.Factory {
return object : RoomMemberDetailsPresenter.Factory {
override fun create(roomMemberId: UserId): RoomMemberDetailsPresenter {
return RoomMemberDetailsPresenter(roomMemberId, room, userProfileStatePresenterFactory)
return RoomMemberDetailsPresenter(
roomMemberId = roomMemberId,
room = room,
userProfilePresenterFactory = userProfilePresenterFactory,
)
}
}
}

8
features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/details/RoomMemberDetailsPresenter.kt

@ -14,7 +14,7 @@ import androidx.compose.runtime.produceState @@ -14,7 +14,7 @@ import androidx.compose.runtime.produceState
import dagger.assisted.Assisted
import dagger.assisted.AssistedInject
import io.element.android.features.userprofile.api.UserProfileState
import io.element.android.features.userprofile.api.UserProfileStatePresenterFactory
import io.element.android.features.userprofile.api.UserProfilePresenterFactory
import io.element.android.libraries.architecture.Presenter
import io.element.android.libraries.matrix.api.core.UserId
import io.element.android.libraries.matrix.api.room.MatrixRoom
@ -22,18 +22,18 @@ import io.element.android.libraries.matrix.ui.room.getRoomMemberAsState @@ -22,18 +22,18 @@ import io.element.android.libraries.matrix.ui.room.getRoomMemberAsState
/**
* Presenter for room member details screen.
* Rely on UserProfileStatePresenter, but override some fields with room member info when available.
* Rely on UserProfilePresenter, but override some fields with room member info when available.
*/
class RoomMemberDetailsPresenter @AssistedInject constructor(
@Assisted private val roomMemberId: UserId,
private val room: MatrixRoom,
userProfileStatePresenterFactory: UserProfileStatePresenterFactory,
userProfilePresenterFactory: UserProfilePresenterFactory,
) : Presenter<UserProfileState> {
interface Factory {
fun create(roomMemberId: UserId): RoomMemberDetailsPresenter
}
private val userProfilePresenter = userProfileStatePresenterFactory.create(roomMemberId)
private val userProfilePresenter = userProfilePresenterFactory.create(roomMemberId)
@Composable
override fun present(): UserProfileState {

2
features/roomdetails/impl/src/test/kotlin/io/element/android/features/roomdetails/RoomDetailsPresenterTest.kt

@ -86,7 +86,7 @@ class RoomDetailsPresenterTest { @@ -86,7 +86,7 @@ class RoomDetailsPresenterTest {
return RoomMemberDetailsPresenter(
roomMemberId = roomMemberId,
room = room,
userProfileStatePresenterFactory = {
userProfilePresenterFactory = {
Presenter { aUserProfileState() }
},
)

8
features/roomdetails/impl/src/test/kotlin/io/element/android/features/roomdetails/members/details/RoomMemberDetailsPresenterTest.kt

@ -14,7 +14,7 @@ import com.google.common.truth.Truth.assertThat @@ -14,7 +14,7 @@ import com.google.common.truth.Truth.assertThat
import io.element.android.features.roomdetails.aMatrixRoom
import io.element.android.features.roomdetails.impl.members.aRoomMember
import io.element.android.features.roomdetails.impl.members.details.RoomMemberDetailsPresenter
import io.element.android.features.userprofile.api.UserProfileStatePresenterFactory
import io.element.android.features.userprofile.api.UserProfilePresenterFactory
import io.element.android.features.userprofile.shared.aUserProfileState
import io.element.android.libraries.architecture.Presenter
import io.element.android.libraries.matrix.api.core.UserId
@ -139,7 +139,7 @@ class RoomMemberDetailsPresenterTest { @@ -139,7 +139,7 @@ class RoomMemberDetailsPresenterTest {
)
val presenter = createRoomMemberDetailsPresenter(
room = room,
userProfileStatePresenterFactory = {
userProfilePresenterFactory = {
Presenter {
aUserProfileState(
userName = null,
@ -159,7 +159,7 @@ class RoomMemberDetailsPresenterTest { @@ -159,7 +159,7 @@ class RoomMemberDetailsPresenterTest {
private fun createRoomMemberDetailsPresenter(
room: MatrixRoom,
userProfileStatePresenterFactory: UserProfileStatePresenterFactory = UserProfileStatePresenterFactory {
userProfilePresenterFactory: UserProfilePresenterFactory = UserProfilePresenterFactory {
Presenter {
aUserProfileState(
userName = "Profile user name",
@ -171,7 +171,7 @@ class RoomMemberDetailsPresenterTest { @@ -171,7 +171,7 @@ class RoomMemberDetailsPresenterTest {
return RoomMemberDetailsPresenter(
roomMemberId = UserId("@alice:server.org"),
room = room,
userProfileStatePresenterFactory = userProfileStatePresenterFactory
userProfilePresenterFactory = userProfilePresenterFactory
)
}
}

2
features/userprofile/api/src/main/kotlin/io/element/android/features/userprofile/api/UserProfileStatePresenterFactory.kt → features/userprofile/api/src/main/kotlin/io/element/android/features/userprofile/api/UserProfilePresenterFactory.kt

@ -10,6 +10,6 @@ package io.element.android.features.userprofile.api @@ -10,6 +10,6 @@ package io.element.android.features.userprofile.api
import io.element.android.libraries.architecture.Presenter
import io.element.android.libraries.matrix.api.core.UserId
fun interface UserProfileStatePresenterFactory {
fun interface UserProfilePresenterFactory {
fun create(userId: UserId): Presenter<UserProfileState>
}

6
features/userprofile/impl/src/main/kotlin/io/element/android/features/userprofile/impl/DefaultUserProfileStatePresenterFactory.kt → features/userprofile/impl/src/main/kotlin/io/element/android/features/userprofile/impl/DefaultUserProfilePresenterFactory.kt

@ -9,7 +9,7 @@ package io.element.android.features.userprofile.impl @@ -9,7 +9,7 @@ package io.element.android.features.userprofile.impl
import com.squareup.anvil.annotations.ContributesBinding
import io.element.android.features.userprofile.api.UserProfileState
import io.element.android.features.userprofile.api.UserProfileStatePresenterFactory
import io.element.android.features.userprofile.api.UserProfilePresenterFactory
import io.element.android.features.userprofile.impl.root.UserProfilePresenter
import io.element.android.libraries.architecture.Presenter
import io.element.android.libraries.di.SessionScope
@ -17,8 +17,8 @@ import io.element.android.libraries.matrix.api.core.UserId @@ -17,8 +17,8 @@ import io.element.android.libraries.matrix.api.core.UserId
import javax.inject.Inject
@ContributesBinding(SessionScope::class)
class DefaultUserProfileStatePresenterFactory @Inject constructor(
class DefaultUserProfilePresenterFactory @Inject constructor(
private val factory: UserProfilePresenter.Factory,
) : UserProfileStatePresenterFactory {
) : UserProfilePresenterFactory {
override fun create(userId: UserId): Presenter<UserProfileState> = factory.create(userId)
}
Loading…
Cancel
Save