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

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

Merged
merged 11 commits into from
May 22, 2024

Conversation

saleniuk
Copy link
Contributor

@saleniuk saleniuk commented May 15, 2024

TaskWPB-8779 Introduce BasicTextField2


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?

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)

  • 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)

  • 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.

Copy link
Contributor

github-actions bot commented May 15, 2024

Test Results

930 tests   - 2   930 ✅  - 2   9m 17s ⏱️ - 1m 54s
124 suites ±0     0 💤 ±0 
124 files   ±0     0 ❌ ±0 

Results for commit e43d818. ± Comparison against base commit 2b4b52e.

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()

♻️ This comment has been updated with latest results.

Copy link
Contributor

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

@AndroidBob
Copy link
Collaborator

Build 4764 succeeded.

The build produced the following APK's:

@codecov-commenter
Copy link

codecov-commenter commented May 15, 2024

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%) ⬇️
...e/settings/account/handle/ChangeHandleViewModel.kt 89.28% <91.66%> (+4.43%) ⬆️
.../account/displayname/ChangeDisplayNameViewModel.kt 92.00% <88.23%> (-1.03%) ⬇️
.../account/email/updateEmail/ChangeEmailViewModel.kt 86.11% <84.61%> (+23.36%) ⬆️
.../create/username/CreateAccountUsernameViewModel.kt 86.20% <80.00%> (+4.81%) ⬆️

... 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.

@saleniuk saleniuk requested review from a team, typfel, alexandreferris, mchenani, Garzas and ohassine and removed request for a team May 16, 2024 06:52
Copy link
Contributor

@alexandreferris alexandreferris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work!

got just 2 comments for the returned error type and checking

Copy link
Contributor

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

Copy link
Contributor

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

@AndroidBob
Copy link
Collaborator

Build 4827 succeeded.

The build produced the following APK's:

Copy link
Member

@ohassine ohassine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👌
Just one thing: we are using an alpha version of compose-foundation and compose-material-android, I'd suggest to upgrade it to latest version 1.7.0-beta01

…-v2-textfieldstate-pt1

# Conflicts:
#	app/src/main/kotlin/com/wire/android/ui/common/textfield/WirePasswordTextField.kt
Copy link

Ups 🫰🟨

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

Copy link

sonarcloud bot commented May 22, 2024

Quality Gate Passed Quality Gate passed

Issues
2 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
1.2% Duplication on New Code

See analysis details on SonarCloud

Copy link
Contributor

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

@AndroidBob
Copy link
Collaborator

Build 4888 succeeded.

The build produced the following APK's:

@saleniuk saleniuk added this pull request to the merge queue May 22, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 22, 2024
@saleniuk saleniuk added this pull request to the merge queue May 22, 2024
Merged via the queue into develop with commit 1aec80d May 22, 2024
13 checks passed
@saleniuk saleniuk deleted the refactor/update-to-v2-textfieldstate-pt1 branch May 22, 2024 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants