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,
|
title = ignoreActionTitle,
|
||||||
destructive = true,
|
destructive = true,
|
||||||
editable = false,
|
editable = false,
|
||||||
|
divider = false,
|
||||||
action = { callback?.onIgnoreClicked() }
|
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),
|
title = stringProvider.getString(R.string.room_member_jump_to_read_receipt),
|
||||||
action = { callback?.onJumpToReadReceiptClicked() }
|
action = { callback?.onJumpToReadReceiptClicked() }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val ignoreActionTitle = state.buildIgnoreActionTitle()
|
||||||
|
|
||||||
buildProfileAction(
|
buildProfileAction(
|
||||||
id = "mention",
|
id = "mention",
|
||||||
title = stringProvider.getString(R.string.room_participants_action_mention),
|
title = stringProvider.getString(R.string.room_participants_action_mention),
|
||||||
editable = false,
|
editable = false,
|
||||||
|
divider = ignoreActionTitle != null,
|
||||||
action = { callback?.onMentionClicked() }
|
action = { callback?.onMentionClicked() }
|
||||||
)
|
)
|
||||||
val ignoreActionTitle = state.buildIgnoreActionTitle()
|
|
||||||
if (ignoreActionTitle != null) {
|
if (ignoreActionTitle != null) {
|
||||||
buildProfileAction(
|
buildProfileAction(
|
||||||
id = "ignore",
|
id = "ignore",
|
||||||
title = ignoreActionTitle,
|
title = ignoreActionTitle,
|
||||||
destructive = true,
|
destructive = true,
|
||||||
editable = false,
|
editable = false,
|
||||||
|
divider = false,
|
||||||
action = { callback?.onIgnoreClicked() }
|
action = { callback?.onIgnoreClicked() }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -154,6 +154,10 @@ class RoomMemberProfileViewModel @AssistedInject constructor(@Assisted private v
|
|||||||
roomSummaryLive.execute {
|
roomSummaryLive.execute {
|
||||||
copy(isRoomEncrypted = it.invoke()?.isEncrypted == true)
|
copy(isRoomEncrypted = it.invoke()?.isEncrypted == true)
|
||||||
}
|
}
|
||||||
|
powerLevelsContentLive.execute {
|
||||||
|
copy(powerLevelsContent = it)
|
||||||
|
}
|
||||||
|
|
||||||
Observable
|
Observable
|
||||||
.combineLatest(
|
.combineLatest(
|
||||||
roomSummaryLive,
|
roomSummaryLive,
|
||||||
|
@ -20,6 +20,7 @@ package im.vector.riotx.features.roommemberprofile
|
|||||||
import com.airbnb.mvrx.Async
|
import com.airbnb.mvrx.Async
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MvRxState
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
|
import im.vector.matrix.android.api.session.room.model.PowerLevelsContent
|
||||||
import im.vector.matrix.android.api.util.MatrixItem
|
import im.vector.matrix.android.api.util.MatrixItem
|
||||||
|
|
||||||
data class RoomMemberProfileViewState(
|
data class RoomMemberProfileViewState(
|
||||||
@ -29,6 +30,7 @@ data class RoomMemberProfileViewState(
|
|||||||
val isMine: Boolean = false,
|
val isMine: Boolean = false,
|
||||||
val isIgnored: Async<Boolean> = Uninitialized,
|
val isIgnored: Async<Boolean> = Uninitialized,
|
||||||
val isRoomEncrypted: Boolean = false,
|
val isRoomEncrypted: Boolean = false,
|
||||||
|
val powerLevelsContent: Async<PowerLevelsContent> = Uninitialized,
|
||||||
val userPowerLevelString: Async<String> = Uninitialized,
|
val userPowerLevelString: Async<String> = Uninitialized,
|
||||||
val userMatrixItem: Async<MatrixItem> = Uninitialized
|
val userMatrixItem: Async<MatrixItem> = Uninitialized
|
||||||
) : MvRxState {
|
) : MvRxState {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user