mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Profile: add PowerLevelContent for building future actions + fix divider
This commit is contained in:
parent
9671a77e5d
commit
d6e6092eea
@ -56,6 +56,7 @@ class RoomMemberProfileController @Inject constructor(private val stringProvider
|
||||
title = ignoreActionTitle,
|
||||
destructive = true,
|
||||
editable = false,
|
||||
divider = false,
|
||||
action = { callback?.onIgnoreClicked() }
|
||||
)
|
||||
}
|
||||
@ -85,19 +86,23 @@ class RoomMemberProfileController @Inject constructor(private val stringProvider
|
||||
title = stringProvider.getString(R.string.room_member_jump_to_read_receipt),
|
||||
action = { callback?.onJumpToReadReceiptClicked() }
|
||||
)
|
||||
|
||||
val ignoreActionTitle = state.buildIgnoreActionTitle()
|
||||
|
||||
buildProfileAction(
|
||||
id = "mention",
|
||||
title = stringProvider.getString(R.string.room_participants_action_mention),
|
||||
editable = false,
|
||||
divider = ignoreActionTitle != null,
|
||||
action = { callback?.onMentionClicked() }
|
||||
)
|
||||
val ignoreActionTitle = state.buildIgnoreActionTitle()
|
||||
if (ignoreActionTitle != null) {
|
||||
buildProfileAction(
|
||||
id = "ignore",
|
||||
title = ignoreActionTitle,
|
||||
destructive = true,
|
||||
editable = false,
|
||||
divider = false,
|
||||
action = { callback?.onIgnoreClicked() }
|
||||
)
|
||||
}
|
||||
|
@ -154,6 +154,10 @@ class RoomMemberProfileViewModel @AssistedInject constructor(@Assisted private v
|
||||
roomSummaryLive.execute {
|
||||
copy(isRoomEncrypted = it.invoke()?.isEncrypted == true)
|
||||
}
|
||||
powerLevelsContentLive.execute {
|
||||
copy(powerLevelsContent = it)
|
||||
}
|
||||
|
||||
Observable
|
||||
.combineLatest(
|
||||
roomSummaryLive,
|
||||
|
@ -20,6 +20,7 @@ package im.vector.riotx.features.roommemberprofile
|
||||
import com.airbnb.mvrx.Async
|
||||
import com.airbnb.mvrx.MvRxState
|
||||
import com.airbnb.mvrx.Uninitialized
|
||||
import im.vector.matrix.android.api.session.room.model.PowerLevelsContent
|
||||
import im.vector.matrix.android.api.util.MatrixItem
|
||||
|
||||
data class RoomMemberProfileViewState(
|
||||
@ -29,6 +30,7 @@ data class RoomMemberProfileViewState(
|
||||
val isMine: Boolean = false,
|
||||
val isIgnored: Async<Boolean> = Uninitialized,
|
||||
val isRoomEncrypted: Boolean = false,
|
||||
val powerLevelsContent: Async<PowerLevelsContent> = Uninitialized,
|
||||
val userPowerLevelString: Async<String> = Uninitialized,
|
||||
val userMatrixItem: Async<MatrixItem> = Uninitialized
|
||||
) : MvRxState {
|
||||
|
Loading…
Reference in New Issue
Block a user