mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
Restore previous way to managed power level string, to be able to translate them correctly
This commit is contained in:
parent
ab4780c9b9
commit
fb5013db88
@ -40,6 +40,7 @@ import im.vector.matrix.android.api.session.room.model.Membership
|
||||
import im.vector.matrix.android.api.session.room.model.PowerLevelsContent
|
||||
import im.vector.matrix.android.api.session.room.model.RoomSummary
|
||||
import im.vector.matrix.android.api.session.room.powerlevels.PowerLevelsHelper
|
||||
import im.vector.matrix.android.api.session.room.powerlevels.Role
|
||||
import im.vector.matrix.android.api.util.MatrixItem
|
||||
import im.vector.matrix.android.api.util.toMatrixItem
|
||||
import im.vector.matrix.android.api.util.toOptional
|
||||
@ -304,9 +305,12 @@ class RoomMemberProfileViewModel @AssistedInject constructor(@Assisted private v
|
||||
BiFunction<RoomSummary, PowerLevelsContent, String> { roomSummary, powerLevelsContent ->
|
||||
val roomName = roomSummary.toMatrixItem().getBestName()
|
||||
val powerLevelsHelper = PowerLevelsHelper(powerLevelsContent)
|
||||
val userPowerLevel = powerLevelsHelper.getUserRole(initialState.userId)
|
||||
val powerLevelStr = stringProvider.getString(userPowerLevel.res, userPowerLevel.value)
|
||||
stringProvider.getString(R.string.room_member_power_level_in, powerLevelStr, roomName)
|
||||
when (val userPowerLevel = powerLevelsHelper.getUserRole(initialState.userId)) {
|
||||
Role.Admin -> stringProvider.getString(R.string.room_member_power_level_admin_in, roomName)
|
||||
Role.Moderator -> stringProvider.getString(R.string.room_member_power_level_moderator_in, roomName)
|
||||
Role.Default -> stringProvider.getString(R.string.room_member_power_level_default_in, roomName)
|
||||
is Role.Custom -> stringProvider.getString(R.string.room_member_power_level_custom_in, userPowerLevel.value, roomName)
|
||||
}
|
||||
}
|
||||
).execute {
|
||||
copy(userPowerLevelString = it)
|
||||
|
@ -2102,7 +2102,11 @@ Not all features in Riot are implemented in RiotX yet. Main missing (and coming
|
||||
<string name="room_member_power_level_invites">Invites</string>
|
||||
<string name="room_member_power_level_users">Users</string>
|
||||
|
||||
<string name="room_member_power_level_in">%1$s in %2$s</string>
|
||||
<string name="room_member_power_level_admin_in">Admin in %1$s</string>
|
||||
<string name="room_member_power_level_moderator_in">Moderator in %1$s</string>
|
||||
<string name="room_member_power_level_default_in">Default in %1$s</string>
|
||||
<string name="room_member_power_level_custom_in">Custom (%1$d) in %2$s</string>
|
||||
|
||||
<string name="room_member_jump_to_read_receipt">Jump to read receipt</string>
|
||||
|
||||
<string name="rendering_event_error_type_of_event_not_handled">"RiotX does not handle events of type '%1$s'"</string>
|
||||
|
Loading…
Reference in New Issue
Block a user