Handle /nick command (#12)

This commit is contained in:
Benoit Marty 2020-06-26 23:40:23 +02:00
parent 8a1a772ab7
commit 30774957ba
2 changed files with 9 additions and 3 deletions

View file

@ -7,7 +7,7 @@ Features ✨:
Improvements 🙌:
- "Add Matrix app" menu is now always visible (#1495)
- Handle `/op` and `/deop` commands (#12)
- Handle `/op`, `/deop`, and `/nick` commands (#12)
Bugfix 🐛:
- Fix dark theme issue on login screen (#1097)

View file

@ -539,8 +539,8 @@ class RoomDetailViewModel @AssistedInject constructor(
popDraft()
}
is ParsedCommand.ChangeDisplayName -> {
// TODO
_viewEvents.post(RoomDetailViewEvents.SlashCommandNotImplemented)
handleChangeDisplayNameSlashCommand(slashCommandResult)
popDraft()
}
is ParsedCommand.DiscardSession -> {
if (room.isEncrypted()) {
@ -685,6 +685,12 @@ class RoomDetailViewModel @AssistedInject constructor(
}
}
private fun handleChangeDisplayNameSlashCommand(changeDisplayName: ParsedCommand.ChangeDisplayName) {
launchSlashCommandFlow {
session.setDisplayName(session.myUserId, changeDisplayName.displayName, it)
}
}
private fun handleKickSlashCommand(kick: ParsedCommand.KickUser) {
launchSlashCommandFlow {
room.kick(kick.userId, kick.reason, it)