-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: receive and store composite messages [part-1] #1888
feat: receive and store composite messages [part-1] #1888
Conversation
…s/map_from_to_proto
is MessageContent.ButtonAction -> TODO() | ||
is MessageContent.ButtonActionConfirmation -> TODO() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ButtonAction and ButtonActionConfirmation will be handled in a separate PR
sealed interface WithUser : MessagePreviewContent { | ||
val username: String? | ||
data class Text(override val username: String?, val messageBody: String?) : WithUser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the idea here is composite messages preview are handled as text messages
val senderName: String?, | ||
override val username: String?, | ||
val isSelfUserAdded: Boolean, | ||
val otherUserIdList: List<UserId> // TODO add usernames | ||
) : WithUser(senderName) | ||
) : WithUser | ||
|
||
data class MembersRemoved( | ||
val senderName: String?, | ||
override val username: String?, | ||
val isSelfUserRemoved: Boolean, | ||
val otherUserIdList: List<UserId> // TODO add usernames | ||
) : WithUser(senderName) | ||
) : WithUser | ||
|
||
data class MembersFailedToAdd( | ||
val senderName: String?, | ||
override val username: String?, | ||
val isSelfUserRemoved: Boolean, | ||
val otherUserIdList: List<UserId> // TODO add usernames | ||
) : WithUser(senderName) | ||
) : WithUser | ||
|
||
data class MembersCreationAdded( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those had duplicated fields, senderName and userName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, I believe just some small changes needed.
logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt
Outdated
Show resolved
Hide resolved
logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt
Outdated
Show resolved
Hide resolved
persistence/src/commonMain/db_user/com/wire/kalium/persistence/content/ButtonContent.sq
Outdated
Show resolved
Hide resolved
persistence/src/commonMain/db_user/com/wire/kalium/persistence/Messagepreview.sq
Outdated
Show resolved
Hide resolved
...ence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/message/MessageInsertExtension.kt
Outdated
Show resolved
Hide resolved
…/MessageContent.kt Co-authored-by: Vitor Hugo Schwaab <[email protected]>
…/MessageContent.kt Co-authored-by: Vitor Hugo Schwaab <[email protected]>
logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageMapper.kt
Show resolved
Hide resolved
logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageMapper.kt
Outdated
Show resolved
Hide resolved
logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/ProtoContentMapper.kt
Outdated
Show resolved
Hide resolved
logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/ProtoContentMapper.kt
Show resolved
Hide resolved
logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/ProtoContentMapper.kt
Outdated
Show resolved
Hide resolved
...ence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/message/MessageInsertExtension.kt
Show resolved
Hide resolved
@@ -487,6 +490,37 @@ object MessageMapper { | |||
restrictedAssetName.requireField("assetName") | |||
) | |||
|
|||
MessageEntity.ContentType.COMPOSITE -> { | |||
// if the text body is null then the composite message had no text body |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a local variable stating the above instead of a comment would be better here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is already a local val
val compositeText: MessageEntityContent.Text? = text?.let {
the comment just so no body add a .requireField
to the text content since it is fine if it is missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't that kind of obvious from not adding .requireField ? is this comment really necessary ? anyways a minor thing, do as you wish to not block it :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job ! Nothing major from my side, but I would like to have my comments resolved before u make the final call, but I already give the approval 🍖
…s/map_from_to_proto # Conflicts: # persistence/src/commonMain/db_user/migrations/49.sqm
* feat: receive and store composite messages [part-1] (#1888) * receive composite messages * map composite to proto * detekt * detekt * db migration * db migration * sqm * map to composite entity * detekt * remove is pending state from the DB * Update logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt Co-authored-by: Vitor Hugo Schwaab <[email protected]> * Update logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt Co-authored-by: Vitor Hugo Schwaab <[email protected]> * address PR comments * detekt * remove composite message preview mapping * fix migration * merge issues * address PR comments * address PR comments * detekt --------- Co-authored-by: Vitor Hugo Schwaab <[email protected]> * feat: use case to send Message Button Action [part-2] (#1896) * receive composite messages * map composite to proto * detekt * detekt * db migration * db migration * sqm * map to composite entity * detekt * remove is pending state from the DB * Update logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt Co-authored-by: Vitor Hugo Schwaab <[email protected]> * Update logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt Co-authored-by: Vitor Hugo Schwaab <[email protected]> * address PR comments * detekt * remove composite message preview mapping * fix migration * feat: use case to execute composite message action * expose use case to message scope * missing param * rename use case * docs * map to proto * merge issues * address PR comments * address PR comments * detekt * sent the message only to the message original sender * detekt * Update logic/src/commonTest/kotlin/com/wire/kalium/logic/data/message/MessageMetaDataRepositoryTest.kt Co-authored-by: Alexandre Ferris <[email protected]> * PR comments --------- Co-authored-by: Vitor Hugo Schwaab <[email protected]> Co-authored-by: Alexandre Ferris <[email protected]> * feat: handle composite action confermation message [part-3] (#1901) * receive composite messages * map composite to proto * detekt * detekt * db migration * db migration * sqm * map to composite entity * detekt * remove is pending state from the DB * Update logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt Co-authored-by: Vitor Hugo Schwaab <[email protected]> * Update logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt Co-authored-by: Vitor Hugo Schwaab <[email protected]> * address PR comments * detekt * remove composite message preview mapping * fix migration * feat: use case to execute composite message action * expose use case to message scope * missing param * rename use case * docs * map to proto * merge issues * address PR comments * address PR comments * detekt * handle ButtonActionConfirmation event * add unit test * detekt * detekt * sent the message only to the message original sender * detekt --------- Co-authored-by: Vitor Hugo Schwaab <[email protected]> * feat: composite message preview [part-4] (#1908) * receive composite messages * map composite to proto * detekt * detekt * db migration * db migration * sqm * map to composite entity * detekt * remove is pending state from the DB * Update logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt Co-authored-by: Vitor Hugo Schwaab <[email protected]> * Update logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt Co-authored-by: Vitor Hugo Schwaab <[email protected]> * address PR comments * detekt * remove composite message preview mapping * fix migration * feat: use case to execute composite message action * expose use case to message scope * missing param * rename use case * docs * map to proto * merge issues * address PR comments * address PR comments * detekt * handle ButtonActionConfirmation event * add unit test * detekt * detekt * sent the message only to the message original sender * detekt * feat: map composite messages preview * Update persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/message/MessageMapper.kt Co-authored-by: Alexandre Ferris <[email protected]> --------- Co-authored-by: Vitor Hugo Schwaab <[email protected]> Co-authored-by: Alexandre Ferris <[email protected]> * fix: composite messages are not included in the getLastMessages query [part-5] (#1909) * include composite messages to message preview * detekt * feat: display composite message preview * add test * feat: composit messages backup [part-6] (#1914) * fea: include message buttons into the backup * import buttons * merge issues * unit test * merge issues * ignore Confirmation messages that are not fom the original message sender * test * cleanup * detekt * typo * typo * PR comments * trigger CI * empty --------- Co-authored-by: Vitor Hugo Schwaab <[email protected]> Co-authored-by: Alexandre Ferris <[email protected]> Co-authored-by: Tommaso Piazza <[email protected]>
* feat: receive and store composite messages [part-1] (#1888) * receive composite messages * map composite to proto * detekt * detekt * db migration * db migration * sqm * map to composite entity * detekt * remove is pending state from the DB * Update logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt Co-authored-by: Vitor Hugo Schwaab <[email protected]> * Update logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt Co-authored-by: Vitor Hugo Schwaab <[email protected]> * address PR comments * detekt * remove composite message preview mapping * fix migration * merge issues * address PR comments * address PR comments * detekt --------- Co-authored-by: Vitor Hugo Schwaab <[email protected]> * feat: use case to send Message Button Action [part-2] (#1896) * receive composite messages * map composite to proto * detekt * detekt * db migration * db migration * sqm * map to composite entity * detekt * remove is pending state from the DB * Update logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt Co-authored-by: Vitor Hugo Schwaab <[email protected]> * Update logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt Co-authored-by: Vitor Hugo Schwaab <[email protected]> * address PR comments * detekt * remove composite message preview mapping * fix migration * feat: use case to execute composite message action * expose use case to message scope * missing param * rename use case * docs * map to proto * merge issues * address PR comments * address PR comments * detekt * sent the message only to the message original sender * detekt * Update logic/src/commonTest/kotlin/com/wire/kalium/logic/data/message/MessageMetaDataRepositoryTest.kt Co-authored-by: Alexandre Ferris <[email protected]> * PR comments --------- Co-authored-by: Vitor Hugo Schwaab <[email protected]> Co-authored-by: Alexandre Ferris <[email protected]> * feat: handle composite action confermation message [part-3] (#1901) * receive composite messages * map composite to proto * detekt * detekt * db migration * db migration * sqm * map to composite entity * detekt * remove is pending state from the DB * Update logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt Co-authored-by: Vitor Hugo Schwaab <[email protected]> * Update logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt Co-authored-by: Vitor Hugo Schwaab <[email protected]> * address PR comments * detekt * remove composite message preview mapping * fix migration * feat: use case to execute composite message action * expose use case to message scope * missing param * rename use case * docs * map to proto * merge issues * address PR comments * address PR comments * detekt * handle ButtonActionConfirmation event * add unit test * detekt * detekt * sent the message only to the message original sender * detekt --------- Co-authored-by: Vitor Hugo Schwaab <[email protected]> * feat: composite message preview [part-4] (#1908) * receive composite messages * map composite to proto * detekt * detekt * db migration * db migration * sqm * map to composite entity * detekt * remove is pending state from the DB * Update logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt Co-authored-by: Vitor Hugo Schwaab <[email protected]> * Update logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageContent.kt Co-authored-by: Vitor Hugo Schwaab <[email protected]> * address PR comments * detekt * remove composite message preview mapping * fix migration * feat: use case to execute composite message action * expose use case to message scope * missing param * rename use case * docs * map to proto * merge issues * address PR comments * address PR comments * detekt * handle ButtonActionConfirmation event * add unit test * detekt * detekt * sent the message only to the message original sender * detekt * feat: map composite messages preview * Update persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/message/MessageMapper.kt Co-authored-by: Alexandre Ferris <[email protected]> --------- Co-authored-by: Vitor Hugo Schwaab <[email protected]> Co-authored-by: Alexandre Ferris <[email protected]> * fix: composite messages are not included in the getLastMessages query [part-5] (#1909) * include composite messages to message preview * detekt * feat: display composite message preview * add test * feat: composit messages backup [part-6] (#1914) * fea: include message buttons into the backup * import buttons * merge issues * unit test * merge issues * ignore Confirmation messages that are not fom the original message sender * test * cleanup * detekt * typo * typo * PR comments * feat: Get and save clients mlsPublicKeys * feat: Get and save clients mlsPublicKeys: code stly * feat: Get and save clients mlsPublicKeys: tests fix * feat: Get and save clients mlsPublicKeys: removed logs --------- Co-authored-by: Mohamad Jaara <[email protected]> Co-authored-by: Vitor Hugo Schwaab <[email protected]> Co-authored-by: Alexandre Ferris <[email protected]>
PR Submission Checklist for internal contributors
The PR Title
SQPIT-764
The PR Description
What's new in this PR?
Issues
kalium does not handle composite messages
Solutions
map composite messages from/to proto and store the content
composite messages have a list of items where each item can be either a Text message content (with mentions, quote, ...ect ) or a Button
I did take the assumption that there is at most one text content, since we do not support having multiple content from the same type for one messages.
i did also move the messages views to separate file since
Messages.sq
is getting too big for its own goodNeeds releases with:
Testing
Test Coverage (Optional)
How to Test
Briefly describe how this change was tested and if applicable the exact steps taken to verify that it works as expected.
Notes (Optional)
Specify here any other facts that you think are important for this issue.
Attachments (Optional)
Attachments like images, videos, etc. (drag and drop in the text box)
PR Post Submission Checklist for internal contributors (Optional)
PR Post Merge Checklist for internal contributors
References
feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764
.