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 [WPB-14433] 🍒 #3683

Merged
merged 3 commits into from
Nov 29, 2024

Conversation

saleniuk
Copy link
Contributor

@saleniuk saleniuk commented Nov 28, 2024

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

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

Original PR description:


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

When saving conversation menu state, models cannot be saved into bundle resulting in a crash.

Causes (Optional)

rememberSaveable stores data in a Bundle but not every type can be saved there.

Solutions

Add kotlin serialization to models that are used in bottom sheets.
Remove image loader from models and create dedicated view model to inject it directly to avatar image composable instead.

Dependencies (Optional)

Needs releases with:

Testing

How to Test

STR:
-open the app
-long click on any conversation to open bottom sheet
-turn off the phone
The app shouldn't crash.

This can be better tested with enabled another screen orientation in the app and rotating the screen as simply turning off may not be enough to crash, but it requires changing android:screenOrientation to unspecified in the manifest.


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.

@echoes-hq echoes-hq bot added the echoes: unplanned Any work item that isn’t part of the product or technical roadmap. label Nov 28, 2024
Copy link

Ups 🫰🟨

This PR is too big. Please try to break it up into smaller PRs.

Copy link

sonarcloud bot commented Nov 28, 2024

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 41.12150% with 126 lines in your changes missing coverage. Please review.

Project coverage is 45.76%. Comparing base (bbded96) to head (4f12d54).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
...e/android/ui/home/conversations/model/UIMessage.kt 31.49% 87 Missing ⚠️
...e/conversations/messages/item/SystemMessageItem.kt 0.00% 8 Missing and 1 partial ⚠️
...c/main/kotlin/com/wire/android/model/ImageAsset.kt 55.55% 4 Missing ⚠️
...i/home/conversationslist/model/ConversationItem.kt 20.00% 4 Missing ⚠️
...in/kotlin/com/wire/android/mapper/ContactMapper.kt 0.00% 3 Missing ⚠️
.../wire/android/mapper/SystemMessageContentMapper.kt 0.00% 3 Missing ⚠️
...om/wire/android/util/ui/LocalizedStringResource.kt 40.00% 3 Missing ⚠️
...src/main/kotlin/com/wire/android/util/ui/UIText.kt 50.00% 3 Missing ⚠️
...tlin/com/wire/android/mapper/ConversationMapper.kt 0.00% 0 Missing and 2 partials ⚠️
...lin/com/wire/android/mapper/UIParticipantMapper.kt 50.00% 2 Missing ⚠️
... and 6 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3683      +/-   ##
===========================================
- Coverage    46.09%   45.76%   -0.34%     
===========================================
  Files          473      473              
  Lines        16160    16028     -132     
  Branches      2676     2709      +33     
===========================================
- Hits          7449     7335     -114     
+ Misses        7933     7930       -3     
+ Partials       778      763      -15     
Files with missing lines Coverage Δ
...in/kotlin/com/wire/android/mapper/MessageMapper.kt 60.78% <100.00%> (-0.39%) ⬇️
...tlin/com/wire/android/mapper/OtherAccountMapper.kt 83.33% <100.00%> (-2.39%) ⬇️
...wire/android/mapper/RegularMessageContentMapper.kt 18.66% <ø> (-0.29%) ⬇️
...in/kotlin/com/wire/android/model/UserAvatarData.kt 11.11% <100.00%> (-20.71%) ⬇️
...n/kotlin/com/wire/android/ui/home/HomeViewModel.kt 63.46% <100.00%> (-2.00%) ⬇️
...me/conversations/info/ConversationInfoViewModel.kt 81.94% <100.00%> (-0.25%) ⬇️
...tions/usecase/GetConversationsFromSearchUseCase.kt 84.78% <ø> (-0.64%) ⬇️
...ome/conversationslist/ConversationListViewModel.kt 32.35% <ø> (-0.15%) ⬇️
.../ui/home/conversationslist/model/BadgeEventType.kt 100.00% <100.00%> (+45.45%) ⬆️
...e/android/ui/home/gallery/MediaGalleryViewModel.kt 74.35% <ø> (-0.33%) ⬇️
... and 18 more

... and 1 file 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 bbded96...4f12d54. Read the comment docs.

Copy link
Contributor

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

Copy link
Contributor

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

@saleniuk saleniuk requested review from a team, typfel, m-zagorski, alexandreferris, MohamadJaara and mathias-niboulies and removed request for a team November 28, 2024 16:23
@saleniuk saleniuk added this pull request to the merge queue Nov 29, 2024
Merged via the queue into develop with commit aa35a0b Nov 29, 2024
13 of 14 checks passed
@saleniuk saleniuk deleted the fix/crash-bottom-sheet-save-state-cherry-pick branch November 29, 2024 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
echoes: unplanned Any work item that isn’t part of the product or technical roadmap. size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants