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

refactor: update text input logic to v2 TextFieldState, part 1 [WPB-8779]

Open saleniuk opened this issue 1 year ago • 5 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?

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
  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 15 '24 15:05 saleniuk

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.

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

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

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

Build 4764 succeeded.

The build produced the following APK's:

AndroidBob avatar May 15 '24 16:05 AndroidBob

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 data Powered by Codecov. Last update 2b4b52e...e43d818. Read the comment docs.

codecov-commenter avatar May 15 '24 16:05 codecov-commenter

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

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

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

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

Build 4827 succeeded.

The build produced the following APK's:

AndroidBob avatar May 21 '24 09:05 AndroidBob

Ups 🫰🟨

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

pull-request-size[bot] avatar May 22 '24 11:05 pull-request-size[bot]

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

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

Build 4888 succeeded.

The build produced the following APK's:

AndroidBob avatar May 22 '24 12:05 AndroidBob