All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.com.sceyt.chatuikit.persistence.logic.PersistenceMessagesLogic.kt Maven / Gradle / Ivy

package com.sceyt.chatuikit.persistence.logic

import com.sceyt.chat.models.message.DeleteMessageType
import com.sceyt.chat.models.message.Message
import com.sceyt.chat.models.message.MessageListMarker
import com.sceyt.chatuikit.data.managers.message.event.MessageStatusChangeData
import com.sceyt.chatuikit.data.models.LoadKeyData
import com.sceyt.chatuikit.data.models.PaginationResponse
import com.sceyt.chatuikit.data.models.SceytPagingResponse
import com.sceyt.chatuikit.data.models.SceytResponse
import com.sceyt.chatuikit.data.models.SendMessageResult
import com.sceyt.chatuikit.data.models.SyncNearMessagesResult
import com.sceyt.chatuikit.data.models.channels.SceytChannel
import com.sceyt.chatuikit.data.models.messages.MarkerType
import com.sceyt.chatuikit.data.models.messages.SceytMessage
import com.sceyt.chatuikit.push.RemoteMessageData
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.SharedFlow

interface PersistenceMessagesLogic {
    suspend fun onMessage(data: Pair, sendDeliveryMarker: Boolean = true)
    suspend fun onFcmMessage(data: RemoteMessageData)
    suspend fun onMessageStatusChangeEvent(data: MessageStatusChangeData)
    suspend fun onMessageEditedOrDeleted(message: SceytMessage)
    suspend fun loadPrevMessages(conversationId: Long, lastMessageId: Long, replyInThread: Boolean, offset: Int,
                                 limit: Int, loadKey: LoadKeyData,
                                 ignoreDb: Boolean): Flow>

    suspend fun loadNextMessages(conversationId: Long, lastMessageId: Long, replyInThread: Boolean,
                                 offset: Int, limit: Int, ignoreDb: Boolean): Flow>

    suspend fun loadNearMessages(conversationId: Long, messageId: Long, replyInThread: Boolean,
                                 limit: Int, loadKey: LoadKeyData, ignoreDb: Boolean,
                                 ignoreServer: Boolean): Flow>

    suspend fun loadNewestMessages(conversationId: Long, replyInThread: Boolean, limit: Int,
                                   loadKey: LoadKeyData,
                                   ignoreDb: Boolean): Flow>

    suspend fun searchMessages(conversationId: Long, replyInThread: Boolean,
                               query: String): SceytPagingResponse>

    suspend fun loadNextSearchMessages(): SceytPagingResponse>
    suspend fun loadMessagesById(conversationId: Long, ids: List): SceytResponse>
    suspend fun syncMessagesAfterMessageId(conversationId: Long, replyInThread: Boolean,
                                           messageId: Long): Flow>>

    suspend fun syncNearMessages(conversationId: Long, messageId: Long,
                                 replyInThread: Boolean): SyncNearMessagesResult

    suspend fun onSyncedChannels(channels: List)
    suspend fun getMessagesByType(channelId: Long, lastMessageId: Long,
                                  type: String): SceytResponse>

    suspend fun sendMessage(channelId: Long, message: Message)
    suspend fun sendMessages(channelId: Long, messages: List)
    suspend fun sendMessageAsFlow(channelId: Long, message: Message): Flow
    suspend fun sendSharedFileMessage(channelId: Long, message: Message)
    suspend fun sendFrowardMessages(channelId: Long, vararg messageToSend: Message): SceytResponse
    suspend fun sendMessageWithUploadedAttachments(channelId: Long,
                                                   message: Message): SceytResponse

    suspend fun sendPendingMessages(channelId: Long)
    suspend fun sendAllPendingMessages()
    suspend fun sendAllPendingMarkers()
    suspend fun sendAllPendingMessageStateUpdates()
    suspend fun markMessagesAs(channelId: Long, marker: MarkerType,
                               vararg ids: Long): List>

    suspend fun addMessagesMarker(channelId: Long, marker: String,
                                  vararg ids: Long): List>

    suspend fun editMessage(channelId: Long, message: SceytMessage): SceytResponse
    suspend fun deleteMessage(channelId: Long, message: SceytMessage,
                              deleteType: DeleteMessageType): SceytResponse

    suspend fun getMessageDbById(messageId: Long): SceytMessage?
    suspend fun getMessageDbByTid(tid: Long): SceytMessage?
    suspend fun getMessagesDbByTid(tIds: List): List
    suspend fun getMessageFromServerById(channelId: Long, messageId: Long): SceytResponse
    suspend fun attachmentSuccessfullySent(message: SceytMessage)
    suspend fun saveChannelLastMessagesToDb(list: List?)
    suspend fun sendTyping(channelId: Long, typing: Boolean)
    fun getOnMessageFlow(): SharedFlow>
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy