refactor: introduce BasicTextField2 [WPB-8779] [WPB-8727]
|
|
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 whichBasicTextField2has been marked as stable; in versions prior to chosen one, including current newest release version -1.6.7,BasicTextField2has 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.0version,rememberRipple()needs to be updated toripple()andAnchoredDraggableStatealso requiresdecayAnimationSpec - our each input type now has two different versions, one "hybrid" still with
TextFieldValueandonValueChangedand second one already withTextFieldState- it applies toWireTextField,WirePasswordTextFieldandCodeTextField -
AutoFillTextFieldis removed and auto fill option is added as a parameter to theWireTextFieldas it doesn't make sense to keep two almost the same classes - common parts of these input pairs are extracted to "layout" composables - for
WireTextFieldandWirePasswordTextFieldthere isWireTextFieldLayoutreused, and forCodeTextFieldthere is aCodeTextFieldLayout - old "hybrid" text fields use
StateSyncingModifierwhich is based on compose BasicTextFieldWithValueOnValueChangeSample which allows to synchronise betweenTextFieldStateandTextFieldValuewithonValueChangedcallback
Notes:
- in newest compose library version that this PR uses,
BasicTextField2has been marked as stable and renamed to regularBasicTextField, so it's quite confusing, but the difference is that new one takesTextFieldStateinstead ofTextFieldValueorString - 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
- https://sparkbox.com/foundry/semantic_commit_messages
- https://github.com/wireapp/.github#usage
- E.g.
feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.
Ups 🫰🟨
This PR is too big. Please try to break it up into smaller PRs.
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.
Build 4692 failed.
Build 4693 failed.
APKs built during tests are available here. Scroll down to Artifacts!
APKs built during tests are available here. Scroll down to Artifacts!
APKs built during tests are available here. Scroll down to Artifacts!
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 dataPowered by Codecov. Last update bb9e765...b0ab19d. Read the comment docs.
APKs built during tests are available here. Scroll down to Artifacts!