mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 11:59:12 +03:00
Room name and topic fields added to form.
This commit is contained in:
parent
c23819bfcf
commit
05e848244e
6 changed files with 44 additions and 2 deletions
|
@ -9,6 +9,7 @@ Improvements 🙌:
|
||||||
- "Add Matrix app" menu is now always visible (#1495)
|
- "Add Matrix app" menu is now always visible (#1495)
|
||||||
- Handle `/op`, `/deop`, and `/nick` commands (#12)
|
- Handle `/op`, `/deop`, and `/nick` commands (#12)
|
||||||
- Prioritising Recovery key over Recovery passphrase (#1463)
|
- Prioritising Recovery key over Recovery passphrase (#1463)
|
||||||
|
- Room Settings: Name, Topic, Photo, Aliases, History Visibility (#1455)
|
||||||
|
|
||||||
Bugfix 🐛:
|
Bugfix 🐛:
|
||||||
- Fix dark theme issue on login screen (#1097)
|
- Fix dark theme issue on login screen (#1097)
|
||||||
|
|
|
@ -22,6 +22,7 @@ import im.vector.riotx.core.epoxy.profiles.buildProfileAction
|
||||||
import im.vector.riotx.core.epoxy.profiles.buildProfileSection
|
import im.vector.riotx.core.epoxy.profiles.buildProfileSection
|
||||||
import im.vector.riotx.core.resources.ColorProvider
|
import im.vector.riotx.core.resources.ColorProvider
|
||||||
import im.vector.riotx.core.resources.StringProvider
|
import im.vector.riotx.core.resources.StringProvider
|
||||||
|
import im.vector.riotx.features.form.formEditTextItem
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
// TODO Add other feature here (waiting for design)
|
// TODO Add other feature here (waiting for design)
|
||||||
|
@ -32,6 +33,8 @@ class RoomSettingsController @Inject constructor(
|
||||||
|
|
||||||
interface Callback {
|
interface Callback {
|
||||||
fun onEnableEncryptionClicked()
|
fun onEnableEncryptionClicked()
|
||||||
|
fun onNameChanged(name: String)
|
||||||
|
fun onTopicChanged(topic: String)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val dividerColor = colorProvider.getColorFromAttribute(R.attr.vctr_list_divider_color)
|
private val dividerColor = colorProvider.getColorFromAttribute(R.attr.vctr_list_divider_color)
|
||||||
|
@ -68,5 +71,27 @@ class RoomSettingsController @Inject constructor(
|
||||||
action = { callback?.onEnableEncryptionClicked() }
|
action = { callback?.onEnableEncryptionClicked() }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
formEditTextItem {
|
||||||
|
id("name")
|
||||||
|
/*enabled(enableFormElement)*/
|
||||||
|
value(roomSummary.displayName)
|
||||||
|
hint(stringProvider.getString(R.string.room_settings_name_hint))
|
||||||
|
|
||||||
|
onTextChange { text ->
|
||||||
|
callback?.onNameChanged(text)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
formEditTextItem {
|
||||||
|
id("topic")
|
||||||
|
/*enabled(enableFormElement)*/
|
||||||
|
value(roomSummary.topic)
|
||||||
|
hint(stringProvider.getString(R.string.room_settings_topic_hint))
|
||||||
|
|
||||||
|
onTextChange { text ->
|
||||||
|
callback?.onTopicChanged(text)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,14 @@ class RoomSettingsFragment @Inject constructor(
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onNameChanged(name: String) {
|
||||||
|
viewModel.handle(RoomSettingsAction.SetRoomName(name))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onTopicChanged(topic: String) {
|
||||||
|
viewModel.handle(RoomSettingsAction.SetRoomTopic(topic))
|
||||||
|
}
|
||||||
|
|
||||||
private fun renderRoomSummary(state: RoomSettingsViewState) {
|
private fun renderRoomSummary(state: RoomSettingsViewState) {
|
||||||
waiting_view.isVisible = state.isLoading
|
waiting_view.isVisible = state.isLoading
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,8 @@ class RoomSettingsViewModel @AssistedInject constructor(@Assisted initialState:
|
||||||
override fun handle(action: RoomSettingsAction) {
|
override fun handle(action: RoomSettingsAction) {
|
||||||
when (action) {
|
when (action) {
|
||||||
is RoomSettingsAction.EnableEncryption -> handleEnableEncryption()
|
is RoomSettingsAction.EnableEncryption -> handleEnableEncryption()
|
||||||
|
is RoomSettingsAction.SetRoomName -> setState { copy(newName = action.newName) }
|
||||||
|
is RoomSettingsAction.SetRoomTopic -> setState { copy(newTopic = action.newTopic) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,9 @@ import im.vector.riotx.features.roomprofile.RoomProfileArgs
|
||||||
data class RoomSettingsViewState(
|
data class RoomSettingsViewState(
|
||||||
val roomId: String,
|
val roomId: String,
|
||||||
val roomSummary: Async<RoomSummary> = Uninitialized,
|
val roomSummary: Async<RoomSummary> = Uninitialized,
|
||||||
val isLoading: Boolean = false
|
val isLoading: Boolean = false,
|
||||||
|
val newName: String? = null,
|
||||||
|
val newTopic: String? = null
|
||||||
) : MvRxState {
|
) : MvRxState {
|
||||||
|
|
||||||
constructor(args: RoomProfileArgs) : this(roomId = args.roomId)
|
constructor(args: RoomProfileArgs) : this(roomId = args.roomId)
|
||||||
|
|
|
@ -2496,4 +2496,8 @@ Not all features in Riot are implemented in RiotX yet. Main missing (and coming
|
||||||
<string name="save_your_security_key_title">Save your Security Key</string>
|
<string name="save_your_security_key_title">Save your Security Key</string>
|
||||||
<string name="save_your_security_key_notice">Store your Security Key somewhere safe, like a password manager or a safe.</string>
|
<string name="save_your_security_key_notice">Store your Security Key somewhere safe, like a password manager or a safe.</string>
|
||||||
|
|
||||||
|
<!-- Room Settings -->
|
||||||
|
<string name="room_settings_name_hint">Room Name</string>
|
||||||
|
<string name="room_settings_topic_hint">Topic</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in a new issue