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: Delete local conversation use case [#WPB-14601] #3182

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

m-zagorski
Copy link
Contributor

@m-zagorski m-zagorski commented Dec 17, 2024

StoryWPB-14601 [Android] create use case to remove a conversation locally

https://wearezeta.atlassian.net/browse/WPB-14601

What's new in this PR?

Issues

Have an option to delete conversation locally with assets, contents and conversation itself

Solutions

Create use case for clearing assets and create use case for deleting conversation which involves:

  • Clear all assets
  • Clear content
  • Remove conversation

PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

Copy link
Contributor

github-actions bot commented Dec 17, 2024

Test Results

3 378 tests  +7   3 271 ✅ +7   5m 45s ⏱️ +21s
  580 suites +2     107 💤 ±0 
  580 files   +2       0 ❌ ±0 

Results for commit 63f6b41. ± Comparison against base commit ecdca03.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Dec 17, 2024

@codecov-commenter
Copy link

codecov-commenter commented Dec 17, 2024

Codecov Report

Attention: Patch coverage is 45.94595% with 20 lines in your changes missing coverage. Please review.

Project coverage is 54.11%. Comparing base (ecdca03) to head (63f6b41).

Files with missing lines Patch % Lines
...um/logic/feature/conversation/ConversationScope.kt 0.00% 10 Missing ⚠️
...e/kalium/persistence/dao/message/MessageDAOImpl.kt 0.00% 5 Missing ⚠️
.../logic/data/conversation/ConversationRepository.kt 0.00% 3 Missing ⚠️
...ire/kalium/logic/data/message/MessageRepository.kt 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3182      +/-   ##
===========================================
- Coverage    54.12%   54.11%   -0.02%     
===========================================
  Files         1262     1264       +2     
  Lines        36756    36793      +37     
  Branches      3734     3735       +1     
===========================================
+ Hits         19896    19910      +14     
- Misses       15421    15443      +22     
- Partials      1439     1440       +1     
Files with missing lines Coverage Δ
...versation/ClearConversationAssetsLocallyUseCase.kt 100.00% <100.00%> (ø)
...e/conversation/DeleteConversationLocallyUseCase.kt 100.00% <100.00%> (ø)
.../wire/kalium/persistence/dao/message/MessageDAO.kt 100.00% <ø> (ø)
...ire/kalium/logic/data/message/MessageRepository.kt 48.82% <0.00%> (-0.39%) ⬇️
.../logic/data/conversation/ConversationRepository.kt 61.38% <0.00%> (-0.37%) ⬇️
...e/kalium/persistence/dao/message/MessageDAOImpl.kt 69.34% <0.00%> (-1.29%) ⬇️
...um/logic/feature/conversation/ConversationScope.kt 0.00% <0.00%> (ø)

... and 2 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 ecdca03...63f6b41. Read the comment docs.

@datadog-wireapp
Copy link

datadog-wireapp bot commented Dec 17, 2024

Datadog Report

Branch report: feat/delete-local-conversation-use-case
Commit report: e873364
Test service: kalium-jvm

✅ 0 Failed, 3271 Passed, 107 Skipped, 1m 2.23s Total Time

@sergeibakhtiarov
Copy link
Contributor

Question about Delete and Clear use cases. I believe these usecases can be called from UI view models (from viewmodel scope). What will happen if user closes the screen before the use case is finished with removal the assets and view model scope is cancelled?
This could potentially leave the conversation / assets partially cleared. I would consider using NonCancellable job for such operations.

@m-zagorski
Copy link
Contributor Author

Question about Delete and Clear use cases. I believe these usecases can be called from UI view models (from viewmodel scope). What will happen if user closes the screen before the use case is finished with removal the assets and view model scope is cancelled? This could potentially leave the conversation / assets partially cleared. I would consider using NonCancellable job for such operations.

Yes, when we close up the screen while invoking the use cases it will be partially deleted. I would say that it is on the client side to decide the usage:

  • Start a service that does the job - this way it will run until its done, or eventually retry if needed
  • Display progress while the deletion is in progress

Personally Im not a big fan of using NonCancellable jobs in the business logic directly because it limits a little bit the possible usage. In the current state the client has the full control over the process, it can eventually give user an option to cancel the ongoing deletion process and will be able to do so with the current scoping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants