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: crashing message composer input [WPB-8727] 🍒 #2997

Closed

Conversation

github-actions[bot]
Copy link
Contributor

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

Original PR description:


BugWPB-8727 [Android] Crash when using tapping on input field while trying to type a message


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

The app is crashing sometimes when clicking on the message composer input.

Causes (Optional)

Changing readOnly parameter probably messes something up with the inner text field state so that it ends up with java.lang.IllegalStateException: LayoutCoordinate operations are only valid when isAttached is true.

Solutions

Getting rid of readOnly is not possible because it was introduced some time ago to fix some other issues that we had with message composer and keyboard.
New BasicTextField2 resolves multiple issues that the previous generation of text input had, including this one. BasicTextField2 has been renamed to regular BasicTextField in newest compose library; the difference is that new one takes TextFieldState instead of TextFieldValue or String.
We decided to use this new version of text field for the message composer. In order to do that, a new hybrid WireTextField2 is created which allows us to use the new generation of text input but also to still pass TextFieldValue and onValueChanged callback to make this refactor as minimally invasive as possible. This WireTextField2 uses StateSyncingModifier which is based on compose BasicTextFieldWithValueOnValueChangeSample which allows to synchronise between TextFieldState and TextFieldValue with onValueChanged callback.
It's needed to update the compose-foundation library to 1.7.0-alpha05, from which BasicTextField2 has been marked as stable and still older BasicTextField is available. In versions prior to chosen one, including current newest release version - 1.6.7, BasicTextField2 has some bad issues with the keyboard (https://issuetracker.google.com/issues/339171226) and interaction source (https://issuetracker.google.com/issues/327665606). To use this version, rememberRipple() needs to be updated to ripple() and AnchoredDraggableState also requires decayAnimationSpec.

Testing

How to Test

Open conversation screen and click on message composer input right after navigating, preferably on Graphene OS.


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 size/M labels May 10, 2024
@saleniuk
Copy link
Contributor

For develop it's handled here: #2991

@saleniuk saleniuk closed this May 10, 2024
@saleniuk saleniuk deleted the fix/message-composer-input-crash-cherry-pick branch May 10, 2024 15:24
@AndroidBob
Copy link
Collaborator

Build 4715 succeeded.

The build produced the following APK's:

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 size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants