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] #3670

Merged
merged 11 commits into from
Nov 28, 2024

Conversation

saleniuk
Copy link
Contributor

@saleniuk saleniuk commented Nov 26, 2024

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

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 26, 2024
Copy link

Ups 🫰🟨

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

@codecov-commenter
Copy link

codecov-commenter commented Nov 27, 2024

Codecov Report

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

Project coverage is 44.95%. Comparing base (dc825b0) to head (7a60efc).
Report is 1 commits behind head on release/candidate.

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                  @@
##           release/candidate    #3670      +/-   ##
=====================================================
- Coverage              45.33%   44.95%   -0.38%     
=====================================================
  Files                    471      471              
  Lines                  15856    15732     -124     
  Branches                2657     2690      +33     
=====================================================
- Hits                    7188     7073     -115     
- Misses                  7895     7901       +6     
+ Partials                 773      758      -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 60.00% <100.00%> (-2.80%) ⬇️
...me/conversations/info/ConversationInfoViewModel.kt 81.94% <100.00%> (-0.25%) ⬇️
...tions/usecase/GetConversationsFromSearchUseCase.kt 84.61% <100.00%> (-0.57%) ⬇️
...ome/conversationslist/ConversationListViewModel.kt 30.83% <ø> (-0.61%) ⬇️
.../ui/home/conversationslist/model/BadgeEventType.kt 100.00% <100.00%> (+18.18%) ⬆️
...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 dc825b0...7a60efc. Read the comment docs.

…into fix/crash-bottom-sheet-save-state

# Conflicts:
#	kalium
Copy link
Contributor

@saleniuk looks like you are rolling back kalium to a previous commitish.

This means that the PR's target branch (release/candidate) is using a newer version of Kalium, and the changes in this PR will rollback Kalium to an older version.

release/candidate This PR
5b2361e4f96ef7f51410ff97fe6e1a907e84d455 57296471d97f517af84aba13a8a688a0aa8b3b4d

Is this intentional?

@saleniuk saleniuk requested review from a team, typfel, alexandreferris, borichellow, Garzas and damian-kaczmarek and removed request for a team November 27, 2024 09:19
Copy link
Contributor

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

Copy link
Contributor

@saleniuk looks like you are rolling back kalium to a previous commitish.

This means that the PR's target branch (release/candidate) is using a newer version of Kalium, and the changes in this PR will rollback Kalium to an older version.

release/candidate This PR
5b2361e4f96ef7f51410ff97fe6e1a907e84d455 76f6cd1213ee9d81ef756ff25dadb006c1567861

Is this intentional?

Copy link
Contributor

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

…into fix/crash-bottom-sheet-save-state

# Conflicts:
#	kalium
Copy link

sonarcloud bot commented Nov 28, 2024

@MohamadJaara MohamadJaara added this pull request to the merge queue Nov 28, 2024
Copy link
Contributor

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

Merged via the queue into release/candidate with commit 15a1b5e Nov 28, 2024
14 checks passed
@MohamadJaara MohamadJaara deleted the fix/crash-bottom-sheet-save-state branch November 28, 2024 11:19
yamilmedina added a commit that referenced this pull request Dec 3, 2024
@yamilmedina yamilmedina mentioned this pull request Dec 3, 2024
7 tasks
github-merge-queue bot pushed a commit that referenced this pull request Dec 3, 2024
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