wire-android icon indicating copy to clipboard operation
wire-android copied to clipboard

refactor: introduce BasicTextField2 [WPB-8779] [WPB-8727]

Open saleniuk opened this issue 9 months ago • 7 comments

TaskWPB-8779 Introduce BasicTextField2


PR Submission Checklist for internal contributors

  • The PR Title

    • [x] conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • [x] contains a reference JIRA issue number like SQPIT-764
    • [x] answers the question: If merged, this PR will: ... ³
  • The PR Description

    • [x] is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

There are some issues with current text fields, numerous crashes or weird behaviours. Google noticed that some time ago and started working on v2. This PR is introducing BasicTextField2 into our project, replacing all our current text fields with the new version, at this moment temporarily still using our logic with passing TextFieldValue and onValueChanged callbacks. Ultimately, all text fields should be migrated to use TextFieldState.

In this PR:

  • the compose-foundation library needed to be updated to 1.7.0-alpha05, from which BasicTextField2 has been marked as stable; 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 1.7.0 version, rememberRipple() needs to be updated to ripple() and AnchoredDraggableState also requires decayAnimationSpec
  • our each input type now has two different versions, one "hybrid" still with TextFieldValue and onValueChanged and second one already with TextFieldState - it applies to WireTextField, WirePasswordTextField and CodeTextField
  • AutoFillTextField is removed and auto fill option is added as a parameter to the WireTextField as it doesn't make sense to keep two almost the same classes
  • common parts of these input pairs are extracted to "layout" composables - for WireTextField and WirePasswordTextField there is WireTextFieldLayout reused, and for CodeTextField there is a CodeTextFieldLayout
  • old "hybrid" text fields use StateSyncingModifier which is based on compose BasicTextFieldWithValueOnValueChangeSample which allows to synchronise between TextFieldState and TextFieldValue with onValueChanged callback

Notes:

  • in newest compose library version that this PR uses, BasicTextField2 has been marked as stable and renamed to regular BasicTextField, so it's quite confusing, but the difference is that new one takes TextFieldState instead of TextFieldValue or String
  • it's a bit related to https://github.com/wireapp/wire-android/pull/2988 as it also fixes this issue but RC PR only updates the text field for the message composer, this PR updates all text fields

Testing

How to Test

All text fields has been updated so ideally all of them should be tested and checked if they behave the same.


PR Post Submission Checklist for internal contributors (Optional)

  • [x] Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • [x] 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.

saleniuk avatar May 09 '24 15:05 saleniuk

Ups 🫰🟨

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

pull-request-size[bot] avatar May 09 '24 15:05 pull-request-size[bot]

Test Results

928 tests  ±0   928 :white_check_mark: ±0   13m 7s :stopwatch: - 1m 38s 123 suites ±0     0 :zzz: ±0  123 files   ±0     0 :x: ±0 

Results for commit b0ab19d6. ± Comparison against base commit bb9e7651.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar May 09 '24 15:05 github-actions[bot]

Build 4692 failed.

AndroidBob avatar May 09 '24 15:05 AndroidBob

Build 4693 failed.

AndroidBob avatar May 09 '24 15:05 AndroidBob

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

github-actions[bot] avatar May 09 '24 15:05 github-actions[bot]

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

github-actions[bot] avatar May 10 '24 15:05 github-actions[bot]

Build 4716 succeeded.

The build produced the following APK's:

AndroidBob avatar May 10 '24 17:05 AndroidBob

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

github-actions[bot] avatar May 14 '24 07:05 github-actions[bot]

Build 4726 succeeded.

The build produced the following APK's:

AndroidBob avatar May 14 '24 08:05 AndroidBob

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 44.15%. Comparing base (bb9e765) to head (b0ab19d).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2991      +/-   ##
===========================================
- Coverage    44.19%   44.15%   -0.05%     
===========================================
  Files          447      447              
  Lines        14548    14548              
  Branches      2498     2498              
===========================================
- Hits          6429     6423       -6     
- Misses        7417     7424       +7     
+ Partials       702      701       -1     
Files Coverage Δ
.../conversations/messages/item/RegularMessageItem.kt 0.00% <ø> (ø)
...nConversation/JoinConversationViaDeepLinkDialog.kt 85.71% <ø> (ø)

... and 2 files 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 bb9e765...b0ab19d. Read the comment docs.

codecov-commenter avatar May 14 '24 14:05 codecov-commenter

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

github-actions[bot] avatar May 14 '24 14:05 github-actions[bot]

Build 4739 succeeded.

The build produced the following APK's:

AndroidBob avatar May 14 '24 14:05 AndroidBob