Skip to content
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: message draft [WPB-1021] #2664

Merged
merged 7 commits into from
Mar 21, 2024
Merged

feat: message draft [WPB-1021] #2664

merged 7 commits into from
Mar 21, 2024

Conversation

Garzas
Copy link
Contributor

@Garzas Garzas commented Mar 17, 2024


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Implemented message draft table to save message drafts when user leaves conversation screen before sending message. It saves

  • text
  • mentions
  • quoted message id


import com.wire.kalium.logic.data.message.mention.MessageMention

data class MessageDraft(
Copy link
Member

@vitorhugods vitorhugods Mar 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if instead of adding nullables, we create sealed implementations?

DraftMessage.Reply

DraftMessage.Edit

DraftMessage.Simple

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's not worth it because it can be divided only into 2 types which one doesn't have quoted Id and one which has. Rest variables can be combined (edited message can have quote, mentions) and at the end it will be merged into one entity object saved in db

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. I forgot about the possibility of it being both Reply and Edit at the same time.

@Garzas Garzas requested a review from vitorhugods March 17, 2024 13:59
Copy link
Contributor

github-actions bot commented Mar 17, 2024

Test Results

3 008 tests  +12   2 887 ✔️ +12   2m 37s ⏱️ +8s
   522 suites +  5      121 💤 ±  0 
   522 files   +  5          0 ±  0 

Results for commit 8b8eb5a. ± Comparison against base commit 303de42.

♻️ This comment has been updated with latest results.

@codecov-commenter
Copy link

codecov-commenter commented Mar 17, 2024

Codecov Report

Attention: Patch coverage is 86.95652% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 58.78%. Comparing base (303de42) to head (8b8eb5a).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #2664      +/-   ##
=============================================
+ Coverage      58.71%   58.78%   +0.06%     
  Complexity         7        7              
=============================================
  Files           1188     1199      +11     
  Lines          46523    46716     +193     
  Branches        4386     4389       +3     
=============================================
+ Hits           27314    27460     +146     
- Misses         17250    17291      +41     
- Partials        1959     1965       +6     
Files Coverage Δ
...re/kalium/logic/data/message/draft/MessageDraft.kt 100.00% <100.00%> (ø)
...ium/logic/data/message/draft/MessageDraftMapper.kt 100.00% <100.00%> (ø)
...logic/data/message/mention/MessageMentionMapper.kt 100.00% <100.00%> (ø)
...e/kalium/persistence/adapter/MentionListAdapter.kt 100.00% <100.00%> (ø)
...ersistence/dao/message/draft/MessageDraftEntity.kt 100.00% <100.00%> (ø)
...tlin/com/wire/kalium/persistence/db/TableMapper.kt 100.00% <100.00%> (ø)
.../wire/kalium/persistence/db/UserDatabaseBuilder.kt 79.45% <100.00%> (+0.57%) ⬆️
...logic/data/message/draft/MessageDraftRepository.kt 90.00% <90.00%> (ø)
...ic/feature/message/draft/GetMessageDraftUseCase.kt 85.71% <85.71%> (ø)
...feature/message/draft/RemoveMessageDraftUseCase.kt 85.71% <85.71%> (ø)
... and 4 more

... and 8 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 303de42...8b8eb5a. Read the comment docs.

CREATE TABLE MessageDrafts (
conversation_id TEXT AS QualifiedIDEntity NOT NULL,
text TEXT,
edit_message_id TEXT,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the reply and edit also be also a FOREIGN KEY to a message ID ? in that case if the message got deleted or changed we can change how draft will react
we can for example set the edit_message_id or qouted_message_id to null when deleted on changed

https://www.sqlite.org/foreignkeys.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea

Copy link
Member

@MohamadJaara MohamadJaara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work as always

@datadog-wireapp
Copy link

datadog-wireapp bot commented Mar 21, 2024

Datadog Report

All test runs df59ba2 🔗

2 Total Test Services: 0 Failed, 2 Passed

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Wall Time Test Service View
kalium-ios 0 0 0 2536 73 5m 18.1s Link
kalium-jvm 0 0 0 2887 121 13m 29.04s Link

@Garzas Garzas added this pull request to the merge queue Mar 21, 2024
Merged via the queue into develop with commit 91a09ff Mar 21, 2024
17 checks passed
@Garzas Garzas deleted the feat/message-draft branch March 21, 2024 13:18
@echoes-hq echoes-hq bot added the echoes: features End-user visible changes intended to create customer value label Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants