main.com.sceyt.chatuikit.persistence.logic.PersistenceChannelsLogic.kt Maven / Gradle / Ivy
package com.sceyt.chatuikit.persistence.logic
import com.sceyt.chat.models.user.User
import com.sceyt.chatuikit.data.managers.channel.event.ChannelEventData
import com.sceyt.chatuikit.data.managers.channel.event.ChannelUnreadCountUpdatedEventData
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.SceytResponse
import com.sceyt.chatuikit.data.models.channels.CreateChannelData
import com.sceyt.chatuikit.data.models.channels.EditChannelData
import com.sceyt.chatuikit.data.models.channels.GetAllChannelsResponse
import com.sceyt.chatuikit.data.models.channels.SceytChannel
import com.sceyt.chatuikit.data.models.messages.SceytMessage
import com.sceyt.chatuikit.data.models.messages.SceytUser
import com.sceyt.chatuikit.presentation.components.channel.input.mention.Mention
import com.sceyt.chatuikit.presentation.components.channel.input.format.BodyStyleRange
import com.sceyt.chatuikit.push.RemoteMessageData
import com.sceyt.chatuikit.services.SceytPresenceChecker
import kotlinx.coroutines.flow.Flow
interface PersistenceChannelsLogic {
suspend fun onChannelEvent(data: ChannelEventData)
suspend fun onChannelUnreadCountUpdatedEvent(data: ChannelUnreadCountUpdatedEventData)
suspend fun onMessageStatusChangeEvent(data: MessageStatusChangeData)
suspend fun onMessage(data: Pair)
suspend fun onFcmMessage(data: RemoteMessageData)
suspend fun onMessageEditedOrDeleted(message: SceytMessage)
fun loadChannels(offset: Int, searchQuery: String,
loadKey: LoadKeyData?, ignoreDb: Boolean): Flow>
suspend fun searchChannelsWithUserIds(offset: Int, limit: Int, searchQuery: String,
userIds: List, includeUserNames: Boolean,
loadKey: LoadKeyData?, onlyMine: Boolean, ignoreDb: Boolean): Flow>
suspend fun syncChannels(limit: Int): Flow
suspend fun findOrCreateDirectChannel(user: SceytUser): SceytResponse
suspend fun createChannel(createChannelData: CreateChannelData): SceytResponse
suspend fun createNewChannelInsteadOfPendingChannel(channel: SceytChannel): SceytResponse
suspend fun markChannelAsRead(channelId: Long): SceytResponse
suspend fun markChannelAsUnRead(channelId: Long): SceytResponse
suspend fun clearHistory(channelId: Long, forEveryone: Boolean): SceytResponse
suspend fun blockAndLeaveChannel(channelId: Long): SceytResponse
suspend fun leaveChannel(channelId: Long): SceytResponse
suspend fun deleteChannel(channelId: Long): SceytResponse
suspend fun muteChannel(channelId: Long, muteUntil: Long): SceytResponse
suspend fun unMuteChannel(channelId: Long): SceytResponse
suspend fun enableAutoDelete(channelId: Long, period: Long): SceytResponse
suspend fun disableAutoDelete(channelId: Long): SceytResponse
suspend fun pinChannel(channelId: Long): SceytResponse
suspend fun unpinChannel(channelId: Long): SceytResponse
suspend fun hideChannel(channelId: Long): SceytResponse
suspend fun getChannelFromDb(channelId: Long): SceytChannel?
suspend fun getRetentionPeriodByChannelId(channelId: Long): Long
suspend fun getDirectChannelFromDb(peerId: String): SceytChannel?
suspend fun getChannelFromServer(channelId: Long): SceytResponse
suspend fun getChannelFromServerByUrl(url: String): SceytResponse>
suspend fun editChannel(channelId: Long, data: EditChannelData): SceytResponse
suspend fun join(channelId: Long): SceytResponse
suspend fun setUnreadCount(channelId: Long, count: Int)
suspend fun updateLastMessageWithLastRead(channelId: Long, message: SceytMessage)
suspend fun updateLastMessageIfNeeded(channelId: Long, message: SceytMessage?)
suspend fun blockUnBlockUser(userId: String, block: Boolean)
suspend fun updateDraftMessage(channelId: Long, message: String?, mentionUsers: List,
styling: List?, replyOrEditMessage: SceytMessage?, isReply: Boolean)
suspend fun getChannelsCountFromDb(): Int
fun getTotalUnreadCount(): Flow
suspend fun onUserPresenceChanged(users: List)
}