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

fix: crash when saving bottom sheet state for message with reply [WPB-14433] 🍒 #3695

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

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Dec 2, 2024

This PR was automatically cherry-picked based on the following PR:

Original PR description:


BugWPB-14433 [Android] Crash after longtapping on a conversation and putting phone to sleep


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?

Issues

After fixing bottom sheet crashes with this PR: #3670, still bottom sheet for message with a reply crashes.

Causes (Optional)

Android Studio had some problems highlighting all models that need to be serialized so previous PR missed out some of them. Also, turns out that using multiple serializer types can lead to some problems (in this case it was Json and Bundlizer).

Solutions

Make all classes used by UIMessage serializable, to be 100% sure.
Replace Any primitive type serializer that uses Json with a more custom one that does it via surrogate.
Wrap serialization in try-catch so that if it fails, the app doesn't crash and only the bottom sheet is hidden as there's no saved state for it.

Update: after the discussion, it was decided to drop saving the state for now and come up with some solution to not store too much, especially for conversations and messages to not keep such data unencrypted anywhere, so in the future when there's time to do that we could slim down the models for the bottom sheets to save only required data and not any sensitive ones. For now rememberSaveable is replaced with regular remember so the bottom sheet won't be rebuilt and the only drawback would be that the user would need to open it again.

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

How to Test

Open conversation, long-click on a message with a reply to open the bottom sheet and put the app into background.


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.

@github-actions github-actions bot added cherry-pick PR is cherry-picking changes from another banch echoes: unplanned Any work item that isn’t part of the product or technical roadmap. size/S labels Dec 2, 2024
Copy link

sonarcloud bot commented Dec 3, 2024

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 25.71429% with 26 lines in your changes missing coverage. Please review.

Project coverage is 45.73%. Comparing base (d5b89ca) to head (5864ecc).

Files with missing lines Patch % Lines
...ire/android/util/AnyPrimitiveAsStringSerializer.kt 8.69% 21 Missing ⚠️
...oid/ui/home/conversations/model/UIQuotedMessage.kt 50.00% 4 Missing ⚠️
...e/android/ui/home/conversations/model/UIMessage.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3695      +/-   ##
===========================================
- Coverage    45.77%   45.73%   -0.05%     
===========================================
  Files          472      473       +1     
  Lines        16024    16055      +31     
  Branches      2705     2713       +8     
===========================================
+ Hits          7335     7342       +7     
- Misses        7928     7952      +24     
  Partials       761      761              
Files with missing lines Coverage Δ
...c/main/kotlin/com/wire/android/model/ImageAsset.kt 84.00% <100.00%> (+0.66%) ⬆️
...src/main/kotlin/com/wire/android/util/ui/UIText.kt 38.46% <100.00%> (ø)
...e/android/ui/home/conversations/model/UIMessage.kt 40.00% <0.00%> (-0.17%) ⬇️
...oid/ui/home/conversations/model/UIQuotedMessage.kt 36.58% <50.00%> (+5.15%) ⬆️
...ire/android/util/AnyPrimitiveAsStringSerializer.kt 8.69% <8.69%> (ø)

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 d5b89ca...5864ecc. Read the comment docs.

Copy link
Contributor Author

github-actions bot commented Dec 3, 2024

Built wire-android-staging-compat-pr-3695.apk is available for download

Copy link
Contributor Author

github-actions bot commented Dec 3, 2024

Built wire-android-dev-debug-pr-3695.apk is available for download

@saleniuk saleniuk requested review from MohamadJaara, a team, typfel, m-zagorski, ohassine and damian-kaczmarek and removed request for a team December 3, 2024 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick PR is cherry-picking changes from another banch echoes: unplanned Any work item that isn’t part of the product or technical roadmap. size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants