mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Add info about room version
This commit is contained in:
parent
e511e7e02e
commit
8793d263d4
@ -209,6 +209,16 @@ class RoomProfileController @Inject constructor(
|
||||
editable = false,
|
||||
action = { callback?.onRoomIdClicked() }
|
||||
)
|
||||
data.roomCreateContent()?.roomVersion?.let {
|
||||
buildProfileAction(
|
||||
id = "roomVersion",
|
||||
title = stringProvider.getString(R.string.room_settings_room_version_title),
|
||||
subtitle = it,
|
||||
dividerColor = dividerColor,
|
||||
divider = true,
|
||||
editable = false
|
||||
)
|
||||
}
|
||||
buildProfileAction(
|
||||
id = "devTools",
|
||||
title = stringProvider.getString(R.string.dev_tools_menu_name),
|
||||
|
@ -33,13 +33,17 @@ import im.vector.app.features.powerlevel.PowerLevelsObservableFactory
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import org.matrix.android.sdk.api.MatrixCallback
|
||||
import org.matrix.android.sdk.api.query.QueryStringValue
|
||||
import org.matrix.android.sdk.api.session.Session
|
||||
import org.matrix.android.sdk.api.session.events.model.EventType
|
||||
import org.matrix.android.sdk.api.session.events.model.toModel
|
||||
import org.matrix.android.sdk.api.session.room.members.roomMemberQueryParams
|
||||
import org.matrix.android.sdk.api.session.room.model.Membership
|
||||
import org.matrix.android.sdk.api.session.room.model.create.RoomCreateContent
|
||||
import org.matrix.android.sdk.api.session.room.powerlevels.PowerLevelsHelper
|
||||
import org.matrix.android.sdk.api.session.room.state.isPublic
|
||||
import org.matrix.android.sdk.rx.RxRoom
|
||||
import org.matrix.android.sdk.rx.mapOptional
|
||||
import org.matrix.android.sdk.rx.rx
|
||||
import org.matrix.android.sdk.rx.unwrap
|
||||
|
||||
@ -69,10 +73,20 @@ class RoomProfileViewModel @AssistedInject constructor(
|
||||
init {
|
||||
val rxRoom = room.rx()
|
||||
observeRoomSummary(rxRoom)
|
||||
observeRoomCreateContent(rxRoom)
|
||||
observeBannedRoomMembers(rxRoom)
|
||||
observePermissions()
|
||||
}
|
||||
|
||||
private fun observeRoomCreateContent(rxRoom: RxRoom) {
|
||||
rxRoom.liveStateEvent(EventType.STATE_ROOM_CREATE, QueryStringValue.NoCondition)
|
||||
.mapOptional { it.content.toModel<RoomCreateContent>() }
|
||||
.unwrap()
|
||||
.execute {
|
||||
copy(roomCreateContent = it)
|
||||
}
|
||||
}
|
||||
|
||||
private fun observeRoomSummary(rxRoom: RxRoom) {
|
||||
rxRoom.liveRoomSummary()
|
||||
.unwrap()
|
||||
|
@ -22,10 +22,12 @@ import com.airbnb.mvrx.MvRxState
|
||||
import com.airbnb.mvrx.Uninitialized
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomMemberSummary
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
||||
import org.matrix.android.sdk.api.session.room.model.create.RoomCreateContent
|
||||
|
||||
data class RoomProfileViewState(
|
||||
val roomId: String,
|
||||
val roomSummary: Async<RoomSummary> = Uninitialized,
|
||||
val roomCreateContent: Async<RoomCreateContent> = Uninitialized,
|
||||
val bannedMembership: Async<List<RoomMemberSummary>> = Uninitialized,
|
||||
val actionPermissions: ActionPermissions = ActionPermissions(),
|
||||
val isLoading: Boolean = false
|
||||
|
@ -1117,6 +1117,7 @@
|
||||
<!-- advanced -->
|
||||
<string name="room_settings_category_advanced_title">Advanced</string>
|
||||
<string name="room_settings_room_internal_id">This room’s internal ID</string>
|
||||
<string name="room_settings_room_version_title">Room version</string>
|
||||
<string name="room_settings_addresses_pref_title">Addresses</string>
|
||||
<string name="room_settings_labs_pref_title">Labs</string>
|
||||
<string name="room_settings_labs_warning_message">These are experimental features that may break in unexpected ways. Use with caution.</string>
|
||||
|
Loading…
Reference in New Issue
Block a user