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 uploading avatar [WPB-5965] #2673

Merged
merged 4 commits into from
Feb 7, 2024

Conversation

saleniuk
Copy link
Contributor

@saleniuk saleniuk commented Feb 7, 2024

BugWPB-5965 [Android] crash in AvatarPickerViewModel


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

It's one of the most frequently occurring crashes right now which happens during uploading new avatar.

Causes (Optional)

Sometimes, before the "current avatar" is downloaded, the lateinit var currentAvatarUri is not yet initialized, so when there's an error when uploading a new one, it crashes because it cannot set the "current" one back on the UI.
Also happened when someone closed the screen while the avatar was still being uploaded - a "nice to have" would be an option to upload the avatar in the background.

Solutions

Provide a state of loading the current avatar and use its url when it's already downloaded, otherwise set it as Empty.
The same can happen the other way around - when "current" avatar is downloaded later than the new one is uploaded, then it will not be wrongly overwritten.

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

How to Test

Have an account that doesn't have any avatar set, open the screen to update the avatar, turn off the network, choose an image and click "confirm" to try to upload a new avatar. Uploading will fail so the snackbar message should appear but the app shouldn't crash.


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 Feb 7, 2024

Test Results

793 tests   793 ✅  12m 26s ⏱️
108 suites    0 💤
108 files      0 ❌

Results for commit 091f5b4.

♻️ This comment has been updated with latest results.

@saleniuk saleniuk requested review from Garzas, a team, typfel, alexandreferris, mchenani and ohassine and removed request for a team February 7, 2024 16:00
Copy link
Contributor

github-actions bot commented Feb 7, 2024

APKs built during tests are available here. Scroll down to Artifacts!

@AndroidBob
Copy link
Collaborator

Build 2954 succeeded.

The build produced the following APK's:

@MohamadJaara MohamadJaara merged commit a05a3ce into release/candidate Feb 7, 2024
14 checks passed
@MohamadJaara MohamadJaara deleted the fix/crash-when-uploading-avatar branch February 7, 2024 17:22
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.

4 participants