ChatRoomView.kt 3.37 KB
Newer Older
1 2
package chat.rocket.android.chatroom.presentation

3
import android.net.Uri
4
import chat.rocket.android.chatroom.viewmodel.BaseViewModel
5 6 7
import chat.rocket.android.chatroom.viewmodel.suggestion.ChatRoomSuggestionViewModel
import chat.rocket.android.chatroom.viewmodel.suggestion.CommandSuggestionViewModel
import chat.rocket.android.chatroom.viewmodel.suggestion.PeopleSuggestionViewModel
8 9
import chat.rocket.android.core.behaviours.LoadingView
import chat.rocket.android.core.behaviours.MessageView
10
import chat.rocket.core.internal.realtime.socket.model.State
11 12 13 14 15 16 17 18

interface ChatRoomView : LoadingView, MessageView {

    /**
     * Shows the chat room messages.
     *
     * @param dataSet The data set to show.
     */
19
    fun showMessages(dataSet: List<BaseViewModel<*>>)
20 21 22 23 24 25 26 27

    /**
     * Send a message to a chat room.
     *
     * @param text The text to send.
     */
    fun sendMessage(text: String)

28 29 30
    /**
     * Perform file selection with the mime type [filter]
     */
31
    fun showFileSelection(filter: Array<String>?)
32

33
    /**
34
     * Uploads a file to a chat room.
35 36 37
     *
     * @param uri The file URI to send.
     */
38
    fun uploadFile(uri: Uri)
39

40 41 42 43 44
    /**
     * Shows a invalid file message.
     */
    fun showInvalidFileMessage()

45 46
    /**
     * Shows a (recent) message sent to a chat room.
Lucio Maciel's avatar
Lucio Maciel committed
47
     *
48 49
     * @param message The (recent) message sent to a chat room.
     */
50
    fun showNewMessage(message: List<BaseViewModel<*>>)
Lucio Maciel's avatar
Lucio Maciel committed
51

52 53 54 55 56 57 58
    /**
     * Dispatch to the recycler views adapter that we should remove a message.
     *
     * @param msgId The id of the message to be removed.
     */
    fun dispatchDeleteMessage(msgId: String)

Lucio Maciel's avatar
Lucio Maciel committed
59 60 61 62 63
    /**
     * Dispatch a update to the recycler views adapter about a changed message.
     *
     * @param index The index of the changed message
     */
64
    fun dispatchUpdateMessage(index: Int, message: List<BaseViewModel<*>>)
65

66 67 68
    /**
     * Show reply status above the message composer.
     *
69
     * @param username The username or name of the user to reply/quote to.
70 71 72
     * @param replyMarkdown The markdown of the message reply.
     * @param quotedMessage The message to quote.
     */
73
    fun showReplyingAction(username: String, replyMarkdown: String, quotedMessage: String)
74

75 76 77 78 79 80 81
    /**
     * Copy message to clipboard.
     *
     * @param message The message to copy.
     */
    fun copyToClipboard(message: String)

82 83 84 85 86
    /**
     * Show edit status above the message composer.
     */
    fun showEditingAction(roomId: String, messageId: String, text: String)

87 88 89 90 91
    /**
     * Disabling the send message button avoids the user tap this button multiple
     * times to send a same message.
     */
    fun disableSendMessageButton()
92

93 94 95
    /**
     * Enables the send message button.
     */
96
    fun enableSendMessageButton()
97 98 99 100 101

    /**
     * Clears the message composition.
     */
    fun clearMessageComposition()
102 103

    fun showInvalidFileSize(fileSize: Int, maxFileSize: Int)
104 105

    fun showConnectionState(state: State)
106

107
    fun populatePeopleSuggestions(members: List<PeopleSuggestionViewModel>)
108

109
    fun populateRoomSuggestions(chatRooms: List<ChatRoomSuggestionViewModel>)
110 111 112 113
    /**
     * This user has joined the chat callback.
     */
    fun onJoined()
114

115
    fun showReactionsPopup(messageId: String)
116 117 118 119 120 121 122

    /**
     * Show list of commands.
     *
     * @param commands The list of available commands.
     */
    fun populateCommandSuggestions(commands: List<CommandSuggestionViewModel>)
123
}