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

fix: blinking keyboard [WPB-4797] #2258

Merged
merged 31 commits into from
Sep 27, 2023
Merged

fix: blinking keyboard [WPB-4797] #2258

merged 31 commits into from
Sep 27, 2023

Conversation

Garzas
Copy link
Contributor

@Garzas Garzas commented Sep 22, 2023

BugWPB-4797 Fix keyboard strange behaviour when user clicks additional option button


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?

Issues

On some devices like Xiaomi 10T with android 12. Keyboard is showing for a moment after hiding when is triggered by focus requester or focus manager. I found out that only working solution was to update compose libraries to alpha where readOnly status can force not showing keyboard for BasicTextField
https://developer.android.com/jetpack/androidx/releases/compose-ui#1.6.0-alpha03

Also:

  • added delay for clicking on additional option button to not have race condition when keyboard is moving
  • when text input is read only it cannot be focused, so I added interactionSource to it to listen when text input is clicked
  • added isKeyboardMoving to avoid triggering additional actions when keyboard hides or shows
  • updated paging library

Attachments (Optional)

Attachments like images, videos, etc. (drag and drop in the text box)

Before After
https://github.com/wireapp/wire-android-reloaded/assets/13151239/ce425c37-f22e-4340-9185-91db14ccde6a https://github.com/wireapp/wire-android-reloaded/assets/13151239/a2a94939-5277-403d-8505-00c7a20a9f17

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.

@Garzas Garzas self-assigned this Sep 22, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 22, 2023

Test Results

623 tests  ±0   622 ✔️ ±0   7m 55s ⏱️ - 1m 11s
  89 suites ±0       1 💤 ±0 
  89 files   ±0       0 ±0 

Results for commit c1edfec. ± Comparison against base commit d15cb06.

♻️ This comment has been updated with latest results.

@AndroidBob
Copy link
Collaborator

Build 907 failed.

@AndroidBob
Copy link
Collaborator

Build 911 succeeded.

The build produced the following APK's:

@codecov
Copy link

codecov bot commented Sep 22, 2023

Codecov Report

Merging #2258 (c1edfec) into develop (d15cb06) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@              Coverage Diff              @@
##             develop    #2258      +/-   ##
=============================================
- Coverage      40.51%   40.50%   -0.01%     
  Complexity      1015     1015              
=============================================
  Files            318      318              
  Lines          11661    11665       +4     
  Branches        1550     1551       +1     
=============================================
+ Hits            4724     4725       +1     
- Misses          6493     6496       +3     
  Partials         444      444              
Files Coverage Δ
...essagecomposer/state/MessageComposerStateHolder.kt 60.60% <ø> (-1.16%) ⬇️
.../messagecomposer/state/MessageCompositionHolder.kt 28.63% <ø> (+0.13%) ⬆️
...mposer/state/MessageCompositionInputStateHolder.kt 56.52% <100.00%> (+0.63%) ⬆️

... 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 d15cb06...c1edfec. Read the comment docs.

@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

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

@AndroidBob
Copy link
Collaborator

Build 922 succeeded.

The build produced the following APK's:

@github-actions
Copy link
Contributor

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

@AndroidBob
Copy link
Collaborator

Build 932 succeeded.

The build produced the following APK's:

@github-actions
Copy link
Contributor

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

@AndroidBob
Copy link
Collaborator

Build 955 succeeded.

The build produced the following APK's:

@github-actions
Copy link
Contributor

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

@AndroidBob
Copy link
Collaborator

Build 1011 succeeded.

The build produced the following APK's:

Comment on lines 31 to 32
androidx-paging3 = "3.2.1"
androidx-paging3Compose = "3.2.1"
Copy link
Contributor

Choose a reason for hiding this comment

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

question: is this necessary for the scope of this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can create separate PR with this

@@ -73,18 +76,20 @@ fun EnabledMessageComposer(
val density = LocalDensity.current
val navBarHeight = BottomNavigationBarHeight()
val isImeVisible = WindowInsets.isImeVisible
val offsetY = WindowInsets.ime.getBottom(density)
val height = WindowInsets.ime.getBottom(density)
Copy link
Contributor

Choose a reason for hiding this comment

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

question: what height is it? I think it was more clear with previous name offsetY because it's used to move this composable up, but correct me if I'm wrong

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, reverted

Comment on lines +36 to +48
/**
* Represents an additional option button with controlled interactivity for message composer.
*
* The button's clickability can be controlled via the `isSelected` parameter. This composable also
* internally handles preventing rapid successive clicks using the `enableAgain` variable. This
* mechanism is particularly important to ensure that, during keyboard transitions (expanding or
* collapsing), unintended or unexpected repetitive button clicks do not occur, preventing the
* keyboard from collapsing in an unexpected manner.
*
* @param isSelected Indicates whether the button is selected or not.
* @param onClick The action to be performed when the button is clicked.
* @param modifier The optional [Modifier] to be applied to this composable.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: this comment seems to be out of place because of the const val in between it and the function that it explains 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved under this composable 😅

* @param modifier The optional [Modifier] to be applied to this composable.
*/

private const val BUTTON_CLICK_DELAY_MILLIS = 500L
Copy link
Contributor

Choose a reason for hiding this comment

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

question: does it have to be that big? Half a second is already noticeable and I'm afraid that if we have to add such a long delay then maybe we are doing something wrong

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lowered to 400ms

@Garzas Garzas requested a review from saleniuk September 27, 2023 09:35
@github-actions
Copy link
Contributor

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

@AndroidBob
Copy link
Collaborator

Build 1014 succeeded.

The build produced the following APK's:

@Garzas Garzas added this pull request to the merge queue Sep 27, 2023
Merged via the queue into develop with commit f65934a Sep 27, 2023
11 checks passed
@Garzas Garzas deleted the fix/blinking-keyboard branch September 27, 2023 10:41
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.

4 participants