1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

DROID-2635 Chats | Enhancement | Foundation for chats (#1420)

Co-authored-by: Konstantin Ivanov <54908981+konstantiniiv@users.noreply.github.com>
This commit is contained in:
Evgenii Kozlov 2024-10-29 21:05:44 +01:00 committed by GitHub
parent b87a454bc7
commit c149de8bce
Signed by: github
GPG key ID: B5690EEEBB952194
69 changed files with 3222 additions and 153 deletions

View file

@ -0,0 +1,17 @@
package com.anytypeio.anytype.data.auth.event
import com.anytypeio.anytype.core_models.Event
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.domain.chats.ChatEventChannel
import kotlinx.coroutines.flow.Flow
interface ChatEventRemoteChannel {
fun observe(chat: Id): Flow<List<Event.Command.Chats>>
class Default(
private val channel: ChatEventRemoteChannel
) : ChatEventChannel {
override fun observe(chat: Id): Flow<List<Event.Command.Chats>> {
return channel.observe(chat)
}
}
}

View file

@ -9,6 +9,7 @@ import com.anytypeio.anytype.core_models.DVFilter
import com.anytypeio.anytype.core_models.DVSort
import com.anytypeio.anytype.core_models.DVViewer
import com.anytypeio.anytype.core_models.DVViewerType
import com.anytypeio.anytype.core_models.Event
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.Key
import com.anytypeio.anytype.core_models.ManifestInfo
@ -24,6 +25,7 @@ import com.anytypeio.anytype.core_models.SearchResult
import com.anytypeio.anytype.core_models.Struct
import com.anytypeio.anytype.core_models.Url
import com.anytypeio.anytype.core_models.WidgetLayout
import com.anytypeio.anytype.core_models.chats.Chat
import com.anytypeio.anytype.core_models.history.DiffVersionResponse
import com.anytypeio.anytype.core_models.history.ShowVersionResponse
import com.anytypeio.anytype.core_models.history.Version
@ -1041,4 +1043,34 @@ class BlockDataRepository(
override suspend fun diffVersions(command: Command.VersionHistory.DiffVersions): DiffVersionResponse {
return remote.diffVersions(command)
}
override suspend fun addChatMessage(command: Command.ChatCommand.AddMessage): Pair<Id, List<Event.Command.Chats>> {
return remote.addChatMessage(command)
}
override suspend fun editChatMessage(command: Command.ChatCommand.EditMessage) {
remote.editChatMessage(command)
}
override suspend fun deleteChatMessage(command: Command.ChatCommand.DeleteMessage) {
remote.deleteChatMessage(command)
}
override suspend fun getChatMessages(command: Command.ChatCommand.GetMessages): List<Chat.Message> {
return remote.getChatMessages(command)
}
override suspend fun subscribeLastChatMessages(
command: Command.ChatCommand.SubscribeLastMessages
): Command.ChatCommand.SubscribeLastMessages.Response {
return remote.subscribeLastChatMessages(command)
}
override suspend fun toggleChatMessageReaction(command: Command.ChatCommand.ToggleMessageReaction) {
return remote.toggleChatMessageReaction(command = command)
}
override suspend fun unsubscribeChat(chat: Id) {
return remote.unsubscribeChat(chat)
}
}

View file

@ -9,6 +9,7 @@ import com.anytypeio.anytype.core_models.DVFilter
import com.anytypeio.anytype.core_models.DVSort
import com.anytypeio.anytype.core_models.DVViewer
import com.anytypeio.anytype.core_models.DVViewerType
import com.anytypeio.anytype.core_models.Event
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.Key
import com.anytypeio.anytype.core_models.ManifestInfo
@ -24,6 +25,7 @@ import com.anytypeio.anytype.core_models.SearchResult
import com.anytypeio.anytype.core_models.Struct
import com.anytypeio.anytype.core_models.Url
import com.anytypeio.anytype.core_models.WidgetLayout
import com.anytypeio.anytype.core_models.chats.Chat
import com.anytypeio.anytype.core_models.history.DiffVersionResponse
import com.anytypeio.anytype.core_models.history.ShowVersionResponse
import com.anytypeio.anytype.core_models.history.Version
@ -442,4 +444,16 @@ interface BlockRemote {
suspend fun showVersion(command: Command.VersionHistory.ShowVersion): ShowVersionResponse
suspend fun setVersion(command: Command.VersionHistory.SetVersion)
suspend fun diffVersions(command: Command.VersionHistory.DiffVersions): DiffVersionResponse
//region CHATS
suspend fun addChatMessage(command: Command.ChatCommand.AddMessage): Pair<Id, List<Event.Command.Chats>>
suspend fun editChatMessage(command: Command.ChatCommand.EditMessage)
suspend fun deleteChatMessage(command: Command.ChatCommand.DeleteMessage)
suspend fun getChatMessages(command: Command.ChatCommand.GetMessages): List<Chat.Message>
suspend fun subscribeLastChatMessages(command: Command.ChatCommand.SubscribeLastMessages): Command.ChatCommand.SubscribeLastMessages.Response
suspend fun toggleChatMessageReaction(command: Command.ChatCommand.ToggleMessageReaction)
suspend fun unsubscribeChat(chat: Id)
//endregion
}