mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-23 05:25:31 +03:00
Define all system messages as such
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
8ee33bb251
commit
8d99f0b98f
3 changed files with 109 additions and 27 deletions
|
@ -1524,7 +1524,7 @@ class ChatController(args: Bundle) :
|
|||
|
||||
private fun isInfoMessageAboutDeletion(currentMessage: MutableMap.MutableEntry<String, ChatMessage>): Boolean {
|
||||
return currentMessage.value.parentMessage != null && currentMessage.value.systemMessageType == ChatMessage
|
||||
.SystemMessageType.PARENT_MESSAGE_DELETED
|
||||
.SystemMessageType.MESSAGE_DELETED
|
||||
}
|
||||
|
||||
private fun startACall(isVoiceOnlyCall: Boolean) {
|
||||
|
|
|
@ -551,10 +551,20 @@ public class ChatMessage implements IMessage, MessageContentType, MessageContent
|
|||
DUMMY,
|
||||
CONVERSATION_CREATED,
|
||||
CONVERSATION_RENAMED,
|
||||
DESCRIPTION_REMOVED,
|
||||
DESCRIPTION_SET,
|
||||
CALL_STARTED,
|
||||
CALL_JOINED,
|
||||
CALL_LEFT,
|
||||
CALL_ENDED,
|
||||
READ_ONLY_OFF,
|
||||
READ_ONLY,
|
||||
LISTABLE_NONE,
|
||||
LISTABLE_USERS,
|
||||
LISTABLE_ALL,
|
||||
LOBBY_NONE,
|
||||
LOBBY_NON_MODERATORS,
|
||||
LOBBY_OPEN_TO_EVERYONE,
|
||||
GUESTS_ALLOWED,
|
||||
GUESTS_DISALLOWED,
|
||||
PASSWORD_SET,
|
||||
|
@ -563,10 +573,15 @@ public class ChatMessage implements IMessage, MessageContentType, MessageContent
|
|||
USER_REMOVED,
|
||||
MODERATOR_PROMOTED,
|
||||
MODERATOR_DEMOTED,
|
||||
GUEST_MODERATOR_PROMOTED,
|
||||
GUEST_MODERATOR_DEMOTED,
|
||||
MESSAGE_DELETED,
|
||||
FILE_SHARED,
|
||||
LOBBY_NONE,
|
||||
LOBBY_NON_MODERATORS,
|
||||
LOBBY_OPEN_TO_EVERYONE,
|
||||
PARENT_MESSAGE_DELETED
|
||||
OBJECT_SHARED,
|
||||
MATTERBRIDGE_CONFIG_ADDED,
|
||||
MATTERBRIDGE_CONFIG_EDITED,
|
||||
MATTERBRIDGE_CONFIG_REMOVED,
|
||||
MATTERBRIDGE_CONFIG_ENABLED,
|
||||
MATTERBRIDGE_CONFIG_DISABLED
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,45 +28,91 @@ import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.CALL_LE
|
|||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.CALL_STARTED
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.CONVERSATION_CREATED
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.CONVERSATION_RENAMED
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.DESCRIPTION_REMOVED
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.DESCRIPTION_SET
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.DUMMY
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.FILE_SHARED
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.GUESTS_ALLOWED
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.GUESTS_DISALLOWED
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.GUEST_MODERATOR_DEMOTED
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.GUEST_MODERATOR_PROMOTED
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.LISTABLE_ALL
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.LISTABLE_NONE
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.LISTABLE_USERS
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.LOBBY_NONE
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.LOBBY_NON_MODERATORS
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.LOBBY_OPEN_TO_EVERYONE
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.MATTERBRIDGE_CONFIG_ADDED
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.MATTERBRIDGE_CONFIG_DISABLED
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.MATTERBRIDGE_CONFIG_EDITED
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.MATTERBRIDGE_CONFIG_ENABLED
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.MATTERBRIDGE_CONFIG_REMOVED
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.MESSAGE_DELETED
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.MODERATOR_DEMOTED
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.MODERATOR_PROMOTED
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.PARENT_MESSAGE_DELETED
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.OBJECT_SHARED
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.PASSWORD_REMOVED
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.PASSWORD_SET
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.READ_ONLY
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.READ_ONLY_OFF
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.USER_ADDED
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage.SystemMessageType.USER_REMOVED
|
||||
|
||||
/*
|
||||
conversation_created - {actor} created the conversation
|
||||
conversation_renamed - {actor} renamed the conversation from "foo" to "bar"
|
||||
call_joined - {actor} joined the call
|
||||
call_left - {actor} left the call
|
||||
call_ended - Call with {user1}, {user2}, {user3}, {user4} and {user5} (Duration 30:23)
|
||||
guests_allowed - {actor} allowed guests in the conversation
|
||||
guests_disallowed - {actor} disallowed guests in the conversation
|
||||
password_set - {actor} set a password for the conversation
|
||||
password_removed - {actor} removed the password for the conversation
|
||||
user_added - {actor} added {user} to the conversation
|
||||
user_removed - {actor} removed {user} from the conversation
|
||||
moderator_promoted - {actor} promoted {user} to moderator
|
||||
moderator_demoted - {actor} demoted {user} from moderator
|
||||
*/
|
||||
* `conversation_created` - {actor} created the conversation
|
||||
* `conversation_renamed` - {actor} renamed the conversation from "foo" to "bar"
|
||||
* `description_set` - {actor} set the description to "Hello world"
|
||||
* `description_removed` - {actor} removed the description
|
||||
* `call_started` - {actor} started a call
|
||||
* `call_joined` - {actor} joined the call
|
||||
* `call_left` - {actor} left the call
|
||||
* `call_ended` - Call with {user1}, {user2}, {user3}, {user4} and {user5} (Duration 30:23)
|
||||
* `read_only_off` - {actor} unlocked the conversation
|
||||
* `read_only` - {actor} locked the conversation
|
||||
* `listable_none` - {actor} limited the conversation to the current participants
|
||||
* `listable_users` - {actor} opened the conversation accessible to registered users
|
||||
* `listable_all` - {actor} opened the conversation accessible to registered and guest app users
|
||||
* `lobby_timer_reached` - The conversation is now open to everyone
|
||||
* `lobby_none` - {actor} opened the conversation to everyone
|
||||
* `lobby_non_moderators` - {actor} restricted the conversation to moderators
|
||||
* `guests_allowed` - {actor} allowed guests in the conversation
|
||||
* `guests_disallowed` - {actor} disallowed guests in the conversation
|
||||
* `password_set` - {actor} set a password for the conversation
|
||||
* `password_removed` - {actor} removed the password for the conversation
|
||||
* `user_added` - {actor} added {user} to the conversation
|
||||
* `user_removed` - {actor} removed {user} from the conversation
|
||||
* `moderator_promoted` - {actor} promoted {user} to moderator
|
||||
* `moderator_demoted` - {actor} demoted {user} from moderator
|
||||
* `guest_moderator_promoted` - {actor} promoted {user} to moderator
|
||||
* `guest_moderator_demoted` - {actor} demoted {user} from moderator
|
||||
* `message_deleted` - Message deleted by {actor} (Should not be shown to the user)
|
||||
* `file_shared` - {file}
|
||||
* `object_shared` - {object}
|
||||
* `matterbridge_config_added` - {actor} set up Matterbridge to synchronize this conversation with other chats
|
||||
* `matterbridge_config_edited` - {actor} updated the Matterbridge configuration
|
||||
* `matterbridge_config_removed` - {actor} removed the Matterbridge configuration
|
||||
* `matterbridge_config_enabled` - {actor} started Matterbridge
|
||||
* `matterbridge_config_disabled` - {actor} stopped Matterbridge
|
||||
*/
|
||||
class EnumSystemMessageTypeConverter : StringBasedTypeConverter<ChatMessage.SystemMessageType>() {
|
||||
override fun getFromString(string: String): ChatMessage.SystemMessageType {
|
||||
when (string) {
|
||||
"conversation_created" -> return CONVERSATION_CREATED
|
||||
"conversation_renamed" -> return CONVERSATION_RENAMED
|
||||
"description_set" -> return DESCRIPTION_SET
|
||||
"description_removed" -> return DESCRIPTION_REMOVED
|
||||
"call_started" -> return CALL_STARTED
|
||||
"call_joined" -> return CALL_JOINED
|
||||
"call_left" -> return CALL_LEFT
|
||||
"call_ended" -> return CALL_ENDED
|
||||
"read_only_off" -> return READ_ONLY_OFF
|
||||
"read_only" -> return READ_ONLY
|
||||
"listable_none" -> return LISTABLE_NONE
|
||||
"listable_users" -> return LISTABLE_USERS
|
||||
"listable_all" -> return LISTABLE_ALL
|
||||
"lobby_none" -> return LOBBY_NONE
|
||||
"lobby_non_moderators" -> return LOBBY_NON_MODERATORS
|
||||
"lobby_timer_reached" -> return LOBBY_OPEN_TO_EVERYONE
|
||||
"guests_allowed" -> return GUESTS_ALLOWED
|
||||
"guests_disallowed" -> return GUESTS_DISALLOWED
|
||||
"password_set" -> return PASSWORD_SET
|
||||
|
@ -75,11 +121,16 @@ class EnumSystemMessageTypeConverter : StringBasedTypeConverter<ChatMessage.Syst
|
|||
"user_removed" -> return USER_REMOVED
|
||||
"moderator_promoted" -> return MODERATOR_PROMOTED
|
||||
"moderator_demoted" -> return MODERATOR_DEMOTED
|
||||
"guest_moderator_promoted" -> return GUEST_MODERATOR_PROMOTED
|
||||
"guest_moderator_demoted" -> return GUEST_MODERATOR_DEMOTED
|
||||
"message_deleted" -> return MESSAGE_DELETED
|
||||
"file_shared" -> return FILE_SHARED
|
||||
"lobby_none" -> return LOBBY_NONE
|
||||
"lobby_non_moderators" -> return LOBBY_NON_MODERATORS
|
||||
"lobby_timer_reached" -> return LOBBY_OPEN_TO_EVERYONE
|
||||
"message_deleted" -> return PARENT_MESSAGE_DELETED
|
||||
"object_shared" -> return OBJECT_SHARED
|
||||
"matterbridge_config_added" -> return MATTERBRIDGE_CONFIG_ADDED
|
||||
"matterbridge_config_edited" -> return MATTERBRIDGE_CONFIG_EDITED
|
||||
"matterbridge_config_removed" -> return MATTERBRIDGE_CONFIG_REMOVED
|
||||
"matterbridge_config_enabled" -> return MATTERBRIDGE_CONFIG_ENABLED
|
||||
"matterbridge_config_disabled" -> return MATTERBRIDGE_CONFIG_DISABLED
|
||||
else -> return DUMMY
|
||||
}
|
||||
}
|
||||
|
@ -93,10 +144,20 @@ class EnumSystemMessageTypeConverter : StringBasedTypeConverter<ChatMessage.Syst
|
|||
when (`object`) {
|
||||
CONVERSATION_CREATED -> return "conversation_created"
|
||||
CONVERSATION_RENAMED -> return "conversation_renamed"
|
||||
DESCRIPTION_REMOVED -> return "description_removed"
|
||||
DESCRIPTION_SET -> return "description_set"
|
||||
CALL_STARTED -> return "call_started"
|
||||
CALL_JOINED -> return "call_joined"
|
||||
CALL_LEFT -> return "call_left"
|
||||
CALL_ENDED -> return "call_ended"
|
||||
READ_ONLY_OFF -> return "read_only_off"
|
||||
READ_ONLY -> return "read_only"
|
||||
LISTABLE_NONE -> return "listable_none"
|
||||
LISTABLE_USERS -> return "listable_users"
|
||||
LISTABLE_ALL -> return "listable_all"
|
||||
LOBBY_NONE -> return "lobby_none"
|
||||
LOBBY_NON_MODERATORS -> return "lobby_non_moderators"
|
||||
LOBBY_OPEN_TO_EVERYONE -> return "lobby_timer_reached"
|
||||
GUESTS_ALLOWED -> return "guests_allowed"
|
||||
GUESTS_DISALLOWED -> return "guests_disallowed"
|
||||
PASSWORD_SET -> return "password_set"
|
||||
|
@ -105,10 +166,16 @@ class EnumSystemMessageTypeConverter : StringBasedTypeConverter<ChatMessage.Syst
|
|||
USER_REMOVED -> return "user_removed"
|
||||
MODERATOR_PROMOTED -> return "moderator_promoted"
|
||||
MODERATOR_DEMOTED -> return "moderator_demoted"
|
||||
GUEST_MODERATOR_PROMOTED -> return "guest_moderator_promoted"
|
||||
GUEST_MODERATOR_DEMOTED -> return "guest_moderator_demoted"
|
||||
MESSAGE_DELETED -> return "message_deleted"
|
||||
FILE_SHARED -> return "file_shared"
|
||||
LOBBY_NONE -> return "lobby_none"
|
||||
LOBBY_NON_MODERATORS -> return "lobby_non_moderators"
|
||||
LOBBY_OPEN_TO_EVERYONE -> return "lobby_timer_reached"
|
||||
OBJECT_SHARED -> return "object_shared"
|
||||
MATTERBRIDGE_CONFIG_ADDED -> return "matterbridge_config_added"
|
||||
MATTERBRIDGE_CONFIG_EDITED -> return "matterbridge_config_edited"
|
||||
MATTERBRIDGE_CONFIG_REMOVED -> return "matterbridge_config_removed"
|
||||
MATTERBRIDGE_CONFIG_ENABLED -> return "matterbridge_config_enabled"
|
||||
MATTERBRIDGE_CONFIG_DISABLED -> return "matterbridge_config_disabled"
|
||||
else -> return ""
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue