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

DROID-2834 Protocol | Integrate 0.36.0-rc4 (#1572)

This commit is contained in:
Konstantin Ivanov 2024-09-18 17:17:31 +02:00 committed by GitHub
parent e8958a2dab
commit 47a07d05d0
Signed by: github
GPG key ID: B5690EEEBB952194
9 changed files with 299 additions and 4 deletions

View file

@ -50,7 +50,9 @@ data class ObjectType(
DATE(17),
SPACE_VIEW(18),
PARTICIPANT(19),
PDF(20);
PDF(20),
CHAT(21),
CHAT_DERIVED(22);
fun isProfileOrParticipant() = this == PROFILE || this == PARTICIPANT
}

View file

@ -113,7 +113,8 @@ sealed class P2PStatusUpdate {
enum class P2PStatus {
NOT_CONNECTED,
NOT_POSSIBLE,
CONNECTED
CONNECTED,
RESTRICTED
}
sealed class SpaceSyncAndP2PStatusState {

View file

@ -278,7 +278,7 @@ private fun getP2PCardSettings(
)
}
P2PStatus.NOT_POSSIBLE -> {
P2PStatus.NOT_POSSIBLE, P2PStatus.RESTRICTED -> {
CardSettings(
icon = painterResource(R.drawable.ic_sync_p2p_error),
mainText = stringResource(id = R.string.sync_status_p2p),

View file

@ -1,5 +1,5 @@
[versions]
middlewareVersion = "v0.36.0-rc3"
middlewareVersion = "v0.36.0-rc4"
kotlinVersion = '2.0.0'
kspVersion = "2.0.0-1.0.22"

View file

@ -694,6 +694,8 @@ fun MOTypeLayout.toCoreModels(): ObjectType.Layout = when (this) {
MOTypeLayout.relationOptionsList -> ObjectType.Layout.RELATION_OPTION_LIST
MOTypeLayout.spaceView -> ObjectType.Layout.SPACE_VIEW
MOTypeLayout.pdf -> ObjectType.Layout.PDF
MOTypeLayout.chat -> ObjectType.Layout.CHAT
MOTypeLayout.chatDerived -> ObjectType.Layout.CHAT_DERIVED
}
fun MRelationDataSource.source(): Relation.Source = when (this) {
@ -1102,6 +1104,7 @@ fun MP2PStatus.toCoreModel(): P2PStatus = when (this) {
MP2PStatus.NotConnected -> P2PStatus.NOT_CONNECTED
MP2PStatus.NotPossible -> P2PStatus.NOT_POSSIBLE
MP2PStatus.Connected -> P2PStatus.CONNECTED
MP2PStatus.Restricted -> P2PStatus.RESTRICTED
}
fun Rpc.History.Version.toCoreModel(): Version {

View file

@ -497,6 +497,8 @@ fun ObjectType.Layout.toMiddlewareModel(): MOTypeLayout = when (this) {
ObjectType.Layout.SPACE_VIEW -> MOTypeLayout.spaceView
ObjectType.Layout.PARTICIPANT -> MOTypeLayout.participant
ObjectType.Layout.PDF -> MOTypeLayout.pdf
ObjectType.Layout.CHAT -> MOTypeLayout.chat
ObjectType.Layout.CHAT_DERIVED -> MOTypeLayout.chatDerived
}
fun Relation.Format.toMiddlewareModel(): MRelationFormat = when (this) {

View file

@ -1592,6 +1592,28 @@ message Rpc {
}
}
message ChatAdd {
message Request {
string objectId = 1;
}
message Response {
Error error = 1;
string chatId = 2;
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
// ...
}
}
}
}
message BookmarkFetch {
message Request {
string contextId = 1;
@ -6405,6 +6427,7 @@ message Rpc {
message AccountSelectTrace {
message Request {
option (no_auth) = true;
string dir = 1; // empty means using OS-provided temp dir
}
message Response {
@ -7232,6 +7255,198 @@ message Rpc {
}
}
}
message Chat {
message AddMessage {
message Request {
string chatObjectId = 1;
model.ChatMessage message = 2;
}
message Response {
Error error = 1;
string messageId = 2;
ResponseEvent event = 3;
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
// ...
}
}
}
}
message EditMessageContent {
message Request {
string chatObjectId = 1;
string messageId = 2;
model.ChatMessage editedMessage = 3;
}
message Response {
Error error = 1;
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
// ...
}
}
}
}
message ToggleMessageReaction {
message Request {
string chatObjectId = 1;
string messageId = 2;
string emoji = 3;
}
message Response {
Error error = 1;
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
// ...
}
}
}
}
message DeleteMessage {
message Request {
string chatObjectId = 1;
string messageId = 2;
}
message Response {
Error error = 1;
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
// ...
}
}
}
}
message GetMessages {
message Request {
string chatObjectId = 1;
string beforeOrderId = 2; // OrderId of the message before which to get messages
int32 limit = 3;
}
message Response {
Error error = 1;
repeated model.ChatMessage messages = 2;
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
// ...
}
}
}
}
message GetMessagesByIds {
message Request {
string chatObjectId = 1;
repeated string messageIds = 2;
}
message Response {
Error error = 1;
repeated model.ChatMessage messages = 2;
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
// ...
}
}
}
}
message SubscribeLastMessages {
message Request {
string chatObjectId = 1; // Identifier for the chat
int32 limit = 2; // Number of max last messages to return and subscribe
}
message Response {
Error error = 1;
repeated model.ChatMessage messages = 2; // List of messages
int32 numMessagesBefore = 3; // Number of messages before the returned messages
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
// ...
}
}
}
}
message Unsubscribe {
message Request {
string chatObjectId = 1; // Identifier for the chat
}
message Response {
Error error = 1;
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
// ...
}
}
}
}
}
}

View file

@ -110,6 +110,30 @@ message Event {
P2PStatus.Update p2pStatusUpdate = 120;
Import.Finish importFinish = 121;
Chat.Add chatAdd = 128;
Chat.Update chatUpdate = 129;
Chat.UpdateReactions chatUpdateReactions = 130;
Chat.Delete chatDelete = 131;
}
}
message Chat {
message Add {
string id = 1;
string orderId = 2;
model.ChatMessage message = 3;
}
message Delete {
string id = 1;
}
message Update {
string id = 1;
model.ChatMessage message = 2;
}
message UpdateReactions {
string id = 1;
model.ChatMessage.Reactions reactions = 2;
}
}
@ -1028,6 +1052,7 @@ message Event {
Synced = 3;
Failed = 4;
IncompatibleVersion = 5;
NetworkNeedsUpdate = 6;
}
}
}
@ -1113,6 +1138,7 @@ message Event {
NotConnected = 0;
NotPossible = 1;
Connected = 2;
Restricted = 3; // only for ios for now, fallback to NotPossible if not implemented on client
}
}

View file

@ -51,6 +51,9 @@ enum SmartBlockType {
NotificationObject = 0x217;
DevicesObject = 0x218;
ChatObject = 0x219; // Container for any-store based chats
ChatDerivedObject = 0x220; // Any-store based object for chat
}
message Search {
@ -97,6 +100,7 @@ message Block {
Content.TableColumn tableColumn = 27;
Content.TableRow tableRow = 28;
Content.Widget widget = 29;
Content.Chat chat = 30;
}
message Restrictions {
@ -574,6 +578,9 @@ message Block {
View = 4;
}
}
message Chat {
}
}
}
@ -751,6 +758,8 @@ message ObjectType {
participant = 19;
pdf = 20;
chat = 21;
chatDerived = 22;
}
}
@ -1308,4 +1317,41 @@ message DeviceInfo {
int64 addDate = 3;
bool archived = 4;
bool isConnected = 5;
}
message ChatMessage {
string id = 1; // Unique message identifier
string orderId = 2; // Used for subscriptions
string creator = 3; // Identifier for the message creator
int64 createdAt = 4;
int64 modifiedAt = 9;
string replyToMessageId = 5; // Identifier for the message being replied to
MessageContent message = 6; // Message content
repeated Attachment attachments = 7; // Attachments slice
Reactions reactions = 8; // Reactions to the message
message MessageContent {
string text = 1; // The text content of the message part
Block.Content.Text.Style style = 2; // The style/type of the message part
repeated Block.Content.Text.Mark marks = 3; // List of marks applied to the text
}
message Attachment {
string target = 1; // Identifier for the attachment object
AttachmentType type = 2; // Type of attachment
enum AttachmentType {
FILE = 0; // File attachment
IMAGE = 1; // Image attachment
LINK = 2; // Link attachment
}
}
message Reactions {
map<string, IdentityList> reactions = 1; // Map of emoji to list of user IDs
message IdentityList {
repeated string ids = 1; // List of user IDs
}
}
}