refactor: update text input logic to v2 TextFieldState, part 1 [WPB-8779]
|
|
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?
Android Compose has new v2 version of text field inputs, and with that, they are going away from the previous approach with TextFieldValue and onValueChanged and replacing it with TextFieldState.
We already updated text fields to v2 but still are using "hybrid" solution which synchronises between TextFieldValue/onValueChanged and TextFieldState.
In this PR, following screens, their ViewModels logic and tests are updated to use TextFieldState:
- CreateAccountUsernameScreen
- ChangeDisplayNameScreen
- ChangeEmailScreen
- ChangeHandleScreen
Also, ShakeAnimation is fixed/updated, translationX in graphicsLayer is used instead of offset to make it lighter and smoother.
Testing
Test Coverage (Optional)
- [x] I have added automated test to this contribution
How to Test
Use text fields from any of listed screens.
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.
Test Results
930 tests   - 2   930 :white_check_mark:  - 2   9m 17s :stopwatch: - 1m 54s 124 suites ±0     0 :zzz: ±0  124 files   ±0     0 :x: ±0 
Results for commit e43d8180. ± Comparison against base commit 2b4b52eb.
This pull request removes 2 tests.
com.wire.android.ui.authentication.create.username.CreateAccountUsernameViewModelTest ‑ given forbidden character, when entering username, then forbidden character is ignored()
com.wire.android.ui.home.settings.account.displayname.ChangeDisplayNameViewModelTest ‑ when calling onAnimatedError, should emit animatedNameError false to clean state()
:recycle: This comment has been updated with latest results.
APKs built during tests are available here. Scroll down to Artifacts!
Codecov Report
Attention: Patch coverage is 86.48649% with 10 lines in your changes are missing coverage. Please review.
Project coverage is 44.29%. Comparing base (
2b4b52e) to head (e43d818).
Additional details and impacted files
@@ Coverage Diff @@
## develop #3010 +/- ##
===========================================
+ Coverage 44.20% 44.29% +0.09%
===========================================
Files 447 448 +1
Lines 14558 14508 -50
Branches 2497 2490 -7
===========================================
- Hits 6435 6426 -9
+ Misses 7428 7380 -48
- Partials 695 702 +7
| Files | Coverage Δ | |
|---|---|---|
| .../create/username/CreateAccountUsernameViewState.kt | 100.00% <ø> (ø) |
|
| ...e/settings/account/displayname/DisplayNameState.kt | 100.00% <100.00%> (ø) |
|
| .../home/settings/account/handle/ChangeHandleState.kt | 100.00% <ø> (ø) |
|
| .../src/main/kotlin/com/wire/android/util/Patterns.kt | 100.00% <100.00%> (ø) |
|
| ...ings/account/email/updateEmail/ChangeEmailState.kt | 90.00% <85.71%> (-10.00%) |
:arrow_down: |
| ...e/settings/account/handle/ChangeHandleViewModel.kt | 89.28% <91.66%> (+4.43%) |
:arrow_up: |
| .../account/displayname/ChangeDisplayNameViewModel.kt | 92.00% <88.23%> (-1.03%) |
:arrow_down: |
| .../account/email/updateEmail/ChangeEmailViewModel.kt | 86.11% <84.61%> (+23.36%) |
:arrow_up: |
| .../create/username/CreateAccountUsernameViewModel.kt | 86.20% <80.00%> (+4.81%) |
:arrow_up: |
... and 3 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 2b4b52e...e43d818. Read the comment docs.
APKs built during tests are available here. Scroll down to Artifacts!
APKs built during tests are available here. Scroll down to Artifacts!
Ups 🫰🟨
This PR is too big. Please try to break it up into smaller PRs.
Quality Gate passed
Issues
2 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
1.2% Duplication on New Code
APKs built during tests are available here. Scroll down to Artifacts!