mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-24 18:36:21 +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)
|
||||
- Handle `/op`, `/deop`, and `/nick` commands (#12)
|
||||
- Prioritising Recovery key over Recovery passphrase (#1463)
|
||||
- Room Settings: Name, Topic, Photo, Aliases, History Visibility (#1455)
|
||||
|
||||
Bugfix 🐛:
|
||||
- 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.resources.ColorProvider
|
||||
import im.vector.riotx.core.resources.StringProvider
|
||||
import im.vector.riotx.features.form.formEditTextItem
|
||||
import javax.inject.Inject
|
||||
|
||||
// TODO Add other feature here (waiting for design)
|
||||
|
@ -32,6 +33,8 @@ class RoomSettingsController @Inject constructor(
|
|||
|
||||
interface Callback {
|
||||
fun onEnableEncryptionClicked()
|
||||
fun onNameChanged(name: String)
|
||||
fun onTopicChanged(topic: String)
|
||||
}
|
||||
|
||||
private val dividerColor = colorProvider.getColorFromAttribute(R.attr.vctr_list_divider_color)
|
||||
|
@ -68,5 +71,27 @@ class RoomSettingsController @Inject constructor(
|
|||
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()
|
||||
}
|
||||
|
||||
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) {
|
||||
waiting_view.isVisible = state.isLoading
|
||||
|
||||
|
|
|
@ -62,6 +62,8 @@ class RoomSettingsViewModel @AssistedInject constructor(@Assisted initialState:
|
|||
override fun handle(action: RoomSettingsAction) {
|
||||
when (action) {
|
||||
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(
|
||||
val roomId: String,
|
||||
val roomSummary: Async<RoomSummary> = Uninitialized,
|
||||
val isLoading: Boolean = false
|
||||
val isLoading: Boolean = false,
|
||||
val newName: String? = null,
|
||||
val newTopic: String? = null
|
||||
) : MvRxState {
|
||||
|
||||
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_notice">Store your Security Key somewhere safe, like a password manager or a safe.</string>
|
||||
|
||||
</resources>
|
||||
<!-- Room Settings -->
|
||||
<string name="room_settings_name_hint">Room Name</string>
|
||||
<string name="room_settings_topic_hint">Topic</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue