diff --git a/lib/src/database/daos/messages.dao.dart b/lib/src/database/daos/messages.dao.dart index bc6a26e..85b2928 100644 --- a/lib/src/database/daos/messages.dao.dart +++ b/lib/src/database/daos/messages.dao.dart @@ -270,12 +270,13 @@ class MessagesDao extends DatabaseAccessor with _$MessagesDaoMixin { actionAt: Value(timestamp), ), ); - if (await haveAllMembers(messageId, MessageActionType.openedAt)) { - await twonlyDB.messagesDao.updateMessageId( - messageId, - MessagesCompanion(openedAt: Value(DateTime.now())), - ); - } + // Directly show as message opened as soon as one person has opened it + // if (await haveAllMembers(messageId, MessageActionType.openedAt)) { + await twonlyDB.messagesDao.updateMessageId( + messageId, + MessagesCompanion(openedAt: Value(DateTime.now())), + ); + // } } Future handleMessageAckByServer( @@ -291,12 +292,13 @@ class MessagesDao extends DatabaseAccessor with _$MessagesDaoMixin { actionAt: Value(timestamp), ), ); - if (await haveAllMembers(messageId, MessageActionType.ackByServerAt)) { - await twonlyDB.messagesDao.updateMessageId( - messageId, - MessagesCompanion(ackByServer: Value(DateTime.now())), - ); - } + // if (await haveAllMembers(messageId, MessageActionType.ackByServerAt)) { + /// always update the state, so it will be shown as soon as one member gets the message + await twonlyDB.messagesDao.updateMessageId( + messageId, + MessagesCompanion(ackByServer: Value(DateTime.now())), + ); + // } } Future haveAllMembers( diff --git a/lib/src/model/protobuf/client/groups.proto b/lib/src/model/protobuf/client/groups.proto new file mode 100644 index 0000000..140d754 --- /dev/null +++ b/lib/src/model/protobuf/client/groups.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +// Stored encrypted on the server in the members columns. +message GroupState { + repeated int64 memberIds = 1; + repeated int64 adminIds = 2; + string groupName = 3; + optional int64 deleteMessagesAfterMilliseconds = 4; + bytes _padding = 5; +} \ No newline at end of file diff --git a/lib/src/model/protobuf/client/messages.proto b/lib/src/model/protobuf/client/messages.proto index 9bdbd6f..57760f5 100644 --- a/lib/src/model/protobuf/client/messages.proto +++ b/lib/src/model/protobuf/client/messages.proto @@ -44,6 +44,31 @@ message EncryptedContent { optional PushKeys pushKeys = 11; optional Reaction reaction = 12; optional TextMessage textMessage = 13; + optional NewGroup newGroup = 14; + optional JoinGroup joinGroup = 15; + optional GroupUpdate groupUpdate = 16; + + + message NewGroup { + // key for the state stored on the server + string groupId = 1; + string stateId = 2; + bytes stateKey = 3; + bytes groupPublicKey = 4; + } + + message JoinGroup { + // key for the state stored on the server + string groupId = 1; + bytes groupPublicKey = 4; + } + + message GroupUpdate { + optional int64 removedAdmin = 1; + optional int64 removedUser = 2; + optional int64 groupName = 3; + optional int64 deleteMessagesAfterMilliseconds = 4; + } message TextMessage { string senderMessageId = 1;